Re: [PATCH v5 4/5] selftests/resctrl: Cleanup properly when an error occurs in CAT test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Shaopeng,

On 1/22/2023 8:22 PM, Shaopeng Tan (Fujitsu) wrote:
>> On 1/10/2023 11:58 PM, Shaopeng Tan wrote:

...

>>> diff --git a/tools/testing/selftests/resctrl/cat_test.c
>>> b/tools/testing/selftests/resctrl/cat_test.c
>>> index 6a8306b0a109..87302b882929 100644
>>> --- a/tools/testing/selftests/resctrl/cat_test.c
>>> +++ b/tools/testing/selftests/resctrl/cat_test.c
>>> @@ -103,7 +103,6 @@ int cat_perf_miss_val(int cpu_no, int n, char
>> *cache_type)
>>>  	unsigned long l_mask, l_mask_1;
>>>  	int ret, pipefd[2], sibling_cpu_no;
>>>  	char pipe_message;
>>> -	pid_t bm_pid;
>>>
>>>  	cache_size = 0;
>>>
>>> @@ -181,28 +180,29 @@ int cat_perf_miss_val(int cpu_no, int n, char
>> *cache_type)
>>>  		strcpy(param.filename, RESULT_FILE_NAME1);
>>>  		param.num_of_runs = 0;
>>>  		param.cpu_no = sibling_cpu_no;
>>> +	} else {
>>> +		ret = signal_handler_register();
>>> +		if (ret)
>>> +			goto out;
>>
>> The "goto" will unregister the signal handler. Is that necessary if the registration
>> failed?
>>
>> Also, if signal_handler_register() fails then the child will keep running and run
>> its test ... would child not then run forever?
> 
> A signal handler is needed here, but it is rarely used.
> Also, the registration rarely fails.
> Therefore, if registration failed, 
> just print a warning/info message as follow.
> how about this idea?
> 
> ksft_print_msg("Failed to register signal handler, signals SIGINT/SIGTERM/SIGHUP will not be handled as expected");
> 

I do not think this is necessary considering that signal_handler_register()
already prints an error on failure. 

Adding an error message does not address the two issues I raised.

Reinette




[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux