Skip to content

Commit f06a82f

Browse files
Jiri Olsaacmel
authored andcommitted
perf trace: Avoid early exit due to running SIGCHLD handler before it makes sense to
When running 'perf trace' with an BPF object like: # perf trace -e openat,tools/perf/examples/bpf/hello.c the event parsing eventually calls llvm__get_kbuild_opts() that runs a script and that ends up with SIGCHLD delivered to the 'perf trace' handler, which assumes the workload process is done and quits 'perf trace'. Move the SIGCHLD handler setup directly to trace__run(), where the event is parsed and the object is already compiled. Signed-off-by: Jiri Olsa <[email protected]> Tested-by: Arnaldo Carvalho de Melo <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Christy Lee <[email protected]> Cc: Ian Rogers <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Michael Petlan <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: http://lore.kernel.org/lkml/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 2455672 commit f06a82f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tools/perf/builtin-trace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3925,6 +3925,7 @@ static int trace__run(struct trace *trace, int argc, const char **argv)
39253925
bool draining = false;
39263926

39273927
trace->live = true;
3928+
signal(SIGCHLD, sig_handler);
39283929

39293930
if (!trace->raw_augmented_syscalls) {
39303931
if (trace->trace_syscalls && trace__add_syscall_newtp(trace))
@@ -4873,7 +4874,6 @@ int cmd_trace(int argc, const char **argv)
48734874

48744875
signal(SIGSEGV, sighandler_dump_stack);
48754876
signal(SIGFPE, sighandler_dump_stack);
4876-
signal(SIGCHLD, sig_handler);
48774877
signal(SIGINT, sig_handler);
48784878

48794879
trace.evlist = evlist__new();

0 commit comments

Comments
 (0)