diff options
author | Jiri Olsa <jolsa@redhat.com> | 2013-02-05 11:05:50 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-02-06 16:09:27 -0500 |
commit | b22e79395c0fe4c86dd35745a929366034386ccc (patch) | |
tree | 1096eeb6bb9c5237a33c206a02137e6dbd8cee5d /tools/perf/scripts | |
parent | 0c5268bf2218144469dde3228f14898fadbbcdcd (diff) |
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 <jolsa@redhat.com>
Original-patch-by: Andrew Jones <drjones@redhat.com>
Cc: Andrew Jones <drjones@redhat.com>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1360080351-3246-2-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/scripts')
-rw-r--r-- | tools/perf/scripts/perl/rwtop.pl | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tools/perf/scripts/perl/rwtop.pl b/tools/perf/scripts/perl/rwtop.pl index 4bb3ecd33472..8b20787021c1 100644 --- a/tools/perf/scripts/perl/rwtop.pl +++ b/tools/perf/scripts/perl/rwtop.pl | |||
@@ -17,6 +17,7 @@ use lib "$ENV{'PERF_EXEC_PATH'}/scripts/perl/Perf-Trace-Util/lib"; | |||
17 | use lib "./Perf-Trace-Util/lib"; | 17 | use lib "./Perf-Trace-Util/lib"; |
18 | use Perf::Trace::Core; | 18 | use Perf::Trace::Core; |
19 | use Perf::Trace::Util; | 19 | use Perf::Trace::Util; |
20 | use POSIX qw/SIGALRM SA_RESTART/; | ||
20 | 21 | ||
21 | my $default_interval = 3; | 22 | my $default_interval = 3; |
22 | my $nlines = 20; | 23 | my $nlines = 20; |
@@ -90,7 +91,10 @@ sub syscalls::sys_enter_write | |||
90 | 91 | ||
91 | sub trace_begin | 92 | sub trace_begin |
92 | { | 93 | { |
93 | $SIG{ALRM} = \&set_print_pending; | 94 | my $sa = POSIX::SigAction->new(\&set_print_pending); |
95 | $sa->flags(SA_RESTART); | ||
96 | $sa->safe(1); | ||
97 | POSIX::sigaction(SIGALRM, $sa) or die "Can't set SIGALRM handler: $!\n"; | ||
94 | alarm 1; | 98 | alarm 1; |
95 | } | 99 | } |
96 | 100 | ||