mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
perf perl scripts: Fix SIGALRM and pipe read race for rwtop
Fixing rwtop script race. The issue is caused by rwtop script triggering SIGALRM and underneath pipe reading layer reporting error when interrupted. Fixing this by setting SA_RESTART for rwtop SIGALRM handler, which avoids interruption of the pipe reading layer. The discussion for this issue & fix is here: https://lkml.org/lkml/2012/9/18/123 Signed-off-by: Jiri Olsa <[email protected]> Original-patch-by: Andrew Jones <[email protected]> Cc: Andrew Jones <[email protected]> Cc: Corey Ashford <[email protected]> Cc: David Ahern <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Paul Mackerras <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
This commit is contained in:
parent
0c5268bf22
commit
b22e79395c
1 changed files with 5 additions and 1 deletions
|
|
@ -17,6 +17,7 @@ use lib "$ENV{'PERF_EXEC_PATH'}/scripts/perl/Perf-Trace-Util/lib";
|
|||
use lib "./Perf-Trace-Util/lib";
|
||||
use Perf::Trace::Core;
|
||||
use Perf::Trace::Util;
|
||||
use POSIX qw/SIGALRM SA_RESTART/;
|
||||
|
||||
my $default_interval = 3;
|
||||
my $nlines = 20;
|
||||
|
|
@ -90,7 +91,10 @@ sub syscalls::sys_enter_write
|
|||
|
||||
sub trace_begin
|
||||
{
|
||||
$SIG{ALRM} = \&set_print_pending;
|
||||
my $sa = POSIX::SigAction->new(\&set_print_pending);
|
||||
$sa->flags(SA_RESTART);
|
||||
$sa->safe(1);
|
||||
POSIX::sigaction(SIGALRM, $sa) or die "Can't set SIGALRM handler: $!\n";
|
||||
alarm 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue