[PATCH 1/2] x86/split_lock: Fix handling in split_lock_init()

From: Xiaoyao Li
Date: Thu Dec 18 2025 - 03:14:01 EST


Per commit 009bce1df0bb ("x86/split_lock: Don't write MSR_TEST_CTRL on
CPUs that aren't whitelisted"), cpu_model_supports_sld was introduced to
guard writes on MSR_TEST_CTRL in split_lock_init(). However, the
sld_ratelimit case handling added later was not covered by the
cpu_model_supports_sld check.

Fix this by checking cpu_model_supports_sld at the beginning of
split_lock_init().

Fixes: ef4ae6e44131 ("x86/bus_lock: Set rate limit for bus lock")
Signed-off-by: Xiaoyao Li <xiaoyao.li@xxxxxxxxx>
---
arch/x86/kernel/cpu/bus_lock.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/cpu/bus_lock.c b/arch/x86/kernel/cpu/bus_lock.c
index dbc99a47be45..28bf208b92cb 100644
--- a/arch/x86/kernel/cpu/bus_lock.c
+++ b/arch/x86/kernel/cpu/bus_lock.c
@@ -169,6 +169,9 @@ static void sld_update_msr(bool on)

void split_lock_init(void)
{
+ if (!cpu_model_supports_sld)
+ return;
+
/*
* #DB for bus lock handles ratelimit and #AC for split lock is
* disabled.
@@ -178,8 +181,7 @@ void split_lock_init(void)
return;
}

- if (cpu_model_supports_sld)
- split_lock_verify_msr(sld_state != sld_off);
+ split_lock_verify_msr(sld_state != sld_off);
}

static void __split_lock_reenable_unlock(struct work_struct *work)
--
2.43.0