svn commit: r235931 - head/sys/powerpc/include
Nathan Whitehorn
nwhitehorn at freebsd.org
Thu May 24 21:13:58 UTC 2012
On 05/24/12 15:45, Marcel Moolenaar wrote:
> Author: marcel
> Date: Thu May 24 20:45:44 2012
> New Revision: 235931
> URL: http://svn.freebsd.org/changeset/base/235931
>
> Log:
> Fix the memory barriers for CPUs that do not like lwsync and wedge or cause
> exceptions early enough during boot that the kernel will do ithe same.
> Use lwsync only when compiling for LP64 and revert to the more proven isync
> when compiling for ILP32. Note that in the end (i.e. between revision 222198
> and this change) ILP32 changed from using sync to using isync. As per Nathan
> the isync is needed to make sure I/O accesses are properly serialized with
> locks and isync tends to be more effecient than sync.
>
This badly breaks the synchronization primitives. The functions
mb()/wmb()/rmb() need to be sync or lwsync on ILP32, not isync. As the
comment notes, isync only provides a barrier in conjunction with the
atomic operations and atomic retry loop -- this is why there is a
distinction between *mb() and __ATOMIC_*(). Moreover, __ATOMIC_ACQ()
*must* be isync, not lwsync, on PPC64 without changes to the bus_space
accessors. Using lwsync causes bus space operations to leak across mutex
acquisition which causes the expected severe problems on at least my
machine.
Summary:
1. *mb() must be lwsync or sync on all machines, except for wmb() which
could be eieio
2. __ATOMIC_ACQ() must be isync (though could be reduced to lwsync with
bus_space changes)
3. __ATOMIC_REL() must be lwsync or sync
-Nathan
More information about the svn-src-head
mailing list