Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ifygd-0006yY-At for pgsql-bugs@arkaria.postgresql.org; Sat, 14 Dec 2019 04:05:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ifygc-0007RK-5l for pgsql-bugs@arkaria.postgresql.org; Sat, 14 Dec 2019 04:05:46 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ifygb-0007LI-Ol for pgsql-bugs@lists.postgresql.org; Sat, 14 Dec 2019 04:05:45 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ifygZ-0002fM-B9 for pgsql-bugs@lists.postgresql.org; Sat, 14 Dec 2019 04:05:44 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id xBE45cWd026614; Fri, 13 Dec 2019 23:05:38 -0500 From: Tom Lane To: Merlin Moncure cc: Andres Freund , Robert Henry , "pgsql-bugs@lists.postgresql.org" Subject: Re: postgres has no spinlock support on riscv rv64imafdc In-reply-to: References: <27501.1571382023@sss.pgh.pa.us> <20191019102234.s7utdy44npjqr7in@alap3.anarazel.de> <16913.1571545387@sss.pgh.pa.us> Comments: In-reply-to Merlin Moncure message dated "Fri, 13 Dec 2019 21:26:17 -0600" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <26612.1576296338.1@sss.pgh.pa.us> Date: Fri, 13 Dec 2019 23:05:38 -0500 Message-ID: <26613.1576296338@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Merlin Moncure writes: > On Saturday, October 19, 2019, Tom Lane wrote: >> The reason I'm skeptical of that line of argument is that gcc's track >> record for support of these intrinsics on non-mainstream architectures >> is just sucky. Now maybe, somebody was careful and it all works great >> on RISC-V. But IMO, the burden of proof is to show that the intrinsics >> work, not to show that they don't. > Do our regression tests exercise the quality of the intrinsic > implementation? Only indirectly, to the extent that a broken intrinsic might result in misbehavior of concurrent operations. If you dig through the git history for s_lock.h and the atomics files, you can find plenty of evidence that it can take awhile for us to notice bugs in this area. The git history is pretty illuminating, actually (he says having just searched through it). There is plenty of evidence there that both the manually-written-asm and the compiler-intrinsics approaches can have nasty, hard-to-pin-down bugs. The thing that makes me prefer the former is that once we do identify a bug, we can fix it. regards, tom lane