From owner-svn-src-all@FreeBSD.ORG Thu May 24 21:13:58 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 33521106564A; Thu, 24 May 2012 21:13:58 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from argol.doit.wisc.edu (argol.doit.wisc.edu [144.92.197.212]) by mx1.freebsd.org (Postfix) with ESMTP id F3F4F8FC14; Thu, 24 May 2012 21:13:57 +0000 (UTC) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; CHARSET=US-ASCII; format=flowed Received: from avs-daemon.smtpauth3.wiscmail.wisc.edu by smtpauth3.wiscmail.wisc.edu (Sun Java(tm) System Messaging Server 7u2-7.05 32bit (built Jul 30 2009)) id <0M4J00500PN87P00@smtpauth3.wiscmail.wisc.edu>; Thu, 24 May 2012 16:13:57 -0500 (CDT) Received: from wanderer.tachypleus.net (i3-user-nat.icecube.wisc.edu [128.104.255.12]) by smtpauth3.wiscmail.wisc.edu (Sun Java(tm) System Messaging Server 7u2-7.05 32bit (built Jul 30 2009)) with ESMTPSA id <0M4J00GRIPN7QS30@smtpauth3.wiscmail.wisc.edu>; Thu, 24 May 2012 16:13:56 -0500 (CDT) Date: Thu, 24 May 2012 16:13:55 -0500 From: Nathan Whitehorn In-reply-to: <201205242045.q4OKjipb059398@svn.freebsd.org> To: Marcel Moolenaar Message-id: <4FBEA493.4020702@freebsd.org> X-Spam-Report: AuthenticatedSender=yes, SenderIP=128.104.255.12 X-Spam-PmxInfo: Server=avs-14, Version=5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2012.5.24.210315, SenderIP=128.104.255.12 References: <201205242045.q4OKjipb059398@svn.freebsd.org> User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:12.0) Gecko/20120502 Thunderbird/12.0 Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r235931 - head/sys/powerpc/include X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 May 2012 21:13:58 -0000 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