Re: [patch 30/63] locking/spinlock: Provide RT variant

From: Thomas Gleixner
Date: Tue Aug 03 2021 - 05:10:53 EST


On Tue, Aug 03 2021 at 14:32, Hillf Danton wrote:
> On Fri, 30 Jul 2021 15:50:37 +0200
>> + * The RT substitutions explicitly disable migration and take
>> + * rcu_read_lock() across the lock held section.
>> + */
>
> My stupid question is how it works in scenarios like spinlock chain
>
> spin_lock(&foo->lock);
> spin_lock(&bar->lock);
> do something for foo and bar;
> spin_unlock(&bar->lock);
> spin_unlock(&foo->lock);
>
> with rcu read lock held across the lock protected section because rcu
> lock has preempt disabled and that will disallow scheduling while acquiring
> the inner lock.

If CONFIG_PREEMPT_RCU=y rcu_read_lock() does not disable
preemption. This is even true for !RT kernels with CONFIG_PREEMPT=y

Thanks,

tglx