Re: [PATCH tip/core/urgent 4/7] rcu: protect __rcu_read_unlock()against scheduler-using irq handlers

From: Paul E. McKenney
Date: Wed Jul 20 2011 - 09:25:42 EST


On Wed, Jul 20, 2011 at 02:54:27PM +0200, Peter Zijlstra wrote:
> On Tue, 2011-07-19 at 17:18 -0700, Paul E. McKenney wrote:
> > @@ -391,10 +400,15 @@ void __rcu_read_unlock(void)
> > struct task_struct *t = current;
> >
> > barrier(); /* needed if we ever invoke rcu_read_unlock in rcutree.c */
> > - if (--t->rcu_read_lock_nesting == 0) {
> > - barrier(); /* decr before ->rcu_read_unlock_special load */
> > + if (t->rcu_read_lock_nesting != 1)
> > + --t->rcu_read_lock_nesting;
> > + else {
> > + t->rcu_read_lock_nesting = INT_MIN;
> > + barrier(); /* assign before ->rcu_read_unlock_special load */
> > if (unlikely(ACCESS_ONCE(t->rcu_read_unlock_special)))
> > rcu_read_unlock_special(t);
> > + barrier(); /* ->rcu_read_unlock_special load before assign */
> > + t->rcu_read_lock_nesting = 0;
> > }
> > #ifdef CONFIG_PROVE_LOCKING
> > WARN_ON_ONCE(ACCESS_ONCE(t->rcu_read_lock_nesting) < 0);
>
> But won't the above change make that WARN_ON_ONCE() invalid?

Yes, please see the patch I just sent. So that warning was spurious,
and if that was the only problem...

Thanx, Paul
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/