From: Peter Zijlstra Date: Wed, 10 Jun 2009 20:53:37 +0000 (+0200) Subject: perf_counter: Annotate exit ctx recursion X-Git-Tag: Ubuntu-5.4-5.4.0-11.14~30198^2~15 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=66fff22483d8542dfb4d61a28d21277bbde321e8;p=mirror_ubuntu-focal-kernel.git perf_counter: Annotate exit ctx recursion Ever since Paul fixed it to unclone the context before taking the ctx->lock this became a false positive, annotate it away. Signed-off-by: Peter Zijlstra Cc: Mike Galbraith Cc: Paul Mackerras Cc: Arnaldo Carvalho de Melo LKML-Reference: Signed-off-by: Ingo Molnar --- diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c index 51c571ee4d0b..ae591a1275a6 100644 --- a/kernel/perf_counter.c +++ b/kernel/perf_counter.c @@ -3879,7 +3879,18 @@ void perf_counter_exit_task(struct task_struct *child) spin_unlock(&child_ctx->lock); local_irq_restore(flags); - mutex_lock(&child_ctx->mutex); + /* + * We can recurse on the same lock type through: + * + * __perf_counter_exit_task() + * sync_child_counter() + * fput(parent_counter->filp) + * perf_release() + * mutex_lock(&ctx->mutex) + * + * But since its the parent context it won't be the same instance. + */ + mutex_lock_nested(&child_ctx->mutex, SINGLE_DEPTH_NESTING); again: list_for_each_entry_safe(child_counter, tmp, &child_ctx->counter_list,