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

The reproduction code might look like the following:

    perf trace -a &
    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 <>
Signed-off-by: Michael Petlan <>
Tested-by: Michael Petlan <>
Cc: Jiri Olsa <>
Signed-off-by: Arnaldo Carvalho de Melo <>
1 file changed