diff options
author | Zhouyi Zhou <zhouzhouyi@gmail.com> | 2013-10-24 15:43:33 +0800 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-10-28 16:06:00 -0300 |
commit | 8e50d384cc1d5afd2989cf0f7093756ed7164eb2 (patch) | |
tree | 87e34b49783a32d8552eaad510d0b5fba94ee08e /tools/perf/tests/code-reading.c | |
parent | ae779a630977d93fbebfa06216ea47df5b5c62c8 (diff) | |
download | kernel_goldelico_gta04-8e50d384cc1d5afd2989cf0f7093756ed7164eb2.zip kernel_goldelico_gta04-8e50d384cc1d5afd2989cf0f7093756ed7164eb2.tar.gz kernel_goldelico_gta04-8e50d384cc1d5afd2989cf0f7093756ed7164eb2.tar.bz2 |
perf tools: Fixup mmap event consumption
The tail position of the event buffer should only be modified after
actually use that event.
If not the event buffer could be invalid before use, and segment fault
occurs when invoking perf top -G.
Signed-off-by: Zhouyi Zhou <yizhouzhou@ict.ac.cn>
Cc: David Ahern <dsahern@gmail.com>
Cc: Zhouyi Zhou <yizhouzhou@ict.ac.cn>
Link: http://lkml.kernel.org/r/1382600613-32177-1-git-send-email-zhouzhouyi@gmail.com
[ Simplified the logic using exit gotos and renamed write_tail method to mmap_consume ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/tests/code-reading.c')
-rw-r--r-- | tools/perf/tests/code-reading.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c index 6fb781d..e3fedfa 100644 --- a/tools/perf/tests/code-reading.c +++ b/tools/perf/tests/code-reading.c @@ -290,6 +290,7 @@ static int process_events(struct machine *machine, struct perf_evlist *evlist, for (i = 0; i < evlist->nr_mmaps; i++) { while ((event = perf_evlist__mmap_read(evlist, i)) != NULL) { ret = process_event(machine, evlist, event, state); + perf_evlist__mmap_consume(evlist, i); if (ret < 0) return ret; } |