Re: [PATCH] irq: Move local_irq_enable/disable() into Rust

From: Thomas Gleixner

Date: Fri Sep 04 2026 - 17:20:54 EST


On Fri, Sep 04 2026 at 08:25, Boqun Feng wrote:
> [Cc Miguel, Lyude, Alice, Gary]
>
> On Fri, Sep 04, 2026 at 03:26:40PM +0200, Thomas Gleixner wrote:
>> After reverting the spinlock conversion and a lengthy discussion it's the
>> best to confine the reference counted interrupt disable/enable mechanism to
>> Rust which is the only user.
>>
>> This should become the new norm, but that needs more thoughts and cleaning
>> up the confined usage in Rust at some point is way simpler than chasing
>> random places which adopt it in the meanwhile.
>>
>
> Thank you for doing this! I think the subject should be:
>
> irq: Move local_interrupt_{dis,en}able() into Rust
>
> to be accurate about the name of the functions.

It actually also fails to mention the spinlock part :(

>> include/linux/spinlock.h | 23 -------
>> include/linux/spinlock_api_smp.h | 41 ------------
>> include/linux/spinlock_api_up.h | 15 ----
>> include/linux/spinlock_rt.h | 18 -----
>
> Seems we are missing a deletion of include/linux/interrupt_rc.h here.

Weird. I'm sure I deleted it, but ...

>> +static __always_inline bool _raw_spin_trylock_irq_disable(raw_spinlock_t *lock)
>> + __cond_acquires(true, lock)
>> +{
>> + local_interrupt_disable();
>> + if (_raw_spin_trylock(lock))
>> + return true;
>> + local_interrupt_enable();
>> + return false;
>> +}
>> +
>> +static inline void __raw_spin_lock_irq_disable(raw_spinlock_t *lock)
>> + __acquires(lock) __no_context_analysis
>
> I think we need to put the
>
> #if !defined(CONFIG_GENERIC_LOCKBREAK) || defined(CONFIG_DEBUG_LOCK_ALLOC)
> #endif

Duh yes. Missed that completely.

> around this. Because in the #else branch of rust/helpers/spinlock.c we
> have an out-of-line definition of the same function.

Right.

Thanks,

tglx