Skip to content

Commit

Permalink
perf trace: Avoid early exit due to running SIGCHLD handler before it…
Browse files Browse the repository at this point in the history
… 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]>
  • Loading branch information
Jiri Olsa authored and acmel committed Jan 7, 2022
1 parent 2455672 commit f06a82f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/perf/builtin-trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -4873,7 +4874,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();
Expand Down

0 comments on commit f06a82f

Please sign in to comment.