]> git.baikalelectronics.ru Git - kernel.git/commit
perf trace: Fix race in signal handling
authorMichael Petlan <mpetlan@redhat.com>
Tue, 2 Mar 2021 14:41:20 +0000 (15:41 +0100)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Sat, 6 Mar 2021 19:54:32 +0000 (16:54 -0300)
commita3a16d66ae3e3285cc9b32ea475343ee32cfc1f9
tree66faab23b448d9a37bc4b90d433d8076c13b8cb1
parent06cfca068093026dff26e79cfb9db37f0a6c8c77
perf trace: Fix race in signal handling

Since a lot of stuff happens before the SIGINT signal handler is registered
(scanning /proc/*, etc.), on bigger systems, such as Cavium Sabre CN99xx,
it may happen that first interrupt signal is lost and perf isn't correctly
terminated.

The reproduction code might look like the following:

    perf trace -a &
    PERF_PID=$!
    sleep 4
    kill -INT $PERF_PID

The issue has been found on a CN99xx machine with RHEL-8 and the patch fixes
it by registering the signal handlers earlier in the init stage.

Suggested-by: Jiri Olsa <jolsa@redhat.com>
Signed-off-by: Michael Petlan <mpetlan@redhat.com>
Tested-by: Michael Petlan <mpetlan@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: https://lore.kernel.org/lkml/YEJnaMzH2ctp3PPx@kernel.org/
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-trace.c