From: "Shaopeng Tan (Fujitsu)" <tan.shaopeng@fujitsu.com>
To: 'Reinette Chatre' <reinette.chatre@intel.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>,
Shuah Khan <skhan@linuxfoundation.org>
Subject: RE: [PATCH v4 4/5] selftests/resctrl: Cleanup properly when an error occurs in CAT test
Date: Thu, 1 Dec 2022 08:20:08 +0000 [thread overview]
Message-ID: <TYAPR01MB6330FFB9E5BA7CCDC652EE3F8B149@TYAPR01MB6330.jpnprd01.prod.outlook.com> (raw)
In-Reply-To: <ce549bc3-7e54-b1d3-7ec5-4cde66bd468f@intel.com>
Hi Reinette,
> On 11/30/2022 12:32 AM, Shaopeng Tan (Fujitsu) wrote:
>
> > Removing ctrl_handler() is only part of the fix in the next version(v5).
> > All fixes as follows.
> >
> > --- a/tools/testing/selftests/resctrl/cat_test.c
> > +++ b/tools/testing/selftests/resctrl/cat_test.c
> > @@ -98,12 +98,17 @@ void cat_test_cleanup(void)
> > remove(RESULT_FILE_NAME2);
> > }
> >
> > +static void ctrlc_handler_child(int signum, siginfo_t *info, void
> > +*ptr) {
> > + exit(EXIT_SUCCESS);
> > +}
> > +
>
> Could you please elaborate why this is necessary?
If enter "ctrl-c" when running "resctrl_tests -t cat",
SIGINT will be sent to all processes (parent&child).
At this time, the child process receives a SIGINT signal, but does not take any action.
In this case the parent process may not call ctrlc_handler() as expected.
Therefore, ctrlc_handler_child() is necessary.
It may be better to ignore the signal, then code can be simple as follows.
----
if (bm_pid == 0) {
param.mask = l_mask_1;
strcpy(param.ctrlgrp, "c1");
strcpy(param.mongrp, "m1");
param.span = cache_size * n / count_of_bits;
strcpy(param.filename, RESULT_FILE_NAME1);
param.num_of_runs = 0;
param.cpu_no = sibling_cpu_no;
/* Ignore the signal,and wait to be cleaned up by the parent process */
sigfillset(&sigact.sa_mask);
sigact.sa_handler = SIG_IGN;
//sigact.sa_sigaction = ctrlc_handler_child; //delete
if (sigaction(SIGINT, &sigact, NULL) ||
sigaction(SIGTERM, &sigact, NULL) ||
sigaction(SIGHUP, &sigact, NULL))
perror("# sigaction");
} else {
----
Best regards,
Shaopeng Tan
next prev parent reply other threads:[~2022-12-01 8:20 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-17 1:05 [PATCH v4 0/5] Some improvements of resctrl selftest Shaopeng Tan
2022-11-17 1:05 ` [PATCH v4 1/5] selftests/resctrl: Fix set up schemata with 100% allocation on first run in MBM test Shaopeng Tan
2022-11-17 1:05 ` [PATCH v4 2/5] selftests/resctrl: Return MBA check result and make it to output message Shaopeng Tan
2022-11-17 1:05 ` [PATCH v4 3/5] selftests/resctrl: Flush stdout file buffer before executing fork() Shaopeng Tan
2022-11-17 1:05 ` [PATCH v4 4/5] selftests/resctrl: Cleanup properly when an error occurs in CAT test Shaopeng Tan
2022-11-23 17:48 ` Reinette Chatre
2022-11-24 8:17 ` Shaopeng Tan (Fujitsu)
2022-11-28 17:11 ` Reinette Chatre
2022-11-30 8:32 ` Shaopeng Tan (Fujitsu)
2022-11-30 16:33 ` Reinette Chatre
2022-12-01 8:20 ` Shaopeng Tan (Fujitsu) [this message]
2022-12-01 18:12 ` Reinette Chatre
2022-12-16 8:20 ` Shaopeng Tan (Fujitsu)
2022-12-16 19:08 ` Reinette Chatre
2022-11-17 1:05 ` [PATCH v4 5/5] selftests/resctrl: Remove duplicate codes that clear each test result file Shaopeng Tan
2022-11-23 17:49 ` Reinette Chatre
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=TYAPR01MB6330FFB9E5BA7CCDC652EE3F8B149@TYAPR01MB6330.jpnprd01.prod.outlook.com \
--to=tan.shaopeng@fujitsu.com \
--cc=fenghua.yu@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=reinette.chatre@intel.com \
--cc=shuah@kernel.org \
--cc=skhan@linuxfoundation.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®