Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3296995pxj; Mon, 7 Jun 2021 07:20:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxwXYGjJRKnOf7uGNzCJEsQP8WjAqLsktflcUN07ZTc0v34Lruc+59Ir9ixinKyo2PzAaA7 X-Received: by 2002:a05:6402:b82:: with SMTP id cf2mr20809391edb.351.1623075613383; Mon, 07 Jun 2021 07:20:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623075613; cv=none; d=google.com; s=arc-20160816; b=vHJgyuAlns/87Y8Fnpu6c4CDJfbI69kfpGB0Luf0z2vb+y9EVOZ+NZbnwQ+dPkHyOl 0tEjrf31qhBVKlJQ8HBL/imPxrym/O9fWYGHbW0Xjtu/WCGnKeoKw5eWmDopGPOKzc2p XHUA4Uw8vR5k5oYpE7cpdHbaoL+hZAmVEOCy3SwRJHA94beYdCA1MvDTxZuMLC0rO/xw Ggfap0T7J9tSaV0su08opqG8vJxZLVJ2+mBHr2/SbbY7i4xebfwvfGa0OZBBCo9jxqtX gPea6wDoO73vyNo/21UK7U2/MDmedKx8gqjVpD34YJwSBLp+v/CoMk+18DU3dTqwBV3l 2bkg== 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=J5QllC5RN6wfUFHgEkxqlPJu0omFGljxqNCVv9lnZwE=; b=cYn8J3Mr0+08pRK4mSgUSdyz4LZ5r5jQOqDt65RWqIdauxneZQliCUP1+UJn8EARh2 smlX0kS7SSqudpH0/2Tyhw2NdY3+HVMtfz6MdJBcLrHJtCfj0mhY6lKtMvQ9gt5T/nZW v+p2RHmXZxIr4VuxDORb4vBV41KB8sjcUu6eJGF/kXpCyYJ+dDGGfcCdTrNWUZ7f3fNk C396vOpMZTZQLvQKe9881lv63TS16IYiSdRGHcp+OgsfLBXokO7S/amhps9ABtxkXPGF 0lXaRgBJq6RnYraRqQYFdS3fceKj/00/94q16k0okHNJtweYnGHHKE5ewpVZnce6tBBj 2Oig== 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 bm24si9964988ejb.577.2021.06.07.07.19.48; Mon, 07 Jun 2021 07:20:13 -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 S230329AbhFGOTF (ORCPT + 99 others); Mon, 7 Jun 2021 10:19:05 -0400 Received: from gate.crashing.org ([63.228.1.57]:34547 "EHLO gate.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230197AbhFGOTE (ORCPT ); Mon, 7 Jun 2021 10:19:04 -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 157ECiL5002016; Mon, 7 Jun 2021 09:12:44 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 157ECgwD002012; Mon, 7 Jun 2021 09:12:42 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Mon, 7 Jun 2021 09:12:42 -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: <20210607141242.GD18427@gate.crashing.org> References: <20210606001418.GH4397@paulmck-ThinkPad-P17-Gen-1> <20210606012903.GA1723421@rowland.harvard.edu> <20210606115336.GS18427@gate.crashing.org> <20210606184021.GY18427@gate.crashing.org> <20210606195242.GA18427@gate.crashing.org> <20210606202616.GC18427@gate.crashing.org> <20210606233729.GN4397@paulmck-ThinkPad-P17-Gen-1> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210606233729.GN4397@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 Sun, Jun 06, 2021 at 04:37:29PM -0700, Paul E. McKenney wrote: > > > The barrier() thing can work - all we need to do is to simply make it > > > impossible for gcc to validly create anything but a conditional > > > branch. > > > > And the only foolproof way of doing that is by writing a branch. [ ... ] > > I am saying that if you depend on that some C code you write will result > > in some particular machine code, without actually *forcing* the compiler > > to output that exact machine code, then you will be disappointed. Maybe > > not today, and maybe it will take years, if you are lucky. > > > > (s/forcing/instructing/ of course, compilers have feelings too!) > > OK, I will bite... > > What would you suggest as a way of instructing the compiler to emit the > conditional branch that we are looking for? You write it in the assembler code. Yes, it sucks. But it is the only way to get a branch if you really want one. Now, you do not really need one here anyway, so there may be some other way to satisfy the actual requirements. Segher