aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/perf.h
diff options
context:
space:
mode:
authorDavid Ahern <dsahern@gmail.com>2013-02-05 16:12:42 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2013-02-06 16:09:26 -0500
commit0479b8b9cf4377df5d2c81506ce93326c31eff40 (patch)
treedff61dc7107f5b6563915b02347597489687fc1c /tools/perf/perf.h
parent5936f54d6ca2857d81188dcdff8c61b8fc482f53 (diff)
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>
Diffstat (limited to 'tools/perf/perf.h')
-rw-r--r--tools/perf/perf.h26
1 files changed, 0 insertions, 26 deletions
diff --git a/tools/perf/perf.h b/tools/perf/perf.h
index 8f3bf388e414..c2206c87fc9f 100644
--- a/tools/perf/perf.h
+++ b/tools/perf/perf.h
@@ -103,32 +103,6 @@
103#include "util/types.h" 103#include "util/types.h"
104#include <stdbool.h> 104#include <stdbool.h>
105 105
106struct perf_mmap {
107 void *base;
108 int mask;
109 unsigned int prev;
110};
111
112static inline unsigned int perf_mmap__read_head(struct perf_mmap *mm)
113{
114 struct perf_event_mmap_page *pc = mm->base;
115 int head = pc->data_head;
116 rmb();
117 return head;
118}
119
120static inline void perf_mmap__write_tail(struct perf_mmap *md,
121 unsigned long tail)
122{
123 struct perf_event_mmap_page *pc = md->base;
124
125 /*
126 * ensure all reads are done before we write the tail out.
127 */
128 /* mb(); */
129 pc->data_tail = tail;
130}
131
132/* 106/*
133 * prctl(PR_TASK_PERF_EVENTS_DISABLE) will (cheaply) disable all 107 * prctl(PR_TASK_PERF_EVENTS_DISABLE) will (cheaply) disable all
134 * counters in the current task. 108 * counters in the current task.