PPC Kernel Gurus Help?
swarthou at ibmoto.com
Tue Apr 13 06:49:20 EST 1999
> Date: Mon, 12 Apr 1999 14:48:17 +1000
> From: Paul Mackerras <paulus at cs.anu.edu.au>
> > >... Also there examples only use isync and not sync but
> > >point out that for SMP, you should use sync. They also only use sync
> > >before and after the routines and not in the middle.
> > >
> > >So are the isync and syncs needed?
> I don't understand why an isync should be needed. I believe a sync is
> only needed if you want a constraint on the order in which other CPUs
> will see the atomic operation compared to other memory references (I'm
> not dogmatic about that, I could be wrong, but that's my current
I believe this discussion comes from the example in appendix E.4 "Lock
Acquisition and Release". I think the example could use a better
wording to motivate the need for the isync. It simply makes the
statement: "The processor must not access the shared resource until it
sets the lock". A better wording: "IF the lock must prevent the
processor from accessing the shared resource until the successful lock
is acquired, a barrier needs to be created between the stwcx and the
The lock code looks like:
lock: call test_and_set until lock acquired (lwarx/stwcx loop)
Without the isync, nothing prevents the access_shared_location to
happen before the lwarx/stwcx loop returns. To prevent the access, a
dependency between the stwcx and the access must be created. Three
ways (with the isync option being the best):
1. isync - instruction-stream is blocked until successful stwcx
2. sync - memory access is blocked until successful stwcx
3. operand dependency - delay loading register containing shared address
until lock is acquired.
Only one option needs to be picked.
Somerset Design Center
[[ This message was sent via the linuxppc-dev mailing list. Replies are ]]
[[ not forced back to the list, so be sure to Cc linuxppc-dev if your ]]
[[ reply is of general interest. Please check http://lists.linuxppc.org/ ]]
[[ and http://www.linuxppc.org/ for useful information before posting. ]]
More information about the Linuxppc-dev