Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2728930pxj; Sun, 6 Jun 2021 11:52:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwJmpHGV/GxHy+ut7fqot49N5ldLAl/KTh06DLL8c4nJoukjZmzPIDiGVcxj9O5ohMI9k3I X-Received: by 2002:a17:907:10cc:: with SMTP id rv12mr14492329ejb.533.1623005543874; Sun, 06 Jun 2021 11:52:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623005543; cv=none; d=google.com; s=arc-20160816; b=zP53lvmj6rOKiNWIvMqxS+UMLsFFOgBA/eG+7JZ0vPpDMvRSdxtECUy6euPdQqoxXP FxnIATW/vSiFj40185J41R0W8H3sYIX+h/gJIZ9p0A1zzGGnRB6f0DcQ7pUpyCyRn2PV ILj+nDGClTG05rXNwtYXXIoYyLxA7g6PUt8lTCd0LkKT6qTllpZxYlMXhKJte+d2aH75 X3GLr2XHvTBIhIrLQEDlWVqhRy2SXvbgh4QQ0LzYNwiHY/Q4B8w+gXo/1LGkx5IWdReK H3PvBiTk4haRsMZmET8iTBI+ft729veZSXDc6JpWVuQufffJ8ZhCOPB6csj8Dj64S+yt tWtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=RJCua1TpemFOI3glAj3fgLbjj5CxdDpoZVGdK1bpooE=; b=VNE5mAbxBPZlDTEBWaFtvHQa5Gc81ZmVHF6VpwGvykVqFe6/X31mtAW5Q5lxCARfwB BGDIy+LkiUTyNb9nGpQiMdvfPaAlxOzuZ/Nc52IJqw2ql2zHvYzhfamY7xXbZwEilT4I k7G3rKbsr78W3YIx2xkI9M8EWHsaP9ew1Abh9MDfGXe0lDFWIrkGbox4xKPXPRQRBmDi cQ8Y8oLEtnrRcQt7S15qyluv9652byIN5sE4CLbi9vm9g09nHeqMLFwCFLi4xVpaIWJ9 h8uRQHvkmxIHrftC83UBlZPzBvcLaqeqX461sSycBUm3sGkIUzhuYdyORZief1YuD5kN h/eQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=eQFMVtzN; 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 a26si10449278edt.163.2021.06.06.11.52.00; Sun, 06 Jun 2021 11:52:23 -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; dkim=pass header.i=@linux-foundation.org header.s=google header.b=eQFMVtzN; 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 S230145AbhFFSuq (ORCPT + 99 others); Sun, 6 Jun 2021 14:50:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230126AbhFFSum (ORCPT ); Sun, 6 Jun 2021 14:50:42 -0400 Received: from mail-lj1-x233.google.com (mail-lj1-x233.google.com [IPv6:2a00:1450:4864:20::233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99B14C061766 for ; Sun, 6 Jun 2021 11:48:52 -0700 (PDT) Received: by mail-lj1-x233.google.com with SMTP id w15so18886974ljo.10 for ; Sun, 06 Jun 2021 11:48:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=RJCua1TpemFOI3glAj3fgLbjj5CxdDpoZVGdK1bpooE=; b=eQFMVtzND83RNvBKe4gAJD9EpVFbNqfEo6XBgSpWhwW0OiuPD/lGFputn9h6YanwSf ohx5NvMs8hu1wCWtc40QJv5O8HrmCChBxr1RnmVvLasDZe1r9HwPa/xSxXQQPQwSwk+2 CLsnEdpEEjSfN0HlTs+pdvfGZCV/grDccJwew= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=RJCua1TpemFOI3glAj3fgLbjj5CxdDpoZVGdK1bpooE=; b=TZh47XdXQOI9uM6iLqvoaAZy2OyoS2ipB2rlMATG3oC+hMvILbr9nuRCktFOaBw3Pb yQwlK2MKG2cl7N2su6eX2VH1HzmqkhK9go7JjVckcyd+61eZTaltgmRf2Rr9J/b+mzVI l1QnbL0RGATJwtQTxaB8YLnk2ObME1FVIVOcO4KHHuhXOVlexZ5qpy3O7kIBcjnfNpLU mvHqahcyvRpB6bsKGUPtkbdndt/5BulYjbTYShtCy0R4s7WH0tyIn7fHGN4b9nMZioHO j+GaG5/d0o5iyk1nPQK7193HhXvBQ4M5tM0bldIUagBWZVbdRBC+LBXmwkwaGcw3CC75 FzAw== X-Gm-Message-State: AOAM530o8A69N8IEWPlX9fJbRxWedaxGrhjTR5M+AbCgiJcsnBZCh2f/ 33RJbaGXBShWzeVqIbGXAOxx6qLbDKTPG4ZaZwY= X-Received: by 2002:a2e:878b:: with SMTP id n11mr9666192lji.225.1623005330801; Sun, 06 Jun 2021 11:48:50 -0700 (PDT) Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com. [209.85.167.47]) by smtp.gmail.com with ESMTPSA id c125sm1218806lfd.199.2021.06.06.11.48.48 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 06 Jun 2021 11:48:49 -0700 (PDT) Received: by mail-lf1-f47.google.com with SMTP id a2so22314467lfc.9 for ; Sun, 06 Jun 2021 11:48:48 -0700 (PDT) X-Received: by 2002:ac2:43b9:: with SMTP id t25mr9503593lfl.253.1623005328455; Sun, 06 Jun 2021 11:48:48 -0700 (PDT) MIME-Version: 1.0 References: <20210604205600.GB4397@paulmck-ThinkPad-P17-Gen-1> <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> In-Reply-To: <20210606184021.GY18427@gate.crashing.org> From: Linus Torvalds Date: Sun, 6 Jun 2021 11:48:32 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC] LKMM: Add volatile_if() To: Segher Boessenkool 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Why? Because then we need to write that stupid pointless branch for every single architecture. 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). 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. A working barrier "just fixes it". I suspect the best we can do is to just work around the gcc badness with that __COUNTER__ trick of mine. The lack of a reliable comment character is the biggest issue with that trick. Linus