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 1iM2kW-0003Zl-Ap for pgsql-bugs@arkaria.postgresql.org; Sun, 20 Oct 2019 04:23:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iM2kU-0002au-50 for pgsql-bugs@arkaria.postgresql.org; Sun, 20 Oct 2019 04:23:22 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iM2kT-0002VJ-RM for pgsql-bugs@lists.postgresql.org; Sun, 20 Oct 2019 04:23:21 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iM2kM-0004XO-Dm for pgsql-bugs@lists.postgresql.org; Sun, 20 Oct 2019 04:23:21 +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 x9K4N72f016914; Sun, 20 Oct 2019 00:23:08 -0400 From: Tom Lane To: Andres Freund cc: Robert Henry , pgsql-bugs@lists.postgresql.org Subject: Re: postgres has no spinlock support on riscv rv64imafdc In-reply-to: <20191019102234.s7utdy44npjqr7in@alap3.anarazel.de> References: <27501.1571382023@sss.pgh.pa.us> <20191019102234.s7utdy44npjqr7in@alap3.anarazel.de> Comments: In-reply-to Andres Freund message dated "Sat, 19 Oct 2019 03:22:34 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <16912.1571545387.1@sss.pgh.pa.us> Date: Sun, 20 Oct 2019 00:23:07 -0400 Message-ID: <16913.1571545387@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Andres Freund writes: > On 2019-10-18 09:00:23 +0200, Tom Lane wrote: >> TBH, though, my preference would be for some assembly code rather than >> relying on GCC builtins as Richard's patch did. > -1. I think there's good arguments for using inline assembly on > platforms where we've done so historically, and where we have to support > old compilers without good support for intrinsics/builtins. But I see > very little reason for adding more such cases for newer platforms - > doing so correctly and efficiently is substantial work and fragile. 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. I recall Noah's recent argument in a related context that with an asm implementation, anybody with a copy of the architecture manual can review/verify the code; and such a verification doesn't depend on which compiler version you're using. If we depend on gcc intrinsics, we've basically got zero confidence about anything except from testing. Yeah, you could make a similar argument about any sort of compiler bug ... but gcc has *earned* my lack of trust in this particular area. regards, tom lane