summaryrefslogtreecommitdiff
path: root/kernel/events
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/events')
-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;