Skip to content

Commit c97f473

Browse files
Peter ZijlstraIngo Molnar
Peter Zijlstra
authored and
Ingo Molnar
committed
perf: Add more assertions
Try to trigger warnings before races do damage. Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Cc: Arnaldo Carvalho de Melo <[email protected]> Cc: David Ahern <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Stephane Eranian <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Vince Weaver <[email protected]> Signed-off-by: Ingo Molnar <[email protected]>
1 parent fae3fde commit c97f473

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

kernel/events/core.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,15 @@ static void event_function_call(struct perf_event *event, event_f func, void *da
263263
.data = data,
264264
};
265265

266+
if (!event->parent) {
267+
/*
268+
* If this is a !child event, we must hold ctx::mutex to
269+
* stabilize the the event->ctx relation. See
270+
* perf_event_ctx_lock().
271+
*/
272+
lockdep_assert_held(&ctx->mutex);
273+
}
274+
266275
if (!task) {
267276
cpu_function_call(event->cpu, event_function, &efs);
268277
return;

0 commit comments

Comments
 (0)