Re: [RFC PATCH RT 4/4] rcutorture: Avoid problematic critical section nesting

From: Sebastian Andrzej Siewior
Date: Fri Jun 21 2019 - 12:38:49 EST


On 2019-06-20 14:18:26 [-0700], Paul E. McKenney wrote:
> > Example #1:
> >
> > 1. preempt_disable()
> > 2. local_bh_disable()
> > 3. preempt_enable()
> > 4. local_bh_enable()
> >
> > Example #2:
> >
> > 1. rcu_read_lock()
> > 2. local_irq_disable()
> > 3. rcu_read_unlock()
> > 4. local_irq_enable()
> >
> > Example #3:
> >
> > 1. preempt_disable()
> > 2. local_irq_disable()
> > 3. preempt_enable()
> > 4. local_irq_enable()
>
> OK for -rt, but as long as people can code those sequences without getting
> their wrists slapped, RCU needs to deal with it. So I cannot accept
> this in mainline at the current time. Yes, I will know when it is safe
> to accept it when rcutorture's virtual wrist gets slapped in mainline.

All three examples are not symmetrical so if people use this mainline
then they should get their wrists slapped. Since RT trips over each one
of those I try to get rid of them if I notice something like that.

In example #3 you would lose a scheduling event if TIF_NEED_RESCHED gets
set between step 1 and 2 (as local schedule requirement) because the
preempt_enable() would trigger schedule() which does not happen due to
IRQ-off.

Sebastian