Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Reinette Chatre <reinette.chatre@intel.com>
To: "Shaopeng Tan (Fujitsu)" <tan.shaopeng@fujitsu.com>,
	Fenghua Yu <fenghua.yu@intel.com>, Shuah Khan <shuah@kernel.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-kselftest@vger.kernel.org"
	<linux-kselftest@vger.kernel.org>
Subject: Re: [PATCH v5 4/5] selftests/resctrl: Cleanup properly when an error occurs in CAT test
Date: Mon, 23 Jan 2023 09:36:13 -0800	[thread overview]
Message-ID: <25ca1de3-5673-6332-a1d5-59920c191739@intel.com> (raw)
In-Reply-To: <TYAPR01MB6330B2248A693BD3170CC76B8BC89@TYAPR01MB6330.jpnprd01.prod.outlook.com>

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


  reply	other threads:[~2023-01-23 17:37 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-11  7:57 [PATCH v5 0/5] Some improvements of resctrl selftest Shaopeng Tan
2023-01-11  7:57 ` [PATCH v5 1/5] selftests/resctrl: Fix set up schemata with 100% allocation on first run in MBM test Shaopeng Tan
2023-01-11  7:57 ` [PATCH v5 2/5] selftests/resctrl: Return MBA check result and make it to output message Shaopeng Tan
2023-01-11  7:58 ` [PATCH v5 3/5] selftests/resctrl: Flush stdout file buffer before executing fork() Shaopeng Tan
2023-01-11  7:58 ` [PATCH v5 4/5] selftests/resctrl: Cleanup properly when an error occurs in CAT test Shaopeng Tan
2023-01-19  0:57   ` Reinette Chatre
2023-01-23  4:22     ` Shaopeng Tan (Fujitsu)
2023-01-23 17:36       ` Reinette Chatre [this message]
2023-01-24  2:16         ` Shaopeng Tan (Fujitsu)
2023-01-24 17:19           ` Reinette Chatre
2023-01-11  7:58 ` [PATCH v5 5/5] selftests/resctrl: Remove duplicate codes that clear each test result file Shaopeng Tan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=25ca1de3-5673-6332-a1d5-59920c191739@intel.com \
    --to=reinette.chatre@intel.com \
    --cc=fenghua.yu@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=tan.shaopeng@fujitsu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox