Re: [PATCH, RFC] v7 scalable classic RCU implementation

From: Paul E. McKenney
Date: Mon Dec 08 2008 - 13:42:37 EST


On Fri, Oct 17, 2008 at 02:04:52PM +0530, Gautham R Shenoy wrote:
> On Fri, Oct 10, 2008 at 09:09:30AM -0700, Paul E. McKenney wrote:
> > +static void __cpuinit rcu_online_cpu(int cpu)
> > +{
> > +#ifdef CONFIG_NO_HZ
> > + struct rcu_dynticks *rdtp = &per_cpu(rcu_dynticks, cpu);
> > +
> > + rdtp->dynticks_nesting = 1;
> > + rdtp->dynticks |= 1; /* need consecutive #s even for hotplug. */
> > + rdtp->dynticks_nmi = (rdtp->dynticks + 1) & ~0x1;
>
> => rdtp->dynticks is odd. Hence rdtp->dynticks + 1 should be even.
> Why is the additional & ~0x1 ?

Because this line should instead be:

rdtp->dynticks_nmi = (rdtp->dynticks_nmi + 1) & ~0x1;

Well spotted, even if it did take me a good long time to figure out
that this really was a bug in my code! ;-)

That said, you would have to really work to exercise this one... Near as
I can tell, you would need to wrap the ->dynticks counter, which would
then cause the dynticks_nmi counter to appear to go backwards. And then
you would have to prevent the newly onlined CPU from ever passing through
a quiescent state, which would cause a failure in any case.

Still, good to fix, even if I can't figure out how it would result in
a failure. Real hardware and software tends to be -much- better than me
at finding such failures!

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/