All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
To: Reinette Chatre <reinette.chatre@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>, Shuah Khan <shuah@kernel.org>,
	<ilpo.jarvinen@linux.intel.com>, <linux-kernel@vger.kernel.org>,
	<linux-kselftest@vger.kernel.org>
Subject: Re: [PATCH v3 2/3] selftests/resctrl: Simplify cleanup in ctrl-c handler
Date: Mon, 26 Feb 2024 10:43:35 +0100	[thread overview]
Message-ID: <qxn5tpm3gkv7l32rbcjapik6mn7uzmv24zw7hyrvp55mngyufb@3fgphjebxkvb> (raw)
In-Reply-To: <635699af-4abc-491e-9528-66ebfe9eaf6d@intel.com>

On 2024-02-23 at 13:18:22 -0800, Reinette Chatre wrote:
>Hi Maciej,
>
>On 2/22/2024 4:07 AM, Maciej Wieczor-Retman wrote:
>  	}
>> diff --git a/tools/testing/selftests/resctrl/resctrl_val.c b/tools/testing/selftests/resctrl/resctrl_val.c
>> index 5a49f07a6c85..0134aa2f896a 100644
>> --- a/tools/testing/selftests/resctrl/resctrl_val.c
>> +++ b/tools/testing/selftests/resctrl/resctrl_val.c
>> @@ -62,6 +62,7 @@ struct imc_counter_config {
>>  static char mbm_total_path[1024];
>>  static int imcs;
>>  static struct imc_counter_config imc_counters_config[MAX_IMCS][2];
>> +static const struct resctrl_test *current_test;
>>  
>>  void membw_initialize_perf_event_attr(int i, int j)
>>  {
>> @@ -472,7 +473,8 @@ void ctrlc_handler(int signum, siginfo_t *info, void *ptr)
>>  	if (bm_pid)
>>  		kill(bm_pid, SIGKILL);
>>  	umount_resctrlfs();
>> -	tests_cleanup();
>> +	if (current_test->cleanup)
>> +		current_test->cleanup();
>
>Could you please make this more robust with a:
>
>	if (current_test && current_test->cleanup)

Okay, will do.

>
>>  	ksft_print_msg("Ending\n\n");
>>  
>>  	exit(EXIT_SUCCESS);
>> @@ -482,13 +484,14 @@ void ctrlc_handler(int signum, siginfo_t *info, void *ptr)
>>   * Register CTRL-C handler for parent, as it has to kill
>>   * child process before exiting.
>>   */
>> -int signal_handler_register(void)
>> +int signal_handler_register(const struct resctrl_test *test)
>>  {
>>  	struct sigaction sigact = {};
>>  	int ret = 0;
>>  
>>  	bm_pid = 0;
>>  
>> +	current_test = test;
>>  	sigact.sa_sigaction = ctrlc_handler;
>>  	sigemptyset(&sigact.sa_mask);
>>  	sigact.sa_flags = SA_SIGINFO;
>
>Could you please reset the pointer in signal_handler_unregister()?

Okay, I'll set it to NULL here.

>
>Reinette

-- 
Kind regards
Maciej Wieczór-Retman

  reply	other threads:[~2024-02-26  9:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-22 12:06 [PATCH v3 0/3] selftests/resctrl: Simplify test cleanup functions Maciej Wieczor-Retman
2024-02-22 12:07 ` [PATCH v3 1/3] selftests/resctrl: Add cleanup function to test framework Maciej Wieczor-Retman
2024-02-22 12:07 ` [PATCH v3 2/3] selftests/resctrl: Simplify cleanup in ctrl-c handler Maciej Wieczor-Retman
2024-02-23 21:18   ` Reinette Chatre
2024-02-26  9:43     ` Maciej Wieczor-Retman [this message]
2024-02-22 12:07 ` [PATCH v3 3/3] selftests/resctrl: Move cleanups out of individual tests Maciej Wieczor-Retman
2024-02-23 21:18   ` Reinette Chatre
2024-02-26  9:42     ` Maciej Wieczor-Retman

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=qxn5tpm3gkv7l32rbcjapik6mn7uzmv24zw7hyrvp55mngyufb@3fgphjebxkvb \
    --to=maciej.wieczor-retman@intel.com \
    --cc=fenghua.yu@intel.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=reinette.chatre@intel.com \
    --cc=shuah@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.