Re: [PATCH] locking: Revert switching guards to _irq_{disable,enable}()
From: Peter Zijlstra
Date: Sat Aug 29 2026 - 04:05:28 EST
On Sat, Aug 29, 2026 at 01:11:56AM +0200, Thomas Gleixner wrote:
> diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
> index 346c438ac880..b0be24a386f3 100644
> --- a/arch/x86/kernel/process.c
> +++ b/arch/x86/kernel/process.c
> @@ -824,7 +824,7 @@ void __noreturn stop_this_cpu(void *dummy)
> struct cpuinfo_x86 *c = this_cpu_ptr(&cpu_info);
> unsigned int cpu = smp_processor_id();
>
> - local_irq_disable();
> + raw_force_local_irq_disable();
>
> /*
> * Remove this CPU from the online mask and disable it
> diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
> index 0fed6d0d7e32..40104170be24 100644
> --- a/arch/x86/kernel/reboot.c
> +++ b/arch/x86/kernel/reboot.c
> @@ -98,7 +98,7 @@ static int __init set_efi_reboot(const struct dmi_system_id *d)
>
> void __noreturn machine_real_restart(unsigned int type)
> {
> - local_irq_disable();
> + raw_force_local_irq_disable();
>
> /*
> * Write zero to CMOS register number 0x0f, which the BIOS POST
> @@ -535,7 +535,7 @@ static inline void nmi_shootdown_cpus_on_restart(void);
> #if IS_ENABLED(CONFIG_KVM_X86)
> static void emergency_reboot_disable_virtualization(void)
> {
> - local_irq_disable();
> + raw_force_local_irq_disable();
>
> /*
> * Disable virtualization on all CPUs before rebooting to avoid hanging
> @@ -699,7 +699,7 @@ void native_machine_shutdown(void)
> * not receive the per-cpu timer interrupt which may trigger
> * scheduler's load balance.
> */
> - local_irq_disable();
> + raw_force_local_irq_disable();
> stop_other_cpus();
> #endif
>
> @@ -823,7 +823,8 @@ static int crash_nmi_callback(unsigned int val, struct pt_regs *regs)
> */
> if (cpu == crashing_cpu)
> return NMI_HANDLED;
> - local_irq_disable();
> +
> + raw_force_local_irq_disable();
>
> if (shootdown_callback)
> shootdown_callback(cpu, regs);
> @@ -865,7 +866,7 @@ void nmi_shootdown_cpus(nmi_shootdown_cb callback)
> {
> unsigned long msecs;
>
> - local_irq_disable();
> + raw_force_local_irq_disable();
>
> /*
> * Avoid certain doom if a shootdown already occurred; re-registering
> diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
> index 132a9df98471..f13e88fb7a78 100644
> --- a/drivers/acpi/sleep.c
> +++ b/drivers/acpi/sleep.c
> @@ -1095,7 +1095,7 @@ static int acpi_power_off(struct sys_off_data *data)
> {
> /* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */
> pr_debug("%s called\n", __func__);
> - local_irq_disable();
> + raw_force_local_irq_disable();
> acpi_enter_sleep_state(ACPI_STATE_S5);
> return NOTIFY_DONE;
> }
> diff --git a/include/linux/irqflags.h b/include/linux/irqflags.h
> index 57b074e0cfbb..dd55786768d1 100644
> --- a/include/linux/irqflags.h
> +++ b/include/linux/irqflags.h
> +static __always_inline void raw_force_local_irq_disable(void)
> +{
> + arch_local_irq_disable();
> + __preempt_count_add(HARDIRQ_DISABLE_OFFSET);
> +}
So this thing is on all sorts of don't care, we're going down paths. It
needs to ensure IRQs really are off, and preempt_count has at least one
DISABLE_OFFSET on.
*However* if something like acpi_power_off() were to 'fail' to enter S5
and continue on with the notifier, things are now unbalanced. Probably
not a problem, since the next handler will likely do
raw_force_load_irq_disable() again.
At the least this wants a comment I suppose.
> diff --git a/init/main.c b/init/main.c
> index 2613d3f9b3ce..fa84ce260b04 100644
> --- a/init/main.c
> +++ b/init/main.c
> @@ -991,7 +991,6 @@ void start_kernel(void)
>
> cgroup_init_early();
>
> - local_irq_disable();
> early_boot_irqs_disabled = true;
If we want to preserve the paranoia of having that statement in the
first place, it could be replaced with something like:
WARN_ON_ONCE(!irqs_disabled());
I suppose (lockdep isn't available yet).