Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 542e72fc authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Ingo Molnar
Browse files

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: default avatarStephane Eranian <eranian@google.com>
Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 9ffdc6c3
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -1901,11 +1901,12 @@ static void __perf_event_read(void *info)
		return;

	raw_spin_lock(&ctx->lock);
	if (ctx->is_active)
		update_context_time(ctx);
	update_event_times(event);
	raw_spin_unlock(&ctx->lock);

	if (event->state == PERF_EVENT_STATE_ACTIVE)
		event->pmu->read(event);
	raw_spin_unlock(&ctx->lock);
}

static inline u64 perf_event_count(struct perf_event *event)