summaryrefslogtreecommitdiffstats
path: root/lib/locking-selftest-mutex.h
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2018-01-09 21:23:02 +0100
committerIngo Molnar <mingo@kernel.org>2018-01-25 14:48:30 +0100
commit0c7296cad651a3a40286d70ff37e73bd6fa4e4da (patch)
tree8e22faa9d84a0b7e339f966bdbb58b324fc29ebf /lib/locking-selftest-mutex.h
parent43fa87f7deed52e8c8420182e0c133bc4cf395f6 (diff)
downloadlinux-0c7296cad651a3a40286d70ff37e73bd6fa4e4da.tar.gz
linux-0c7296cad651a3a40286d70ff37e73bd6fa4e4da.tar.bz2
linux-0c7296cad651a3a40286d70ff37e73bd6fa4e4da.zip
perf/core: Fix ctx::mutex deadlock
Lockdep noticed the following 3-way lockup scenario: sys_perf_event_open() perf_event_alloc() perf_try_init_event() #0 ctx = perf_event_ctx_lock_nested(1) perf_swevent_init() swevent_hlist_get() #1 mutex_lock(&pmus_lock) perf_event_init_cpu() #1 mutex_lock(&pmus_lock) #2 mutex_lock(&ctx->mutex) sys_perf_event_open() mutex_lock_double() #2 mutex_lock() #0 mutex_lock_nested() And while we need that perf_event_ctx_lock_nested() for HW PMUs such that they can iterate the sibling list, trying to match it to the available counters, the software PMUs need do no such thing. Exclude them. In particular the swevent triggers the above invertion, while the tpevent PMU triggers a more elaborate one through their event_mutex. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Linus Torvalds <torvalds@linux-foundation.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> Cc: linux-kernel@vger.kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'lib/locking-selftest-mutex.h')
0 files changed, 0 insertions, 0 deletions