2005-12-12 18:18:11

by Oleg Nesterov

[permalink] [raw]
Subject: Re: Semantics of smp_mb() [was : Re: [PATCH] Fix RCU race in access of nohz_cpu_mask ]

Srivatsa Vaddagiri wrote:
>
> Oleg, with all these inputs, I consider the patch I had sent to be correct.

Yes, I think so. My suspects were due to my misunderstanding.
I was wrong when I said that we can ignore rmb() part of mb()
in case when start_hz_timer() runs after rcu_start_batch().

rcp->cur++;
// ->cur will be visible to other cpus
// _before_ we will *READ* nohz_cpu_mask.
// we don't have any 'timing' problems.
// In other words: if another cpu does not
// see the new value - we did not read this
// mask yet.
smp_mb();

Thanks for your patience.

> P.S :- Thanks to everybody who reponded clarifying this subject.

Yes! it was really helpful, thanks to all. I think it would be great
to have Paul's very clear (and short!) explanation somewhere in
Documentation/.

Oleg.


2005-12-13 05:20:14

by Paul E. McKenney

[permalink] [raw]
Subject: Re: Semantics of smp_mb() [was : Re: [PATCH] Fix RCU race in access of nohz_cpu_mask ]

On Mon, Dec 12, 2005 at 10:33:22PM +0300, Oleg Nesterov wrote:
> Srivatsa Vaddagiri wrote:
>
> > P.S :- Thanks to everybody who reponded clarifying this subject.
>
> Yes! it was really helpful, thanks to all. I think it would be great
> to have Paul's very clear (and short!) explanation somewhere in
> Documentation/.

Glad you liked it!

I need to do an RCU documentation update soon anyway, so will include
memory barriers in that update.

Thanx, Paul