From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 99323C4743E for ; Sun, 6 Jun 2021 21:19:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7508D6121E for ; Sun, 6 Jun 2021 21:19:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230289AbhFFVVR (ORCPT ); Sun, 6 Jun 2021 17:21:17 -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-toolchains@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