diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2011-01-26 09:38:35 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2011-02-03 06:15:46 -0500 |
commit | 542e72fc90f5ed9eecb574f80f70868c7f296093 (patch) | |
tree | b42abb2d44ed771759eee63ce00378df02d689ca /kernel | |
parent | 9ffdc6c37df131f89d52001e0ef03091b158826f (diff) |
perf: Fix reading in perf_event_read()
It is quite possible for the event to have been disabled between
perf_event_read() sending the IPI and the CPU servicing the IPI and
calling __perf_event_read(), hence revalidate the state.
Reported-by: Stephane Eranian <eranian@google.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/perf_event.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/kernel/perf_event.c b/kernel/perf_event.c index 852ae8c66502..999835b6112b 100644 --- a/kernel/perf_event.c +++ b/kernel/perf_event.c | |||
@@ -1901,11 +1901,12 @@ static void __perf_event_read(void *info) | |||
1901 | return; | 1901 | return; |
1902 | 1902 | ||
1903 | raw_spin_lock(&ctx->lock); | 1903 | raw_spin_lock(&ctx->lock); |
1904 | update_context_time(ctx); | 1904 | if (ctx->is_active) |
1905 | update_context_time(ctx); | ||
1905 | update_event_times(event); | 1906 | update_event_times(event); |
1907 | if (event->state == PERF_EVENT_STATE_ACTIVE) | ||
1908 | event->pmu->read(event); | ||
1906 | raw_spin_unlock(&ctx->lock); | 1909 | raw_spin_unlock(&ctx->lock); |
1907 | |||
1908 | event->pmu->read(event); | ||
1909 | } | 1910 | } |
1910 | 1911 | ||
1911 | static inline u64 perf_event_count(struct perf_event *event) | 1912 | static inline u64 perf_event_count(struct perf_event *event) |