perf trace: Move SIGCHLD handler init to trace__run
PATCH 1/1 perf trace: Move SIGCHLD handler init to trace__run
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.
--- tools/perf/builtin-trace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/builtin-trace.c +1 -1
@@ -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 ();
Signature · 1 line
2.33.1
Arnaldo Carvalho de Melo
maintainerEm Thu, Jan 06, 2022 at 11:20:30PM +0100, Jiri Olsa escreveu:
Quoted 10 lines
When running perf trace with bpf object like:
# perf trace -e openat,/.../tools/perf/examples/bpf/hello.cthe event parsing eventually calls
llvm__get_kbuild_optsfunction 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.
Thanks, reproduced the problem without the patch, applied, tested again, works.
- Arnaldo
Quoted 28 lines
Cc Christy Lee <[email protected]>Signed-off-by Jiri Olsa <[email protected]>--- tools/perf/builtin-trace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/perf/builtin-trace.c +1
-1@@ -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 ();Signature · 1 line
2.33.1
Signature · 1 line
- Arnaldo