Re: [PATCH RT 1/4] rcu: Acquire RCU lock when disabling BHs

From: Scott Wood
Date: Thu Jun 20 2019 - 17:06:55 EST


On Thu, 2019-06-20 at 13:53 -0700, Paul E. McKenney wrote:
> On Tue, Jun 18, 2019 at 08:19:05PM -0500, Scott Wood wrote:
> > diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
> > index fb267bc04fdf..aca4e5e25ace 100644
> > --- a/include/linux/rcupdate.h
> > +++ b/include/linux/rcupdate.h
> > @@ -637,10 +637,12 @@ static inline void rcu_read_unlock(void)
> > static inline void rcu_read_lock_bh(void)
> > {
> > local_bh_disable();
> > +#ifndef CONFIG_PREEMPT_RT_FULL
>
> How about this instead?
>
> if (IS_ENABLED(CONFIG_PREEMPT_RT_FULL))
> return;

OK.

> > @@ -189,8 +193,10 @@ void __local_bh_enable_ip(unsigned long ip,
> > unsigned int cnt)
> > WARN_ON_ONCE(count < 0);
> > local_irq_enable();
> >
> > - if (!in_atomic())
> > + if (!in_atomic()) {
> > + rcu_read_unlock();
> > local_unlock(bh_lock);
> > + }
> >
> > preempt_check_resched();
> > }
>
> And I have to ask...
>
> What did you do to test this change to kernel/softirq.c? My past attempts
> to do this sort of thing have always run afoul of open-coded BH
> transitions.

Mostly rcutorture and loads such as kernel builds, on a debug kernel. By
"open-coded BH transition" do you mean directly manipulating the preempt
count? That would already be broken on RT.

-Scott