Skip to contentSkip to conversation

x86,spinlock: make disabling virt_spin_lock_key contingent on CONFIG_PARAVIRT

PATCH In review Rik van Riel 2 participants 2 messages Jul 15, 2024 – Jul 16, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86,spinlock: make disabling virt_spin_lock_key contingent on CONFIG_PARAVIRT

The existence of virt_spin_lock_key is contingent only on CONFIG_PARAVIRT, not on CONFIG_PARAVIRT_SPINLOCKS.

As a result, a kernel with CONFIG_PARAVIRT enabled, but CONFIG_PARAVIRT_SPINLOCKS disabled will end up disabling queued spinlocks when running on bare metal.

Making the disabling of virt_spin_lock_key contingent on CONFIG_PARAVIRT, which controls whether the key exists, results in queued spinlocks being enabled on bare metal again.

Fixes ce0a1b608bfc ("x86/paravirt: Silence unused native_pv_lock_init() function warning")
---
 arch/x86/kernel/paravirt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/paravirt.c +1 -1
index 5358d43886ad..dd542a9c6667 100644
@@ -55,7 +55,7 @@ DEFINE_STATIC_KEY_TRUE(virt_spin_lock_key);
 
 void __init native_pv_lock_init(void)
 {
-	if (IS_ENABLED(CONFIG_PARAVIRT_SPINLOCKS) &&
+	if (IS_ENABLED(CONFIG_PARAVIRT) &&
 	    !boot_cpu_has(X86_FEATURE_HYPERVISOR))
 		static_branch_disable(&virt_spin_lock_key);
 }
Signature · 1 line
2.45.2
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 6 lines · Rik van Riel

The existence of virt_spin_lock_key is contingent only on CONFIG_PARAVIRT, not on CONFIG_PARAVIRT_SPINLOCKS.

As a result, a kernel with CONFIG_PARAVIRT enabled, but CONFIG_PARAVIRT_SPINLOCKS disabled will end up disabling queued spinlocks when running on bare metal.

Quoted 7 lines

Making the disabling of virt_spin_lock_key contingent on CONFIG_PARAVIRT, which controls whether the key exists, results in queued spinlocks being enabled on bare metal again.

Fixes ce0a1b608bfc ("x86/paravirt: Silence unused native_pv_lock_init() function warning")

Juergen