[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAP-5=fWvxxZzxuFjiPCfNgY0uTLo+VL-az-Wig6mmi-H4hs4uQ@mail.gmail.com>
Date: Mon, 2 Dec 2024 11:41:27 -0800
From: Ian Rogers <irogers@...gle.com>
To: James Clark <james.clark@...aro.org>
Cc: linux-perf-users@...r.kernel.org, Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>, Arnaldo Carvalho de Melo <acme@...nel.org>, Namhyung Kim <namhyung@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>, Jiri Olsa <jolsa@...nel.org>,
Adrian Hunter <adrian.hunter@...el.com>, "Liang, Kan" <kan.liang@...ux.intel.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] perf test: Don't signal all processes on system when
interrupting tests
On Fri, Nov 29, 2024 at 7:20 AM James Clark <james.clark@...aro.org> wrote:
>
> This signal handler loops over all tests on ctrl-C, but it's active
> while the test list is being constructed. process.pid is 0, then -1,
> then finally set to the child pid on fork. If the Ctrl-C is received
> during this point a kill(-1, SIGINT) can be sent which affects all
> processes.
>
> Make sure the child has forked first before forwarding the signal. This
> can be reproduced with ctrl-C immediately after launching perf test
> which terminates the ssh connection.
>
> Fixes: 553d5efeb341 ("perf test: Add a signal handler to kill forked child processes")
> Signed-off-by: James Clark <james.clark@...aro.org>
(Resend as plain text)
Reviewed-by: Ian Rogers <irogers@...gle.com>
Sorry for the lost ssh connections :-)
Thanks,
Ian
>
> ---
> tools/perf/tests/builtin-test.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c
> index 8dcf74d3c0a3..4751dd3c6f67 100644
> --- a/tools/perf/tests/builtin-test.c
> +++ b/tools/perf/tests/builtin-test.c
> @@ -508,7 +508,7 @@ static int __cmd_test(struct test_suite **suites, int argc, const char *argv[],
> for (size_t x = 0; x < num_tests; x++) {
> struct child_test *child_test = child_tests[x];
>
> - if (!child_test)
> + if (!child_test || child_test->process.pid <= 0)
> continue;
>
> pr_debug3("Killing %d pid %d\n",
> --
> 2.34.1
>
Powered by blists - more mailing lists