summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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)
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