Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Linux: Kernel

[tip:perf/core] perf_events: Fix read() bogus counts when in error state

 

 

Linux kernel RSS feed   Index | Next | Previous | View Threaded


eranian at google

Nov 26, 2009, 9:51 AM

Post #1 of 1 (104 views)
Permalink
[tip:perf/core] perf_events: Fix read() bogus counts when in error state

Commit-ID: b2e74a265ded1a185f762ebaab967e9e0d008dd8
Gitweb: http://git.kernel.org/tip/b2e74a265ded1a185f762ebaab967e9e0d008dd8
Author: Stephane Eranian <eranian [at] google>
AuthorDate: Thu, 26 Nov 2009 09:24:30 -0800
Committer: Ingo Molnar <mingo [at] elte>
CommitDate: Thu, 26 Nov 2009 18:49:59 +0100

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 [at] google>
Acked-by: Peter Zijlstra <a.p.zijlstra [at] chello>
Cc: Paul Mackerras <paulus [at] samba>
Cc: perfmon2-devel [at] lists
LKML-Reference: <4b0eb9ce.0508d00a.573b.ffffeab6 [at] mx>
Signed-off-by: Ingo Molnar <mingo [at] elte>
---
kernel/perf_event.c | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index f8c7939..0b9ca2d 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)
event->group_leader->nr_siblings--;

update_event_times(event);
- event->state = PERF_EVENT_STATE_OFF;
+
+ /*
+ * If event was in error state, then keep it
+ * that way, otherwise bogus counts will be
+ * returned on read(). The only way to get out
+ * of error state is by explicit re-enabling
+ * of the event
+ */
+ if (event->state > PERF_EVENT_STATE_OFF)
+ event->state = PERF_EVENT_STATE_OFF;

/*
* If this was a group event with sibling events then
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo [at] vger
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Linux kernel RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.