Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jhPZi-00005D-4k for pgsql-hackers@arkaria.postgresql.org; Sat, 06 Jun 2020 03:32:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jhPZe-00015K-9e for pgsql-hackers@arkaria.postgresql.org; Sat, 06 Jun 2020 03:32:46 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jhPZc-00015D-H2 for pgsql-hackers@lists.postgresql.org; Sat, 06 Jun 2020 03:32:46 +0000 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jhPZW-0001XC-Mt for pgsql-hackers@lists.postgresql.org; Sat, 06 Jun 2020 03:32:43 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 5A56543F; Fri, 5 Jun 2020 23:32:34 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Fri, 05 Jun 2020 23:32:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm1; bh=Scssu2Tsr5ubMccf7G+cKRBo9Tu oRaGb1eTqMNy9xR0=; b=TUOZaMdtoJa2DOENNN94y5MdHeRLHtbos5/z8vy4pgV BnVUW4i7wwG2CtHmP+X1EE1OG6jtQp1VOU8tzL6dVwTN4yk7mvgdxYPNYa21PUYl 2UfdAXJe63KjGA2fNYT4pZvwD5GJ6Hf63dMkYPRn/1S+RYLjqJYEwXuz7noi7y20 Cp73iMWU+ybfYGqpLcDXWAUtlmGfRLQsr74k/LdbbiD3Kvv+qmPeRhnH0LJkHvCb mFJ9zHBBne5AjmY5R0mPb/7W+pjtdxHpHj/kSbJISFPfictNt1z9+Wzeizx+3c8h SBQspStG9JUpiu0EGwtj7cgqEKb0/na74ogzlL3x3Yg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=Scssu2 Tsr5ubMccf7G+cKRBo9TuoRaGb1eTqMNy9xR0=; b=J+Y0wp8SIARgk9uS+liBWV yoUFEXlECvNlc901++h8zKGrMjAHlClhmZ1sfDhbdOWrJk9CGR0l1bNF5Apu/b6Y dYBEKlnGLIkIVjmxRY6+10ptLvyfCotkEv9KonHYbbS3ppAVghyWQMmhDJsRoxlO T9Q+PnyflGW8QWF+ThH4OsC6iuqLCAaoHFySbiZdeux2MSwj+S+ZyQrUyOGVBXfB rNSEc6FyWYNWFOa4j5FyMiAkP+x3IuDvefA/YHZ0dea/E8Klp/KMbeDK9jsvlJJL hAtDtP9Rw4Wyp7o4wNHt19v4MN3Gq0i7jAjt7TNd07a+TJJksOD2+REQYVQUFW3g == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudeggedgieehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpeetnhgurhgv shcuhfhrvghunhguuceorghnughrvghssegrnhgrrhgriigvlhdruggvqeenucggtffrrg htthgvrhhnpedukefhkeelueegveetheelffffjeegleeuudelfeefuedtleffueejfffh ueffudenucfkphepieejrdduiedtrddvudejrddvhedtnecuvehluhhsthgvrhfuihiivg eptdenucfrrghrrghmpehmrghilhhfrhhomheprghnughrvghssegrnhgrrhgriigvlhdr uggv X-ME-Proxy: Received: from intern.anarazel.de (c-67-160-217-250.hsd1.ca.comcast.net [67.160.217.250]) by mail.messagingengine.com (Postfix) with ESMTPA id 6733D328005A; Fri, 5 Jun 2020 23:32:33 -0400 (EDT) Date: Fri, 5 Jun 2020 20:32:32 -0700 From: Andres Freund To: Tom Lane Cc: Robert Haas , pgsql-hackers@lists.postgresql.org Subject: Re: Atomic operations within spinlocks Message-ID: <20200606033232.4lsf4g3l67cq2bw7@alap3.anarazel.de> References: <1141819.1591208385@sss.pgh.pa.us> <20200603204542.reuladbmgmjqzoi6@alap3.anarazel.de> <1253593.1591293439@sss.pgh.pa.us> <20200604185525.wuyjtkluppj4eddr@alap3.anarazel.de> <1256701.1591297654@sss.pgh.pa.us> <20200605023302.g6v3ydozy5txifji@alap3.anarazel.de> <20200606001926.zin5getvvhqppnm2@alap3.anarazel.de> <1642804.1591405316@sss.pgh.pa.us> <20200606023103.avzrctgv7476xj7i@alap3.anarazel.de> <1647173.1591411967@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1647173.1591411967@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi, On 2020-06-05 22:52:47 -0400, Tom Lane wrote: > Andres Freund writes: > > On 2020-06-05 21:01:56 -0400, Tom Lane wrote: > >> At some point I think we'll have to give up --disable-spinlocks; it's > >> really of pretty marginal use (how often does anyone port PG to a new > >> CPU type?) and the number of weird interactions it adds in this area > >> seems like more than it's worth. > > > Indeed. And any new architecture one would port PG to would have good > > enough compiler intrinsics to make that trivial. I still think it'd make > > sense to have a fallback implementation using compiler intrinsics... > > > And I think we should just require 32bit atomics at the same time. Would > > probably kill gaur though. > > Not only gaur. A quick buildfarm survey finds these active members > reporting not having 32-bit atomics: Hm, I don't think that's the right test. We have bespoke code to support most of these, I think: > anole | 2020-06-05 11:20:17 | pgac_cv_gcc_atomic_int32_cas=no Has support via acc specific intrinsics. > chipmunk | 2020-05-29 22:27:56 | pgac_cv_gcc_atomic_int32_cas=no Doesn't have support for __atomic, but does have support for 32bit __sync. > gharial | 2020-06-05 12:41:14 | pgac_cv_gcc_atomic_int32_cas=no __sync support for both 32 and 64 bit. > curculio | 2020-06-05 22:30:06 | pgac_cv_gcc_atomic_int32_cas=no > frogfish | 2020-05-31 13:00:25 | pgac_cv_gcc_atomic_int32_cas=no __sync support for both 32 and 64 bit. > mandrill | 2020-06-05 09:20:03 | pgac_cv_gcc_atomic_int32_cas=no __sync support for 32, as well as as inline asm for 32bit atomics (although we might be able to add 64 bit). > hornet | 2020-06-05 09:11:26 | pgac_cv_gcc_atomic_int32_cas=no > hoverfly | 2020-06-05 22:06:14 | pgac_cv_gcc_atomic_int32_cas=no __sync support for both 32 and 64 bit, and we have open coded ppc asm. > locust | 2020-06-05 10:14:29 | pgac_cv_gcc_atomic_int32_cas=no > prairiedog | 2020-06-05 09:55:49 | pgac_cv_gcc_atomic_int32_cas=no Wee, these don't have __sync? But I think it should be able to use the asm ppc implementation for 32 bit atomics. > gaur | 2020-05-19 13:33:25 | pgac_cv_gcc_atomic_int32_cas=no As far as I understand pa-risc doesn't have any atomic instructions except for TAS. So I think gaur is really the only one that'd drop. > It looks to me like this is mostly about compiler support not the > hardware; that doesn't make it not a problem, though. (I also > remain skeptical about the quality of the compiler intrinsics > on non-mainstream hardware.) I think that's fair enough for really old platforms, but at least for gcc / clang I don't think it's a huge concern for newer ones. Even if not mainstream. For gcc/clang the intrinsics basically back the C11/C++11 "language level" atomics support. And those are extremely widely used these days. Greetings, Andres Freund