Re: [PATCH] locking: Revert switching guards to _irq_{disable,enable}()
From: Thomas Gleixner
Date: Fri Sep 04 2026 - 10:19:52 EST
On Tue, Sep 01 2026 at 08:13, Boqun Feng wrote:
> On Tue, Sep 01, 2026 at 03:43:47PM +0200, Thomas Gleixner wrote:
> static __always_inline void raw_local_irq_disable(void)
> {
> + /*
> + * Assuming local_irq_{en,dis}able() always paired, then
> + * local_irq_disable() should not be used inside an
> + * local_interrupt_disable() critical section. Because the paired
> + * local_irq_enable() would enable the interrupt inside a
> + * local_interrupt_disable() critical section.
> + */
> + debug_assert(!(preempt_count() & HARDIRQ_DISABLE_MASK));
> arch_local_irq_disable();
The problem with pure debug_assert()s is that the damage is already
done. I learned that the hard way when I was chasing the last issue in
the #UD handler of x86 that this starts to recurse up to the point where
the system falls apart.
The modified version of this debug stuff in my devel branch does actual
fixups to prevent the subsequent damage. It's a hack and I did not come
around yet to make it actually less horrible.