From owner-svn-src-projects@FreeBSD.ORG Tue Sep 18 10:22:48 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7FF971065678; Tue, 18 Sep 2012 10:22:48 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 137D28FC12; Tue, 18 Sep 2012 10:22:47 +0000 (UTC) Received: from skuns.kiev.zoral.com.ua (localhost [127.0.0.1]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id q8IAMptO092801; Tue, 18 Sep 2012 13:22:51 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5) with ESMTP id q8IAMbc9057901; Tue, 18 Sep 2012 13:22:37 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5/Submit) id q8IAMbPL057900; Tue, 18 Sep 2012 13:22:37 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 18 Sep 2012 13:22:37 +0300 From: Konstantin Belousov To: Dimitry Andric Message-ID: <20120918102237.GA37286@deviant.kiev.zoral.com.ua> References: <201207301350.q6UDobCI099069@svn.freebsd.org> <201207301732.33474.jhb@freebsd.org> <505849DB.3090704@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="yQrIXZbGokyKU1X6" Content-Disposition: inline In-Reply-To: <505849DB.3090704@FreeBSD.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.0 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: Davide Italiano , src-committers@freebsd.org, John Baldwin , Jeff Roberson , attilio@freebsd.org, svn-src-projects@freebsd.org Subject: Re: svn commit: r238907 - projects/calloutng/sys/kern X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Sep 2012 10:22:48 -0000 --yQrIXZbGokyKU1X6 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Sep 18, 2012 at 12:15:55PM +0200, Dimitry Andric wrote: > On 2012-09-18 02:13, Attilio Rao wrote: > > On Thu, Aug 2, 2012 at 9:56 PM, Attilio Rao wrote: > >> On 7/30/12, John Baldwin wrote: > ... > >> While here, did you consider also: > >> - Abstracting compiler_memory_barrier() into a MI, compiler dependent = function? > > > > So what do you think about this patch? (Please double-check the GIT log= ). > ... >=20 > > diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h > > index 8224672..fc6a75f 100644 > > --- a/sys/sys/cdefs.h > > +++ b/sys/sys/cdefs.h > > @@ -114,6 +114,13 @@ > > #endif > > > > /* > > + * Compiler memory barriers, specific to gcc and clang. > > + */ > > +#if defined(__GNUC__) > > +#define __compiler_membar() __asm __volatile(" " : : : "mem= ory") > > +#endif > > + > > +/* > > * The __CONCAT macro is used to concatenate parts of symbol names, e= =2Eg. > > * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfo= o. > > * The __CONCAT macro is a bit tricky to use if it must work in non-A= NSI >=20 > Please use gcc's __sync_synchronize() builtin[1] instead, which is > specifically for this purpose. Clang also supports it. >=20 > The builtin will emit actual memory barrier instructions, if the target > architecture supports it, otherwise it will emit the same asm statement > you show above. See contrib/gcc/builtins.c, around line 5584, function > expand_builtin_synchronize(). We do not need CPU barriers there, which are already handled by the atomic asms. It is only to prevent compiler from exploiting the reorder. >=20 > -Dimitry >=20 > [1]: --yQrIXZbGokyKU1X6 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (FreeBSD) iEYEARECAAYFAlBYS20ACgkQC3+MBN1Mb4iHmACbBBAd6zNW3q8hljmDuh3LJ5dk MHoAn0pEpqLcpmF8/Z5eUkMuvWGnbvbP =DOak -----END PGP SIGNATURE----- --yQrIXZbGokyKU1X6--