Thread (4 messages) flat view 4 messages, 2 authors, 2007-08-22

Re: [PATCH] powerpc: Fix race in the pasemi timebase calibration

From: Paul Mackerras <hidden>
Date: 2007-08-22 01:27:33

Olof Johansson writes:
Make sure the new timebase value is available by the time take_timebase
completes. Otherwise take_timebase might race with give_timebase,
causing severe badness when the value later is modified (think looong
hang trying to catch up with a very large number of lost ticks).
OK.
quoted hunk ↗ jump to hunk
@@ -61,6 +62,7 @@ static void __devinit pas_give_timebase(
 	mtspr(SPRN_TBCTL, TBCTL_UPDATE_LOWER | (tb & 0xffffffff));
 	mtspr(SPRN_TBCTL, TBCTL_UPDATE_UPPER | (tb >> 32));
 	mtspr(SPRN_TBCTL, TBCTL_RESTART);
+	timebase_avail = 1;
No memory barrier before setting timebase_avail?  Shouldn't there be
one?

Actually I don't understand that code at all.  Your give_timebase
seems to freeze the timebase, read it, set it to the same value and
restart, all without synchronizing with the other cpu, and your
take_timebase does nothing except print the timebase.  How does that
work?

Regards,
Paul.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help