Re: [PATCH -v2] x86/split_lock: Restructure the unwieldy switch-case in sld_state_show()
From: Luck, Tony
Date: Thu Feb 26 2026 - 16:02:11 EST
On Thu, Feb 26, 2026 at 03:50:33PM +0100, Borislav Petkov wrote:
Only need the cpuhp_setup_state() for the sld_state == sld_warn case.
> + if (boot_cpu_has(X86_FEATURE_SPLIT_LOCK_DETECT)) {
> + pr_info("#AC: crashing the kernel on kernel split_locks and %s on user-space split_locks\n", action);
> +
if (sld_state == sld_warn) {
> + /*
> + * This is handling the case where a CPU goes offline at the
> + * moment where split lock detection is disabled in the warn
> + * setting, see split_lock_warn(). It doesn't have any effect
> + * in the fatal case.
> + */
> + if (cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "x86/splitlock", NULL, splitlock_cpu_offline) < 0)
> + pr_warn("No splitlock CPU offline handler\n");
}
> +
> + } else if (boot_cpu_has(X86_FEATURE_BUS_LOCK_DETECT)) {
> + pr_info("#DB: %s on user-space bus_locks\n", action);
> }
> }
-Tony