perf: Validate locking assumption
authorPeter Zijlstra <peterz@infradead.org>
Mon, 5 May 2014 09:49:16 +0000 (11:49 +0200)
committerIngo Molnar <mingo@kernel.org>
Wed, 7 May 2014 11:44:18 +0000 (13:44 +0200)
Document and validate the locking assumption of event_sched_in().

Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Vince Weaver <vincent.weaver@maine.edu>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-sybq1publ9xt5no77cwvi0eo@git.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
kernel/events/core.c

index 819ffc006d673c60528ccf582733a49500b4a373..0de199729f04f88fbac802319e6d774055b9d80b 100644 (file)
@@ -1678,6 +1678,8 @@ event_sched_in(struct perf_event *event,
        u64 tstamp = perf_event_time(event);
        int ret = 0;
 
+       lockdep_assert_held(&ctx->lock);
+
        if (event->state <= PERF_EVENT_STATE_OFF)
                return 0;