remarkable-linux/tools/perf
David Ahern 0479b8b9cf perf evlist: Make event_copy local to mmaps
I am getting segfaults *after* the time sorting of perf samples where
the event type is off the charts:

(gdb) bt
\#0  0x0807b1b2 in hists__inc_nr_events (hists=0x80a99c4, type=1163281902) at util/hist.c:1225
\#1  0x08070795 in perf_session_deliver_event (session=0x80a9b90, event=0xf7a6aff8, sample=0xffffc318, tool=0xffffc520,
    file_offset=0) at util/session.c:884
\#2  0x0806f9b9 in flush_sample_queue (s=0x80a9b90, tool=0xffffc520) at util/session.c:555
\#3  0x0806fc53 in process_finished_round (tool=0xffffc520, event=0x0, session=0x80a9b90) at util/session.c:645

This is bizarre because the event has already been processed once --
before it was added to the samples queue -- and the event was found to
be sane at that time.

There seem to be 2 causes:

1. perf_evlist__mmap_read updates the read location even though there
are outstanding references to events sitting in the mmap buffers via the
ordered samples queue.

2. There is a single evlist->event_copy for all evlist entries.
event_copy is used to handle an event wrapping at the mmap buffer
boundary.

This patch addresses the second problem - making event_copy local to
each perf_mmap. With this change my highly repeatable use case no longer
fails.

The first problem is much more complicated and will be the subject of a
future patch.

Signed-off-by: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1360098762-61827-1-git-send-email-dsahern@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2013-02-06 18:09:26 -03:00
..
arch perf tools: Fix possible double free on error 2013-01-30 10:37:41 -03:00
bench perf: Add 'perf bench numa mem' NUMA performance measurement suite 2013-01-30 10:35:36 -03:00
config perf tools: Make numa benchmark optional 2013-01-30 10:36:21 -03:00
Documentation perf evlist: Add --group option 2013-01-31 13:07:49 -03:00
python perf python: Use attr.watermark in twatch.py 2012-01-30 18:38:23 -02:00
scripts perf script: Remove workqueue-stats script 2013-01-24 16:40:53 -03:00
tests perf sort: Make setup_sorting returns an error code 2013-02-06 18:09:26 -03:00
ui perf hists browser: Add option for runtime switching perf data file 2013-02-06 18:09:24 -03:00
util perf evlist: Make event_copy local to mmaps 2013-02-06 18:09:26 -03:00
.gitignore perf tools: Ignore compiled python binaries 2012-09-07 12:10:58 -03:00
bash_completion perf tools: Complete tracepoint event names 2012-10-04 12:44:52 -03:00
builtin-annotate.c perf sort: Make setup_sorting returns an error code 2013-02-06 18:09:26 -03:00
builtin-bench.c perf tools: Make numa benchmark optional 2013-01-30 10:36:21 -03:00
builtin-buildid-cache.c perf buildid-cache: Add option to show build ids that are missing in the cache 2012-12-09 08:46:08 -03:00
builtin-buildid-list.c perf symbols: Generalize filter in __fprintf_buildid methods 2012-12-09 08:46:07 -03:00
builtin-diff.c perf sort: Make setup_sorting returns an error code 2013-02-06 18:09:26 -03:00
builtin-evlist.c perf evlist: Add --group option 2013-01-31 13:07:49 -03:00
builtin-help.c perf help: Fix --help for builtins 2012-10-22 12:35:49 -02:00
builtin-inject.c perf inject: Mark a dso if it's used 2012-10-26 11:22:25 -02:00
builtin-kmem.c perf kmem: Use memdup() 2013-01-25 12:49:28 -03:00
builtin-kvm.c perf kvm: Initialize file_name var to fix segfault 2013-01-24 16:40:13 -03:00
builtin-list.c perf tools: Use __maybe_used for unused variables 2012-09-11 12:19:15 -03:00
builtin-lock.c perf tools: Add a global variable "const char *input_name" 2012-10-29 11:45:34 -02:00
builtin-probe.c perf probe: Don't use globals where not needed to 2012-10-02 18:36:37 -03:00
builtin-record.c perf header: Add HEADER_GROUP_DESC feature 2013-01-31 13:07:44 -03:00
builtin-report.c perf sort: Make setup_sorting returns an error code 2013-02-06 18:09:26 -03:00
builtin-sched.c perf session: There is no need for a per session hists instance 2013-01-24 16:40:12 -03:00
builtin-script.c perf script: Don't display trace info when invoking scripts 2013-01-24 16:40:52 -03:00
builtin-stat.c perf evsel: Fix memory leaks on evsel->counts 2013-01-30 10:37:04 -03:00
builtin-timechart.c perf tools: Add a global variable "const char *input_name" 2012-10-29 11:45:34 -02:00
builtin-top.c perf sort: Make setup_sorting returns an error code 2013-02-06 18:09:26 -03:00
builtin-trace.c perf evlist: Set the leader in the perf_evlist__config method 2012-12-11 17:19:01 -03:00
builtin.h perf trace: New tool 2012-09-26 20:42:23 -03:00
command-list.txt perf trace: New tool 2012-09-26 20:42:23 -03:00
CREDITS perf_counter tools: Add CREDITS file for Git contributors 2009-06-24 19:54:29 +02:00
design.txt perf tools: Update ioctl documentation for PERF_IOC_FLAG_GROUP 2012-05-31 11:38:42 -03:00
Makefile perf tools: Check for flex and bison before continuing building 2013-02-06 18:09:25 -03:00
MANIFEST perf tools: Fix building from 'make perf-*-src-pkg' tarballs 2013-01-10 16:03:26 -03:00
perf-archive.sh perf archive: Make 'f' the last parameter for tar 2012-09-17 13:10:42 -03:00
perf.c perf tools: Remove some needless die() calls from the main routine 2013-01-24 16:40:52 -03:00
perf.h perf evlist: Make event_copy local to mmaps 2013-02-06 18:09:26 -03:00