Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2757915pxj; Sun, 6 Jun 2021 13:01:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyLAnxippqwkz+Vs63LZk0N93Kr+ybEYxP1JW9FHu40VIVKuP1MZI7GV7evuXQ52byfR5CG X-Received: by 2002:a05:6402:2805:: with SMTP id h5mr132013ede.379.1623009674752; Sun, 06 Jun 2021 13:01:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623009674; cv=none; d=google.com; s=arc-20160816; b=aNMNHaR4uayLWIVaXth+O6bSvUnA5VlmYQIWkg1WfNx3fhmYTP3ZcIFFiBY2MFgbbz 7rs4jVq5L0Ap8hQfs2dOKWouuMapdg0d2dci2Iba1bEM0b1aZHxphNyW+r5pQx1UXf5V yBjmn0cPNvTXWxj78aS9dkC523WLHiPQ5kwmAhu/6Q2yU8UsEWfRDScNgqmOK+aDYlmc m2izxDFNyTWvanDb5NpIE2IMKri0MbGP7kU78AblFOszdv9ZCyc6NMF50iVFD7U5ohXF nX0kZ3WStL/EwIm2ZAghY61PuVbbj5jJXorfQefrqHG2t5JMrmpRQuM7qT7foQIXXDTo G8Jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=bSTjjBt/xr14xgydJons1qs7LGFM9LfOAxnmzW5ulu8=; b=g8NTWKsF+reX8llWtcGILqqMeX42fCJWP74IwzKj3EU4dTw5weAMq8FkkdC1CfKjjm b24g/EUJRfVXxpJs+u19tpmFN/8U5EqW4jfrzCQ0dBYIS3i0o7M9K9M5Dfd/Uv6Xr0ML olY5VMvv2prhySfTfHs9pjMWTQ2TSDYyq/4+4Bo1un1OZ8nyFvg437EMbXsGqeoVi6h3 uE9ptrqRuWA0vrfHIcSpINkDQeqe7t1sLiC04f9GfMnBE6cquqmGqrKwsDv98cGwYb1O SlGWxFuyIM9lXDjtn9+mGJcea1c/10xc0VDtRKd2jYAb5HZp9yz++CyWwgUtCNXiRxf3 Ehwg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u1si9957070edp.527.2021.06.06.13.00.42; Sun, 06 Jun 2021 13:01:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229885AbhFFT65 (ORCPT + 99 others); Sun, 6 Jun 2021 15:58:57 -0400 Received: from gate.crashing.org ([63.228.1.57]:47652 "EHLO gate.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229772AbhFFT64 (ORCPT ); Sun, 6 Jun 2021 15:58:56 -0400 Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 156JqiJX012123; Sun, 6 Jun 2021 14:52:44 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 156JqgQT012119; Sun, 6 Jun 2021 14:52:42 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Sun, 6 Jun 2021 14:52:42 -0500 From: Segher Boessenkool To: Linus Torvalds Cc: Alan Stern , "Paul E. McKenney" , Peter Zijlstra , Will Deacon , Andrea Parri , Boqun Feng , Nick Piggin , David Howells , Jade Alglave , Luc Maranget , Akira Yokosawa , Linux Kernel Mailing List , linux-toolchains@vger.kernel.org, linux-arch Subject: Re: [RFC] LKMM: Add volatile_if() Message-ID: <20210606195242.GA18427@gate.crashing.org> References: <20210604214010.GD4397@paulmck-ThinkPad-P17-Gen-1> <20210605145739.GB1712909@rowland.harvard.edu> <20210606001418.GH4397@paulmck-ThinkPad-P17-Gen-1> <20210606012903.GA1723421@rowland.harvard.edu> <20210606115336.GS18427@gate.crashing.org> <20210606184021.GY18427@gate.crashing.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jun 06, 2021 at 11:48:32AM -0700, Linus Torvalds wrote: > On Sun, Jun 6, 2021 at 11:43 AM Segher Boessenkool > wrote: > > > > You truly should have written a branch in tthe asm if you truly wanted > > a branch instruction. > > That's exactly what I don't want to do, and what the original patch by > PeterZ did. Yes, I know. But it is literally the *only* way to *always* get a conditional branch: by writing one. > And to work well, it needs "asm goto", which is so recent that a lot > of compilers don't support it (thank God for clang dragging gcc > kicking and screaming to implement it at all - I'd asked for it over a > decade ago). GCC has had it since 2009. > So you get bad code generation in a lot of cases, which entirely > obviates the _point_ of this all - which is that we can avoid an > expensive operation (a memory barrier) by just doing clever code > generation. > > So if we can't get the clever code generation, it's all pretty much > moot, imnsho. Yes. Segher