Re: [patch V5 32/72] locking/rtmutex: Provide the spin/rwlock core lock function

From: Thomas Gleixner
Date: Fri Aug 27 2021 - 16:03:12 EST


On Sat, Aug 28 2021 at 01:21, Boqun Feng wrote:
> On Sun, Aug 15, 2021 at 11:28:25PM +0200, Thomas Gleixner wrote:
>> From: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
>> +static __always_inline void __sched rtlock_slowlock(struct rt_mutex_base *lock)
>> +{
>> + unsigned long flags;
>> +
>> + raw_spin_lock_irqsave(&lock->wait_lock, flags);
>> + rtlock_slowlock_locked(lock);
>> + raw_spin_unlock_irqrestore(&lock->wait_lock, flags);
>
> Just out of curiosity, could we use raw_spin_{un,}lock_irq() here
> instead of *_irq{save,restore}()? Because rtlock_slowlock() might sleep,
> and we cannot call it with irq-off.

Unfortunately we can during early boot when lock debugging is enabled
because then the fast path is disabled. We might make it conditional on
!DEBUG though, but I'm not sure whether it's worth it.

Thanks,

tglx