aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/session.c
diff options
context:
space:
mode:
authorKan Liang <kan.liang@intel.com>2015-06-17 09:51:10 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-06-19 17:20:15 -0400
commit930e6fcd2bcce9bcd9d4aa7e755678d33f3fe6f4 (patch)
tree5f85d268437a01f2a2982be31c82cb00a81efd85 /tools/perf/util/session.c
parentc05676c06232e6459a6106ddf0d4e154ce6cd859 (diff)
perf tools: Add time out to force stop proc map processing
System wide sampling like 'perf top' or 'perf record -a' read all threads /proc/xxx/maps before sampling. If there are any threads which generating a keeping growing huge maps, perf will do infinite loop during synthesizing. Nothing will be sampled. This patch fixes this issue by adding per-thread timeout to force stop this kind of endless proc map processing. PERF_RECORD_MISC_PROC_MAP_PARSE_TIME_OUT is introduced to indicate that the mmap record are truncated by time out. User will get warning notification when truncated mmap records are detected. Reported-by: Ying Huang <ying.huang@intel.com> Signed-off-by: Kan Liang <kan.liang@intel.com> Cc: Andi Kleen <andi@firstfloor.org> Cc: David Ahern <dsahern@gmail.com> Cc: Ying Huang <ying.huang@intel.com> Link: http://lkml.kernel.org/r/1434549071-25611-1-git-send-email-kan.liang@intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/session.c')
-rw-r--r--tools/perf/util/session.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index c371336d1eb2..2d882fd1f1b9 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -1064,6 +1064,8 @@ static int machines__deliver_event(struct machines *machines,
1064 case PERF_RECORD_MMAP: 1064 case PERF_RECORD_MMAP:
1065 return tool->mmap(tool, event, sample, machine); 1065 return tool->mmap(tool, event, sample, machine);
1066 case PERF_RECORD_MMAP2: 1066 case PERF_RECORD_MMAP2:
1067 if (event->header.misc & PERF_RECORD_MISC_PROC_MAP_PARSE_TIMEOUT)
1068 ++evlist->stats.nr_proc_map_timeout;
1067 return tool->mmap2(tool, event, sample, machine); 1069 return tool->mmap2(tool, event, sample, machine);
1068 case PERF_RECORD_COMM: 1070 case PERF_RECORD_COMM:
1069 return tool->comm(tool, event, sample, machine); 1071 return tool->comm(tool, event, sample, machine);
@@ -1360,6 +1362,15 @@ static void perf_session__warn_about_errors(const struct perf_session *session)
1360 ui__warning("%u out of order events recorded.\n", oe->nr_unordered_events); 1362 ui__warning("%u out of order events recorded.\n", oe->nr_unordered_events);
1361 1363
1362 events_stats__auxtrace_error_warn(stats); 1364 events_stats__auxtrace_error_warn(stats);
1365
1366 if (stats->nr_proc_map_timeout != 0) {
1367 ui__warning("%d map information files for pre-existing threads were\n"
1368 "not processed, if there are samples for addresses they\n"
1369 "will not be resolved, you may find out which are these\n"
1370 "threads by running with -v and redirecting the output\n"
1371 "to a file.\n",
1372 stats->nr_proc_map_timeout);
1373 }
1363} 1374}
1364 1375
1365static int perf_session__flush_thread_stack(struct thread *thread, 1376static int perf_session__flush_thread_stack(struct thread *thread,