Messages in this thread | | | Date | Mon, 7 Nov 2022 14:40:52 -0800 | Subject | Re: [PATCH v3 4/5] selftests/resctrl: Cleanup properly when an error occurs in CAT test | From | Reinette Chatre <> |
| |
Hi Shaopeng,
On 11/1/2022 2:43 AM, Shaopeng Tan wrote: > After creating a child process with fork() in CAT test, if there is > an error occurs or such as a SIGINT signal is received, the parent
I find the above hard to read. How about "..., if an error occurs or a signal such as SIGINT is received, ..."
> process will be terminated immediately, but the child process will not > be killed and also umount_resctrlfs() will not be called. > > Add a signal handler like other tests to kill child process, umount > resctrlfs, cleanup result files, etc. when an error occurs. > > Signed-off-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com> > --- > tools/testing/selftests/resctrl/cat_test.c | 28 +++++++++++++++------- > 1 file changed, 19 insertions(+), 9 deletions(-) >
...
> @@ -201,7 +212,6 @@ int cat_perf_miss_val(int cpu_no, int n, char *cache_type) > sizeof(pipe_message)) { > close(pipefd[1]); > perror("# failed signaling parent process"); > - return errno;
It looks like pipefd[1] will be closed twice if the write() failed.
It does look strange to let the child continue to its infinite loop after the write() failed. I assume that it is because the parent will also be stuck and the new ctrl_handler() is expected to unblock both? Could you please add a comment to the code to clarify this flow?
Thank you very much
Reinette
| |