linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf trace: Move SIGCHLD handler init to trace__run
@ 2022-01-06 22:20 Jiri Olsa
  2022-01-07 18:57 ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 2+ messages in thread
From: Jiri Olsa @ 2022-01-06 22:20 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Christy Lee, lkml, Peter Zijlstra, Ingo Molnar, Mark Rutland,
	Namhyung Kim, Alexander Shishkin, Michael Petlan, Ian Rogers,
	linux-perf-users

When running perf trace with bpf object like:
  # perf trace -e openat,/.../tools/perf/examples/bpf/hello.c

the event parsing eventually calls llvm__get_kbuild_opts function
that runs script and that ends up with SIGCHLD delivered to perf
trace handler, which assumes the workload process is done and quits
perf trace.

Moving the SIGCHLD handler setup directly to trace__run, where the
event is parsed and object already compiled.

Cc: Christy Lee <christyc.y.lee@gmail.com>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/builtin-trace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 94d62a92f1a1..4282ef9ec354 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -3925,6 +3925,7 @@ static int trace__run(struct trace *trace, int argc, const char **argv)
 	bool draining = false;
 
 	trace->live = true;
+	signal(SIGCHLD, sig_handler);
 
 	if (!trace->raw_augmented_syscalls) {
 		if (trace->trace_syscalls && trace__add_syscall_newtp(trace))
@@ -4876,7 +4877,6 @@ int cmd_trace(int argc, const char **argv)
 
 	signal(SIGSEGV, sighandler_dump_stack);
 	signal(SIGFPE, sighandler_dump_stack);
-	signal(SIGCHLD, sig_handler);
 	signal(SIGINT, sig_handler);
 
 	trace.evlist = evlist__new();
-- 
2.33.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-01-07 18:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-06 22:20 [PATCH] perf trace: Move SIGCHLD handler init to trace__run Jiri Olsa
2022-01-07 18:57 ` Arnaldo Carvalho de Melo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).