aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/perf_event.c
diff options
context:
space:
mode:
authorStephane Eranian <eranian@google.com>2009-11-26 12:24:30 -0500
committerIngo Molnar <mingo@elte.hu>2009-11-26 12:49:59 -0500
commitb2e74a265ded1a185f762ebaab967e9e0d008dd8 (patch)
treebdfefc2d8376bde15f1defab28201c341c9d6e0c /kernel/perf_event.c
parent4d795fb17a02a87e35782773b88b7a63acfbeaae (diff)
perf_events: Fix read() bogus counts when in error state
When a pinned group cannot be scheduled it goes into error state. Normally a group cannot go out of error state without being explicitly re-enabled or disabled. There was a bug in per-thread mode, whereby upon termination of the thread, the group would transition from error to off leading to bogus counts and timing information returned by read(). Fix it by clearing the error state. Signed-off-by: Stephane Eranian <eranian@google.com> Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Paul Mackerras <paulus@samba.org> Cc: perfmon2-devel@lists.sourceforge.net LKML-Reference: <4b0eb9ce.0508d00a.573b.ffffeab6@mx.google.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/perf_event.c')
-rw-r--r--kernel/perf_event.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index f8c7939c57cf..0b9ca2d834dd 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -338,7 +338,16 @@ list_del_event(struct perf_event *event, struct perf_event_context *ctx)
338 event->group_leader->nr_siblings--; 338 event->group_leader->nr_siblings--;
339 339
340 update_event_times(event); 340 update_event_times(event);
341 event->state = PERF_EVENT_STATE_OFF; 341
342 /*
343 * If event was in error state, then keep it
344 * that way, otherwise bogus counts will be
345 * returned on read(). The only way to get out
346 * of error state is by explicit re-enabling
347 * of the event
348 */
349 if (event->state > PERF_EVENT_STATE_OFF)
350 event->state = PERF_EVENT_STATE_OFF;
342 351
343 /* 352 /*
344 * If this was a group event with sibling events then 353 * If this was a group event with sibling events then