[PATCH] fix gettimeofday vs. update_gtod race

Benjamin Herrenschmidt benh at kernel.crashing.org
Tue Aug 22 07:43:10 EST 2006


On Mon, 2006-08-21 at 16:25 -0500, Nathan Lynch wrote:
> Nathan Lynch wrote:
> > Benjamin Herrenschmidt wrote:
> > > On Wed, 2006-08-16 at 19:18 -0500, Nathan Lynch wrote:
> > > 
> > > > No?  I didn't find anything about mftb having synchronizing
> > > > behavior.  How should we ensure that temp_varp is assigned before
> > > > reading the timebase?
> > > 
> > > I sync an isync would be enough.
> > 
> > I see, thanks.
> 
> Actually, after checking Book 2 and discussing with some other folks
> I'm not so sure -- isync "may complete before storage accesses
> associated with instructions preceding the isync instruction have been
> performed."

Of sure, I was thinking about isync preventing mftb from being executed
and we can have a proper data dependency. Anyway, that's not necessary,
I've looked at the code and we no longer need to pass the tb value in
(it's historical). Thus we can just move the mftb in the protected area
and maybe with a twi/isync pair make sure we got the gtod pointer before
we do the mftb

Ben.





More information about the Linuxppc-dev mailing list