lkml.org 
[lkml]   [2013]   [May]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] perf: detect loops processing events
Date
Recovery algorithm in __perf_session__process_events attempts to remap
a perf.data file with a different file_offset and try again at a new head
position. Both of these adjustment rely on page_offset. If page_offset is
0 then file_offset and head never change which means the remap attempt is
the same and the fetch_mmaped_event is the same and the processing just
loops forever.

Detect this condition and warn the user.

Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
---
tools/perf/util/session.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index cf1fe01..1c4dc45 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -1235,6 +1235,12 @@ more:
}

page_offset = page_size * (head / page_size);
+ /* catch looping where we never make forward progress. */
+ if (page_offset == 0) {
+ pr_err("Loop detection processing events. Is file corrupted?\n");
+ return -1;
+ }
+
file_offset += page_offset;
head -= page_offset;
goto remap;
--
1.7.10.1


\
 
 \ /
  Last update: 2013-05-08 18:01    [W:0.043 / U:1.192 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site