perf_counter: Annotate exit ctx recursion
authorPeter Zijlstra <a.p.zijlstra@chello.nl>
Wed, 10 Jun 2009 20:53:37 +0000 (22:53 +0200)
committerIngo Molnar <mingo@elte.hu>
Thu, 11 Jun 2009 00:39:01 +0000 (02:39 +0200)
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 <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
kernel/perf_counter.c

index 51c571ee4d0b1369e1030b0b1f5d91dca8140885..ae591a1275a663e0cd2b245a280ee30cb2e3d69c 100644 (file)
@@ -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,