On Thu, 12 Dec 2024 16:35:06 +0100 Sebastian Sewior <bigeasy@xxxxxxxxxxxxx> wrote: > If NMI is one of the possible calling contexts, yes. > > One thing I am not 100% sure about is how "good" a spinlock_t trylock is > if attempted from hardirq (on PREEMPT_RT). Obtaining the lock und > unlocking is doable. The lock part will assign the "current" task as the > task that owns the lock now. This task is just randomly on the CPU while > the hardirq triggered. The regular spin_lock() will see this random task > as the owner and might PI-boost it. This could work… Looking at the unlock code, it and the slowtrylock() appears to use raw_spin_lock_irqsave(). Hence it expects that it can be called from irq disabled context. If it can be used in interrupt disabled context, I don't see why it wouldn't work in actual interrupt context. -- Steve