Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2792264pxj; Sun, 6 Jun 2021 14:22:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyI1TlKf74h0OZ7Yn9EkcPSbR77RM+pGs33t/QzcaRg0Xcc3KWY8cXB2NSDpERBSgRcBFhY X-Received: by 2002:a05:6402:26ce:: with SMTP id x14mr17004331edd.104.1623014577614; Sun, 06 Jun 2021 14:22:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623014577; cv=none; d=google.com; s=arc-20160816; b=wO+wZXIp7fphrGf7SnQQRaEBbbpAvt6YJYADANwlO+GuJ8RAj2X4YTTKkYife/GjWL jXBaoPv38Ke7f8n9qnegnGzEDKmB6wyv0Kwlrte8vwalDLnEJC1lwGqpIW1t9E8721ae /ygkUFTv78iMc3TdmUSOMwA978ft+3xqYO+n/WrEoO45hh5lyK0OMRav7EaMutz+Gj/r uO2Z1R1zfTbCJQKdQFjGFaLtOYDI8TqSJt40HDwfk6zuCdL/t9WR2mtR1vnho9yB988Y WcRDT1y4JNlXd/ifZuXrLCOHrNRDBdAxsAYiCYAJnha/YU+0r+aAVFG4O0f3qY2OfjHa dibA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date; bh=+vTjUHw3hCaRyzKVjq95Jc99IPP+zclfBuQffQiDM+I=; b=xrPVWfY0HAhx/sQbzQzp8UljKhA+pcxxkl1ztVqQaGXlyP2LKsvDr9Jm/A3s/hi4VL xWJWcydSeMggwU98esPd9+LhFGqDTdiS604tEpgwpX5Bju1qfWLdDxDSsVPEQt/+GkQs sSnQ8qxXWjSg8Jmqjk3c2gfNX/1j7ZIhZ7x/mRsLhq+r18DlJrcRtRYizm9yTqqkjFAO 5PAZ/yZdsWJpf8Wvyl+6dO2qxPDnoAFELDXU5sCjUJF+JXyLp4Ui6UCopedtKhXfmQVa ctelDO5zIqvRMouaEQCcjYwDehb3W21KYI8PATq9/UDFeZQFKlmiQi/Mah+fYSgRx5PX zQyQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ispras.ru Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bh7si10672566ejb.383.2021.06.06.14.22.35; Sun, 06 Jun 2021 14:22:57 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ispras.ru Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230342AbhFFVVS (ORCPT + 99 others); Sun, 6 Jun 2021 17:21:18 -0400 Received: from mail.ispras.ru ([83.149.199.84]:57878 "EHLO mail.ispras.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230270AbhFFVVR (ORCPT ); Sun, 6 Jun 2021 17:21:17 -0400 Received: from monopod.intra.ispras.ru (unknown [10.10.3.121]) by mail.ispras.ru (Postfix) with ESMTPS id 6E7994076B33; Sun, 6 Jun 2021 21:19:23 +0000 (UTC) Date: Mon, 7 Jun 2021 00:19:23 +0300 (MSK) From: Alexander Monakov To: Linus Torvalds cc: Jakub Jelinek , Alan Stern , Segher Boessenkool , "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() In-Reply-To: Message-ID: 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> <20210606185922.GF7746@tucnak> User-Agent: Alpine 2.20.13 (LNX 116 2015-12-14) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 6 Jun 2021, Linus Torvalds wrote: > On Sun, Jun 6, 2021 at 11:59 AM Jakub Jelinek wrote: > > > > I think just > > #define barrier() __asm__ __volatile__("" : : "i" (__COUNTER__) : "memory") > > should be enough > > Oh, I like that. Much better. > > It avoids all the issues with comments etc, and because it's not using > __COUNTER__ as a string, it doesn't need the preprocessor games with > double expansion either. > > So yeah, that seems like a nice solution to the issue, and should make > the barriers all unique to the compiler. It also plants a nice LTO time-bomb (__COUNTER__ values will be unique only within each LTO input unit, not across all of them). Alexander