Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 5D40D16B0CAE for ; Mon, 19 Dec 2011 16:13:18 -0400 (AST) Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RcjaE-00082s-7v for pgsql-bugs@postgresql.org; Mon, 19 Dec 2011 20:13:18 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id pBJKCwpW014853; Mon, 19 Dec 2011 15:12:58 -0500 (EST) To: Noah Misch cc: Heikki Linnakangas , Robert Haas , PostgreSQL Bugs Subject: Re: Re: [PATCH] Use CC atomic builtins if available [was: Re: TAS patch for building on armel/armhf thumb] In-reply-to: <20111219200341.GB9495@tornado.leadboat.com> References: <4EEB1C77.1000309@enterprisedb.com> <20111218224203.GA2950@piware.de> <4EEF5397.8090200@enterprisedb.com> <20111219200341.GB9495@tornado.leadboat.com> Comments: In-reply-to Noah Misch message dated "Mon, 19 Dec 2011 15:03:41 -0500" Date: Mon, 19 Dec 2011 15:12:58 -0500 Message-ID: <14852.1324325578@sss.pgh.pa.us> From: Tom Lane X-Pg-Spam-Score: -4.5 (----) X-Archive-Number: 201112/162 X-Sequence-Number: 31973 Noah Misch writes: > On Mon, Dec 19, 2011 at 05:09:11PM +0200, Heikki Linnakangas wrote: >> That is not sufficient on platforms with a weak memory model, like Itanium. > Other processors may observe the lock as held after its release, but there's no > correctness problem. How weak is the memory model, exactly? A correctness problem would ensue if out-of-order stores are possible, ie other processors could observe the lock being freed (and then acquire it) before seeing changes to shared variables that had been made while holding the lock. I'm a little dubious that this applies to Itanium, because I don't see any memory fence instruction in the TAS macro. If we needed one in S_UNLOCK I'd rather expect there to be one in TAS as well. regards, tom lane