Received: by 2002:a19:ef0c:0:0:0:0:0 with SMTP id n12csp950262lfh; Tue, 1 Feb 2022 12:51:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJz17WCepgo7Vij1E05KUEE9DADuxSZb5/U7888Ens7/kTnThcroq/lRjuyjigr7e1i6TmI6 X-Received: by 2002:a17:902:ab49:: with SMTP id ij9mr27922451plb.1.1643748714666; Tue, 01 Feb 2022 12:51:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643748714; cv=none; d=google.com; s=arc-20160816; b=0i6PKMRpNaaSCcnwutImD8svsibiQTGsaQJvCGuZm3FRdMo1AqNu4aW4miRuBc2A9P ng7UIGfjbPykgDnzXZitgiQeyUqrwCKiwBgL7fxkjfISiP+7LmxKrRyEg14ZNzQ9wNb6 BV1VLwSJZjewAw92I9GUj5nfUcq74PACjZQGPbisRm2uaDF9aBRf2QZETWG+F19h+NqD QgwOkjSdeQvWEbZrbkk36Fu5oQFhypWTAIhwwlJdzLvnFXONTy7wsltTr2DTGWSJfoLo AgKbYIZZUoP1gd1adlqEHcy8/1EKYJDEhu1gYJ66IXnDxFzPFqfUrdDiyy4jAFdAgfem Zx/g== 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=Ov+l9PShIw5uVZwMuKKvG5xAKYa/t+ik/uxAAEQ8YDw=; b=PXrmGDGEqW8o7ATapIrkaRIyYr12TXkVl0bkjgIci5anSu2sC3Isd7CexSOCEbWFPG yo9FhC34A4rdlnLl/UyvBII8dEQF3ZyPooT4ibxeVkd/ICgoP7qin2i7jEtp9R2vIN5q zY9j++J28AzKSRzCHhkvMBcwwKV6IVhZpilB9/AXQQ8OJEHv11AaH+NPWdTPd3JeBWa+ xmmrhhspGMvvv1fjXBbm6fd53ioZJmSLKZqewz1bhY2ssRIBiHBy+SxgaqFoVQcnw65g s6ZOiwuHU2Zzo5EMu1A8xMiRye6JhsfvTMjbUWLyspY5hrW8o/jTUHINWK0aiyItrl41 GBHg== 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 h14si17547293pgi.577.2022.02.01.12.51.43; Tue, 01 Feb 2022 12:51:54 -0800 (PST) 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 S232213AbiAaWVd (ORCPT + 99 others); Mon, 31 Jan 2022 17:21:33 -0500 Received: from gate.crashing.org ([63.228.1.57]:40799 "EHLO gate.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232909AbiAaWVd (ORCPT ); Mon, 31 Jan 2022 17:21:33 -0500 Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 20VMDZ8D023795; Mon, 31 Jan 2022 16:13:35 -0600 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 20VMDXsA023794; Mon, 31 Jan 2022 16:13:33 -0600 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Mon, 31 Jan 2022 16:13:33 -0600 From: Segher Boessenkool To: Nick Desaulniers Cc: apinski@marvell.com, Josh Poimboeuf , Borislav Petkov , Vasily Gorbik , Linus Torvalds , Ingo Molnar , Dave Hansen , Thomas Gleixner , Peter Zijlstra , Luc Van Oostenryck , x86@kernel.org, llvm@lists.linux.dev, linux-sparse@vger.kernel.org, linux-kernel@vger.kernel.org, kernel test robot , Nathan Chancellor , linux-toolchains@vger.kernel.org Subject: Re: [PATCH] objtool: prefer memory clobber & %= to volatile & __COUNTER__ Message-ID: <20220131221333.GR614@gate.crashing.org> References: <20220114010526.1776605-1-ndesaulniers@google.com> <20220118192256.jzk5dnceeusq7x7u@treble> <20220118230120.pivvson7qekfiqic@treble> <20220125233128.GT614@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 Mon, Jan 31, 2022 at 12:45:20PM -0800, Nick Desaulniers wrote: > On Tue, Jan 25, 2022 at 3:34 PM Segher Boessenkool > wrote: > > > > Hi! > > > > On Mon, Jan 24, 2022 at 03:26:36PM -0800, Nick Desaulniers wrote: > > > I'm more confident that we can remove the `volatile` keyword (I was > > > thinking about adding a new diagnostic to clang to warn that volatile > > > is redundate+implied for asm goto or inline asm that doesn't have > > > outputs) though that's not the problem here and will probably generate > > > some kernel wide cleanup before we could enable such a flag. > > > > Its main value is that it would discourage users from thinking volatile > > is magic. Seriously worth some pain! > > https://reviews.llvm.org/D118297 > PTAL "" Really the volatile asm-qualifier exists only to signal that an asm statement should not be DCE'd (when it has outputs but they are unused), CSE'd, or LICM'd. It is not a general compiler barrier. It means that the asm has a side effect (one unknown to the compiler), so it must be executed in the real machine just where it would be in the abstract machine. It *can* be CSEd, it *can* be DCEd, it can even be optimised by LICM in certain cases: but it has to be executed as often (and in the same order etc.) in the resulting machine code as it would be if you single-stepped through the source code by hand. Those are fine examples if you add "in most cases" (and that they are just examples, it's not an exhaustive list). Thanks, Segher