perf: Annotate perf_event_read_group() vs perf_event_release_kernel()
authorPeter Zijlstra <a.p.zijlstra@chello.nl>
Thu, 6 May 2010 13:42:53 +0000 (15:42 +0200)
committerIngo Molnar <mingo@elte.hu>
Fri, 7 May 2010 09:30:59 +0000 (11:30 +0200)
commita0507c84bf47dfd204299774f45fd16da33f0619
treed40bf7628ebb9935fb1ef6727337dcd9e2c94fd5
parentcce913178118b0b36742eb7544c2b38a0c957ee7
perf: Annotate perf_event_read_group() vs perf_event_release_kernel()

Stephane reported a lockdep warning while using PERF_FORMAT_GROUP.

The issue is that perf_event_read_group() takes faults while holding
the ctx->mutex, while perf_event_release_kernel() can be called from
munmap(). Which makes for an AB-BA deadlock.

Except we can never establish the deadlock because we'll only ever
call perf_event_release_kernel() after all file descriptors are dead
so there is no concurrency possible.

Reported-by: Stephane Eranian <eranian@google.com>
Cc: Paul Mackerras <paulus@samba.org>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
kernel/perf_event.c