On Thu, Aug 22, 2019 at 09:39:55AM -0400, Joel Fernandes wrote: > On Wed, Aug 21, 2019 at 04:33:58PM -0700, Paul E. McKenney wrote: > > On Wed, Aug 21, 2019 at 06:19:04PM -0500, Scott Wood wrote: > > > A plain local_bh_disable() is documented as creating an RCU critical > > > section, and (at least) rcutorture expects this to be the case. However, > > > in_softirq() doesn't block a grace period on PREEMPT_RT, since RCU checks > > > preempt_count() directly. Even if RCU were changed to check > > > in_softirq(), that wouldn't allow blocked BH disablers to be boosted. > > > > > > Fix this by calling rcu_read_lock() from local_bh_disable(), and update > > > rcu_read_lock_bh_held() accordingly. > > > > Cool! Some questions and comments below. > > > > Thanx, Paul > > > > > Signed-off-by: Scott Wood <swood@xxxxxxxxxx> > > > --- > > > Another question is whether non-raw spinlocks are intended to create an > > > RCU read-side critical section due to implicit preempt disable. > > > > Hmmm... Did non-raw spinlocks act like rcu_read_lock_sched() > > and rcu_read_unlock_sched() pairs in -rt prior to the RCU flavor > > consolidation? If not, I don't see why they should do so after that > > consolidation in -rt. > > May be I am missing something, but I didn't see the connection between > consolidation and this patch. AFAICS, this patch is so that > rcu_read_lock_bh_held() works at all on -rt. Did I badly miss something? I was interpreting Scott's question (which would be excluded from the git commit log) as relating to a possible follow-on patch. The question is "how special can non-raw spinlocks be in -rt?". From what I can see, they have been treated as sleeplocks from an RCU viewpoint, so maybe that should continue to be the case. It does deserve some thought because in mainline a non-raw spinlock really would block a post-consolidation RCU grace period, even in PREEMPT kernels. But then again, you cannot preempt a non-raw spinlock in mainline but you can in -rt, so extending that exception to RCU is not unreasonable. Either way, we do need to make a definite decision and document it. If I were forced to make a decision right now, I would follow the old behavior, so that only raw spinlocks were guaranteed to block RCU grace periods. But I am not being forced, so let's actually discuss and make a conscious decision. ;-) Thanx, Paul