From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57947) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z0rVy-0001v7-2C for qemu-devel@nongnu.org; Fri, 05 Jun 2015 09:18:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z0rVt-00029h-AJ for qemu-devel@nongnu.org; Fri, 05 Jun 2015 09:18:25 -0400 Received: from mail-wi0-x22b.google.com ([2a00:1450:400c:c05::22b]:37689) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z0rVt-00029T-3D for qemu-devel@nongnu.org; Fri, 05 Jun 2015 09:18:21 -0400 Received: by wifx6 with SMTP id x6so20419820wif.0 for ; Fri, 05 Jun 2015 06:18:20 -0700 (PDT) Date: Fri, 5 Jun 2015 14:18:17 +0100 From: Stefan Hajnoczi Message-ID: <20150605131817.GA17038@stefanha-thinkpad.redhat.com> References: <1433334891-20306-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="jRHKVT23PllUwdXP" Content-Disposition: inline In-Reply-To: <1433334891-20306-1-git-send-email-pbonzini@redhat.com> Subject: Re: [Qemu-devel] [PATCH v2] atomics: add explicit compiler fence in __atomic memory barriers List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: kwolf@redhat.com, peter.maydell@linaro.org, qemu-devel@nongnu.org, uobergfe@redhat.com --jRHKVT23PllUwdXP Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jun 03, 2015 at 02:34:51PM +0200, Paolo Bonzini wrote: > __atomic_thread_fence does not include a compiler barrier; in the > C++11 memory model, fences take effect in combination with other > atomic operations. GCC implements this by making __atomic_load and > __atomic_store access memory as if the pointer was volatile, and > leaves no trace whatsoever of acquire and release fences in the > compiler's intermediate representation. >=20 > In QEMU, we want memory barriers to act on all memory, but at the same > time we would like to use __atomic_thread_fence for portability reasons. > Add compiler barriers manually around the __atomic_thread_fence. >=20 > Thanks to Kevin Wolf for the analysis. >=20 > Signed-off-by: Paolo Bonzini > --- > v1->v2: improved comment [Peter] > --- > include/qemu/atomic.h | 14 +++++++++++--- > 1 file changed, 11 insertions(+), 3 deletions(-) Reviewed-by: Stefan Hajnoczi --jRHKVT23PllUwdXP Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJVcaGZAAoJEJykq7OBq3PIxrwH/iOo7edbVcB2KLbS3BVeFdp9 pNp21Y6mvJzLr+d/FjPOCJS+HZH/EXulmOPKUZr/g4OMnxcL35kwGY8Q808ZqUdU Ym3WJptR7Np5JVFD9w4vHoYpMvLWzioLxC2seS+EgK4Mdjqk+OVW9OZL/x3+ZhV2 B9aS00Df/wxkYGWdIMYtkn4F4qQ2PTxFpFFGMVPOW3Gl9IwZmK9d8D3f8YCmLWQr cVCcigT7j04/vOC3in4Novj+R0f/15paHeLkVkVwmajAD1rdAw/DgLDhoC0ez6d9 n6wDK0IByzxs0mUTnIbzBgUs6LS2nIRxuUs7D9I3mrv4mycq+ZgPFUxP6oLawFw= =d1Wm -----END PGP SIGNATURE----- --jRHKVT23PllUwdXP--