> diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
> index 241277cd34cf..9d6012ac929d 100644
> --- a/include/linux/spinlock.h
> +++ b/include/linux/spinlock.h
[ ... ]
> @@ -427,6 +444,11 @@ static __always_inline bool
> _spin_trylock_irqsave(spinlock_t *lock, unsigned lon
> }
> #define spin_trylock_irqsave(lock, flags) _spin_trylock_irqsave(lock,
> &(flags))
>
> +static __always_inline int spin_trylock_irq_disable(spinlock_t *lock)
> +{
> + return raw_spin_trylock_irq_disable(&lock->rlock);
> +}
> +
Should spin_trylock_irq_disable() include the sparse and clang
context-analysis annotations that all other spin_trylock_* variants
carry?
Looking at the other trylock variants in the same file:
spin_trylock():
static __always_inline int spin_trylock(spinlock_t *lock)
__cond_acquires(true, lock) __no_context_analysis
spin_trylock_bh():
static __always_inline int spin_trylock_bh(spinlock_t *lock)
__cond_acquires(true, lock) __no_context_analysis
spin_trylock_irq():
static __always_inline int spin_trylock_irq(spinlock_t *lock)
__cond_acquires(true, lock) __no_context_analysis
_spin_trylock_irqsave():
static __always_inline bool _spin_trylock_irqsave(spinlock_t *lock,
unsigned long *flags)
__cond_acquires(true, lock) __no_context_analysis
The RT counterpart in include/linux/spinlock_rt.h has the
__cond_acquires(true, lock) annotation:
static __always_inline int spin_trylock_irq_disable(spinlock_t *lock)
__cond_acquires(true, lock)
And the underlying _raw_spin_trylock_irq_disable() in spinlock_api_smp.h
also has __cond_acquires(true, lock):
static __always_inline bool _raw_spin_trylock_irq_disable(raw_spinlock_t
*lock)
__cond_acquires(true, lock)
The wrapper spin_trylock_irq_disable() in spinlock.h is the only place
where these annotations are missing. This would break sparse static
analysis and clang's thread-safety analysis for this function, causing
inconsistent static-checking behavior compared to all peer trylock APIs.
---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md
CI run summary: https://github.com/kernel-patches/bpf/actions/runs/26458754996