Skip to content

Commit 5fa7c8e

Browse files
Peter ZijlstraIngo Molnar
authored andcommitted
perf: Remove/simplify lockdep annotation
Now that the perf_event_ctx_lock_nested() call has moved from put_event() into perf_event_release_kernel() the first reason is no longer valid as that can no longer happen. The second reason seems to have been invalidated when Al Viro made fput() unconditionally async in the following commit: 4a9d4b0 ("switch fput to task_work_add") such that munmap()->fput()->release()->perf_release() would no longer happen. Therefore, remove the annotation. This should increase the efficiency of lockdep coverage of perf locking. Suggested-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: David Ahern <dsahern@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Vince Weaver <vincent.weaver@maine.edu> Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent c6e5b73 commit 5fa7c8e

File tree

1 file changed

+1
-21
lines changed

1 file changed

+1
-21
lines changed

kernel/events/core.c

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3758,19 +3758,7 @@ int perf_event_release_kernel(struct perf_event *event)
37583758
if (!is_kernel_event(event))
37593759
perf_remove_from_owner(event);
37603760

3761-
/*
3762-
* There are two ways this annotation is useful:
3763-
*
3764-
* 1) there is a lock recursion from perf_event_exit_task
3765-
* see the comment there.
3766-
*
3767-
* 2) there is a lock-inversion with mmap_sem through
3768-
* perf_read_group(), which takes faults while
3769-
* holding ctx->mutex, however this is called after
3770-
* the last filedesc died, so there is no possibility
3771-
* to trigger the AB-BA case.
3772-
*/
3773-
ctx = perf_event_ctx_lock_nested(event, SINGLE_DEPTH_NESTING);
3761+
ctx = perf_event_ctx_lock(event);
37743762
WARN_ON_ONCE(ctx->parent_ctx);
37753763
perf_remove_from_context(event, DETACH_GROUP | DETACH_STATE);
37763764
perf_event_ctx_unlock(event, ctx);
@@ -8759,14 +8747,6 @@ static void perf_event_exit_task_context(struct task_struct *child, int ctxn)
87598747
* perf_event_create_kernel_count() which does find_get_context()
87608748
* without ctx::mutex (it cannot because of the move_group double mutex
87618749
* lock thing). See the comments in perf_install_in_context().
8762-
*
8763-
* We can recurse on the same lock type through:
8764-
*
8765-
* perf_event_exit_event()
8766-
* put_event()
8767-
* mutex_lock(&ctx->mutex)
8768-
*
8769-
* But since its the parent context it won't be the same instance.
87708750
*/
87718751
mutex_lock(&child_ctx->mutex);
87728752

0 commit comments

Comments
 (0)