perf tools: Fixup mmap event consumption
authorZhouyi Zhou <zhouzhouyi@gmail.com>
Thu, 24 Oct 2013 07:43:33 +0000 (15:43 +0800)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 28 Oct 2013 19:06:00 +0000 (16:06 -0300)
commit8e50d384cc1d5afd2989cf0f7093756ed7164eb2
tree87e34b49783a32d8552eaad510d0b5fba94ee08e
parentae779a630977d93fbebfa06216ea47df5b5c62c8
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>
14 files changed:
tools/perf/builtin-kvm.c
tools/perf/builtin-top.c
tools/perf/builtin-trace.c
tools/perf/tests/code-reading.c
tools/perf/tests/keep-tracking.c
tools/perf/tests/mmap-basic.c
tools/perf/tests/open-syscall-tp-fields.c
tools/perf/tests/perf-record.c
tools/perf/tests/perf-time-to-tsc.c
tools/perf/tests/sw-clock.c
tools/perf/tests/task-exit.c
tools/perf/util/evlist.c
tools/perf/util/evlist.h
tools/perf/util/python.c