summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2016-01-14 10:51:03 +0100
committerIngo Molnar <mingo@kernel.org>2016-01-21 18:54:25 +0100
commitc97f473643a9d3e618c0f0426b926bc3a3e23944 (patch)
treea3f1d2dd5876d3f05f03f92c99c993035049a043 /kernel
parentperf: Collapse and fix event_function_call() users (diff)
downloadlinux-c97f473643a9d3e618c0f0426b926bc3a3e23944.tar.xz
linux-c97f473643a9d3e618c0f0426b926bc3a3e23944.zip
perf: Add more assertions
Try to trigger warnings before races do damage. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: David Ahern <dsahern@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Vince Weaver <vincent.weaver@maine.edu> Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/events/core.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 6620432491f6..3eaf91b104e9 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -263,6 +263,15 @@ static void event_function_call(struct perf_event *event, event_f func, void *da
.data = data,
};
+ if (!event->parent) {
+ /*
+ * If this is a !child event, we must hold ctx::mutex to
+ * stabilize the the event->ctx relation. See
+ * perf_event_ctx_lock().
+ */
+ lockdep_assert_held(&ctx->mutex);
+ }
+
if (!task) {
cpu_function_call(event->cpu, event_function, &efs);
return;