Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 540A41542B97 for ; Mon, 19 Dec 2011 11:27:25 -0400 (AST) Received: from [213.9.93.70] (helo=mail.piware.de) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Rcf7V-0002B0-Le for pgsql-bugs@postgresql.org; Mon, 19 Dec 2011 15:27:24 +0000 Received: from localhost.localdomain (p549B261F.dip.t-dialin.net [84.155.38.31]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "Martin Pitt (ThinkPad)", Issuer "piware CA" (verified OK)) by mail.piware.de (Postfix) with ESMTPS id 7BAE91517A62 for ; Mon, 19 Dec 2011 16:26:26 +0100 (CET) Received: by localhost.localdomain (Postfix, from userid 1000) id F214D20158; Mon, 19 Dec 2011 16:27:02 +0100 (CET) Date: Mon, 19 Dec 2011 16:27:02 +0100 From: Martin Pitt To: pgsql-bugs@postgresql.org Subject: Re: [PATCH] Use CC atomic builtins if available [was: Re: TAS patch for building on armel/armhf thumb] Message-ID: <20111219152702.GI2972@piware.de> Mail-Followup-To: pgsql-bugs@postgresql.org References: <4EEB1C77.1000309@enterprisedb.com> <20111218224203.GA2950@piware.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Host-Lookup-Failed: Reverse DNS lookup failed for 213.9.93.70 (failed) X-Pg-Spam-Score: -1.1 (-) X-Archive-Number: 201112/154 X-Sequence-Number: 31965 Robert Haas [2011-12-19 9:31 -0500]: > On Sun, Dec 18, 2011 at 5:42 PM, Martin Pitt wrote: > >> It probably makes sense to use it on any platform where it's > >> defined. Presumably an implementation provided by the compiler is > >> always going to be at least as good as any magic assembler > >> incantations we can come up with. > > > > I agree. How about a patch like this? It uses builtin atomics if > > available, and falls back to the custom implementations if not. > > -1. Absent some evidence that gcc's implementations are superior to > ours, I think we should not change stuff that works now. That's > likely to lead to subtle bugs that are hard to find and perhaps > dependent on the exact compiler version used. > > But I'm completely cool with doing this for platforms where we haven't > otherwise got an implementation. Any port in a storm. Sure, then the other option is to stuff this at the end of s_lock.h if we don't already have HAS_TEST_AND_SET. This would then mean that we need to remove the armel implementation, as it doesn't really work on anything non-ancient, and the gcc one got some fairly good test coverage by now. I'm happy to work out the patch for this. I'll just wait a bit if there are more comments on this. Thanks, Martin -- Martin Pitt | http://www.piware.de Ubuntu Developer (www.ubuntu.com) | Debian Developer (www.debian.org)