Re: [PATCH V4 1/2] perf,tools: add time out to force stop proc map processing
From: Arnaldo Carvalho de Melo
Date: Fri Jun 19 2015 - 17:41:57 EST
Em Wed, Jun 17, 2015 at 09:51:10AM -0400, kan.liang@xxxxxxxxx escreveu:
> From: Kan Liang <kan.liang@xxxxxxxxx>
> 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.
I am applying the patch, we indeed need to keep it in the
last PERF_RECORD_MMAP2 we synthesized for a proc mmap file, i.e. it
has to be stored in the perf.data file, so that later, at 'report' time,
possibly in another machine, that situation can be reported to the user.
But, the warning is only being showm for tools that process events via
perf_session__process_events(), like 'perf report'.
'top' and 'trace', for instance, don't do that, so the users will not
be warned in that case.
To fix this we need to make machine__process_mmap2_event() notice that
PERF_RECORD_MISC_PROC_MAP_PARSE_TIME_OUT is set, and bump a per-struct
machine counter, something like machine->stats.nr_truncated_mmaps.
The callchain is:
builtin-top.c
machine__synthesize_threads()
__machine__synthesize_threads()
perf_event__process()
machine__process_event()
machine__process_mmap2_event()
At some point even a event_stats may make sense to be added to struct
machine :-)
- Arnaldo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at http://www.tux.org/lkml/