Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2561665pxj; Sun, 6 Jun 2021 06:23:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCyzS7PRpl7thKCggYMI/ndb+Z4EusWCVP6jHro6qGOWJjhTncthTUWENtW9MwgvRix5CF X-Received: by 2002:a17:906:ae91:: with SMTP id md17mr14095369ejb.433.1622985796377; Sun, 06 Jun 2021 06:23:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622985796; cv=none; d=google.com; s=arc-20160816; b=xNq0SEDb76nyE/66l6WgTjoN0PrtbTalBspIYJMprfaJpE+jWepG7iK9LQy1+a1QOZ KAW1qiUEhDkC8dCl84LzcKL+6aaIq1CdR9RvEs0CXmS+c045WIC5NgxCgENgNLmQqm5J 02AFbyk78WhVss5SavmivxarpyDxrW8WniopkcEbFwTaBvXK3nDX4FoQMJCRk77Xz8t1 8QlWY4jU4yIQdOo+4eBHQ62yQV67GRMX4mDGH5H5EuzdqI2Cl8/iV0lxcizP1YMCbLiu lhaDCuYF+V62jYijnhzngzVmaSIMwQhFlt661oxh1DFZFv+EdVyQFqC/KawqKWLDTJ6G F/1g== 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=CpX3HhuBrT/Yl/ED/ffCdOCC6pUB5lOLY0TW8+k/Cxg=; b=dcfrKQuCCvD/r3+6Bn6hHaLkwpP2XmavfpkT4H6hIDHbru6o9y70O8o5m8zpu3Lj/a Mbnd2eYdVqJSsODoDmJ5Aih3Hs8SStrd5VD4q1QLt4sM+3rTN6Vg01txYlIBjw9JdVVt Ng42tBNXCvBhQs3qJ5SA6rE+7ymTBr3AGPHqrqjxTDW7nQbGkRgtCL1U5CD0S0mrJ68T IIhQRBwE0IkgZmDgKBrjXDZJeMu8cH9A47g6zojvElzFSc7JlgeIGvHGCeP9iivpelu5 Q+Xhwi1AJQYlJt5YxU5ZS8FR3CRkL/JXUDFZdhRpK68xNfXMgC3QF5OhymSYrMZ9b62T NMFA== 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 q23si9360613ejj.340.2021.06.06.06.22.53; Sun, 06 Jun 2021 06:23:16 -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 S230084AbhFFNXv (ORCPT + 99 others); Sun, 6 Jun 2021 09:23:51 -0400 Received: from gate.crashing.org ([63.228.1.57]:54877 "EHLO gate.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229531AbhFFNXv (ORCPT ); Sun, 6 Jun 2021 09:23:51 -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 156DHgDq028954; Sun, 6 Jun 2021 08:17:42 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 156DHeno028953; Sun, 6 Jun 2021 08:17:40 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Sun, 6 Jun 2021 08:17:40 -0500 From: Segher Boessenkool To: "Paul E. McKenney" Cc: Linus Torvalds , Alan Stern , 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: <20210606131740.GU18427@gate.crashing.org> 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> <20210606044333.GI4397@paulmck-ThinkPad-P17-Gen-1> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210606044333.GI4397@paulmck-ThinkPad-P17-Gen-1> User-Agent: Mutt/1.4.2.3i Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jun 05, 2021 at 09:43:33PM -0700, Paul E. McKenney wrote: > So gcc might some day note a do-nothing asm and duplicate it for > the sole purpose of collapsing the "then" and "else" clauses. I > guess I need to keep my paranoia for the time being, then. :-/ Or a "do-something" asm, even. What it does is make sure it is executed on the real machine exactly like on the abstract machine. That is how C is defined, what a compiler *does*. The programmer does not have any direct control over the generated code. > Of course, there is no guarantee that gcc won't learn about > assembler constants. :-/ I am not sure what you call an "assembler constant" here. But you can be sure that GCC will not start doing anything here. GCC does not try to understand what you wrote in an inline asm, it just fills in the operands and that is all. It can do all the same things to it that it can do to any other code of course: duplicate it, deduplicate it, frobnicate it, etc. Segher