Skip to content

Commit dc17a83

Browse files
lucacoelholucasdemarchi
authored andcommitted
Revert "lockdep: Enable PROVE_RAW_LOCK_NESTING with PROVE_LOCKING."
This reverts commit 560af5d. Locking in i915_pmu.c interacting with perf is completely wrong. It's using spinlock_t everywhere when it should actually use raw_spinlock_t since perf is already holding raw_spinlock in the caller. This started to be checked with commit 560af5d ("lockdep: Enable PROVE_RAW_LOCK_NESTING with PROVE_LOCKING."), but should only be a real issue when PREEMPT_RT is enabled: in that config, the spinlock_t can sleep and creates issue. Reworking the locks in i915_pmu.c is not very simple as changing locks to raw_spinlock_t cascades to too many locks, which is both a) not desired from an RT perspective and b) hard to get right as it calls into other parts of the driver that have other requirements. Example backtrace: <4> [141.043897] ============================= <4> [141.043922] [ BUG: Invalid wait context ] <4> [141.043940] 6.13.0-rc2-CI_DRM_15820-g78bd7a249aa0+ svenkatr#1 Not tainted <4> [141.043964] ----------------------------- <4> [141.043981] swapper/0/0 is trying to lock: <4> [141.044000] ffff88810861b910 (&pmu->lock){....}-{3:3}, at: i915_pmu_enable+0x48/0x3a0 [i915] <4> [141.044194] other info that might help us debug this: <4> [141.044217] context-{5:5} <4> [141.044229] 1 lock held by swapper/0/0: <4> [141.044248] #0: ffff88885f432038 (&cpuctx_lock){....}-{2:2}, at: __perf_install_in_context+0x3f/0x360 <4> [141.044297] stack backtrace: <4> [141.044312] CPU: 0 UID: 0 PID: 0 Comm: swapper/0 Not tainted 6.13.0-rc2-CI_DRM_15820-g78bd7a249aa0+ svenkatr#1 <4> [141.044353] Hardware name: Intel Corporation Meteor Lake Client Platform/MTL-P LP5x T3 RVP, BIOS MTLPFWI1.R00.3471.D91.2401310918 01/31/2024 <4> [141.044405] Call Trace: <4> [141.044419] <TASK> <4> [141.044431] dump_stack_lvl+0x91/0xf0 <4> [141.044454] dump_stack+0x10/0x20 <4> [141.044472] __lock_acquire+0x990/0x2820 <4> [141.044498] lock_acquire+0xc9/0x300 <4> [141.044518] ? i915_pmu_enable+0x48/0x3a0 [i915] <4> [141.044689] _raw_spin_lock_irqsave+0x49/0x80 <4> [141.044713] ? i915_pmu_enable+0x48/0x3a0 [i915] <4> [141.044903] i915_pmu_enable+0x48/0x3a0 [i915] <4> [141.045112] ? __lock_acquire+0x455/0x2820 <4> [141.045142] i915_pmu_event_add+0x71/0x90 [i915] More time is needed to get this fixed properly, but let's not pile regressions on top. Signed-off-by: Luca Coelho <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] [ Reword commit message, giving more detail on what the issue is ] Signed-off-by: Lucas De Marchi <[email protected]> References: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/13311 Acked-by: Rodrigo Vivi <[email protected]>
1 parent c6d73bb commit dc17a83

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

lib/Kconfig.debug

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1399,12 +1399,20 @@ config PROVE_LOCKING
13991399
config PROVE_RAW_LOCK_NESTING
14001400
bool "Enable raw_spinlock - spinlock nesting checks" if !ARCH_SUPPORTS_RT
14011401
depends on PROVE_LOCKING
1402-
default y if ARCH_SUPPORTS_RT
1402+
default n
14031403
help
14041404
Enable the raw_spinlock vs. spinlock nesting checks which ensure
14051405
that the lock nesting rules for PREEMPT_RT enabled kernels are
14061406
not violated.
14071407

1408+
NOTE: There are known nesting problems. So if you enable this
1409+
option expect lockdep splats until these problems have been fully
1410+
addressed which is work in progress. This config switch allows to
1411+
identify and analyze these problems. It will be removed and the
1412+
check permanently enabled once the main issues have been fixed.
1413+
1414+
If unsure, select N.
1415+
14081416
config LOCK_STAT
14091417
bool "Lock usage statistics"
14101418
depends on DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT

0 commit comments

Comments
 (0)