Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1409027pxj; Fri, 4 Jun 2021 13:43:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyxC+YAui8PFODCMHjNPQSWDo3Kv/A6719/YKNQekjFdT5c5rMBRZrrh4HetwUg24at5LPY X-Received: by 2002:a05:6402:170e:: with SMTP id y14mr6810920edu.367.1622839417682; Fri, 04 Jun 2021 13:43:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622839417; cv=none; d=google.com; s=arc-20160816; b=k/0MBNVQU9WSr9iqhxlnfm1Hher2AbnF7TsRyVzxd7NvmwCXqdUe3BezLRVMvqFE2g iNG6pnvBGpajd/jTVpoI2ZszyHvMhPlHXGVubuogjbFT5Xi6o3PXYIqAMFuZ1D2/RZgt 2cfxB7rDyCc3LOPF4eaee+/g3p1ZvOJiMSKPkxpc9C96PA5iNcxuNv1k0XOIjuFTVBkf hBUO7OMuGX9oNyKS8nJPbqo4KffeQ8AfYVBNOkt82UAo/P+4HrsJLMVodEt5bzWLnzBT 8W0kHLlBS/Lmnh6U+fFb0Frv2UbaPzAs5pgqfOXa+9sMoYCaQ3qcZsk5X/MXiY8ElR2Q W8jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=dHq2snPDYW1WoWr6NW/qp4Y/inOshtoEMj8YIsCxnYM=; b=vx7Gw5Wpwx+CxPLZMpfpJbcssmAjwQvHAcvMdXaEm74/jqtCyt7gRGIENKuzxR33ed W3VlLjW5LMam76UH7FE27XxJGDLOfTUlsnYzBbT1gW5/uPkrf8MlCNN1W+hwwc0ZSCpH eVgc5yBbI/RpawV7WmXd03RzTcNba2L475lsr1+6ugwWM+x63t7HawTTguxRvEoqCytD vYOAMj6wsIiiHLzSYJ8VGQ3EWVMYJ7qQ86wYCmG4mrSlnZDvWOeRoseR5gWMU6U1nVwf fe5y34Oxyqj33++YdCLDm43KUuWSni278EqO6aWMEuj12L91uZSxc0YzrA3vlC09cUn2 1gRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=S2frtJgw; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j6si5313966edq.137.2021.06.04.13.43.13; Fri, 04 Jun 2021 13:43:37 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=S2frtJgw; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231270AbhFDUma (ORCPT + 99 others); Fri, 4 Jun 2021 16:42:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:39732 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229854AbhFDUm3 (ORCPT ); Fri, 4 Jun 2021 16:42:29 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 27598613F9; Fri, 4 Jun 2021 20:40:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1622839243; bh=KxYYmfZHvreYfegSJ6Yvy7eFkAGPX45eOume+9GyXWQ=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=S2frtJgwPxsoQMaengHFztep8buKaFEnvjnfyyZhpMsd7HstGhutbivJbGnbDsLLF vI0L4Z1ovfRuhrTF487QmKmHxYRQ8vvyVYxz2BVUtmZXCUr4MRLH9xAIP84gQa4fi/ /62QrBDGZrJg9ovBTjaMdz67kKUHxdoC5utbwRV+okMDpeb6xXUGh+8yaS3R87z4zd nf+31XSlN7rDNaciCQRouITPzH0hjKqA5RpqbGSrjDVMJsMskFHApqCCZlob2H3yZW f3soUidC0FzWGI3/jqwB2GXNobE/zDdq3GtGDeRM9deZgAFxtXwgxNo+XlfiIRPFSk jUnp0e0o34lmg== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id E21225C02AB; Fri, 4 Jun 2021 13:40:42 -0700 (PDT) Date: Fri, 4 Jun 2021 13:40:42 -0700 From: "Paul E. McKenney" To: Segher Boessenkool Cc: Peter Zijlstra , Linus Torvalds , will@kernel.org, stern@rowland.harvard.edu, parri.andrea@gmail.com, boqun.feng@gmail.com, npiggin@gmail.com, dhowells@redhat.com, j.alglave@ucl.ac.uk, luc.maranget@inria.fr, akiyks@gmail.com, linux-kernel@vger.kernel.org, linux-toolchains@vger.kernel.org, linux-arch@vger.kernel.org Subject: Re: [RFC] LKMM: Add volatile_if() Message-ID: <20210604204042.GZ4397@paulmck-ThinkPad-P17-Gen-1> Reply-To: paulmck@kernel.org References: <20210604153518.GD18427@gate.crashing.org> <20210604164047.GH18427@gate.crashing.org> <20210604185526.GW4397@paulmck-ThinkPad-P17-Gen-1> <20210604195301.GM18427@gate.crashing.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210604195301.GM18427@gate.crashing.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 04, 2021 at 02:53:01PM -0500, Segher Boessenkool wrote: > On Fri, Jun 04, 2021 at 11:55:26AM -0700, Paul E. McKenney wrote: > > On Fri, Jun 04, 2021 at 11:40:47AM -0500, Segher Boessenkool wrote: > > > My point is that you ask compiler developers to paint themselves into a > > > corner if you ask them to change such fundamental C syntax. > > > > Once we have some experience with a language extension, the official > > syntax for a standardized version of that extension can be bikeshedded. > > Committees being what they are, what we use in the meantime will > > definitely not be what is chosen, so there is not a whole lot of point > > in worrying about the exact syntax in the meantime. ;-) > > I am only saying that it is unlikely any compiler that is used in > production will want to experiment with "volatile if". That unfortunately matches my experience over quite a few years. But if something can be implemented using existing extensions, the conversations often get easier. Especially given many more people are now familiar with concurrency. > > > I would love to see something that meshes well with the rest of C. But > > > there is no 1-1 translation from C code to machine code (not in either > > > direction), so anything that more or less depends on that will always > > > be awkward. If you can actually express the dependency in your source > > > code that will get us 95% to where we want to be. > > ^^^ > > > > > Data dependencies, control dependencies and address dependencies, C > > > > doesn't really like them, we rely on them. It would be awesome if we can > > > > fix this. > > > > > > Yes. The problem is that C is a high-level language. All C semantics > > > are expressed on a an "as-if" level, never as "do this, then that" -- > > > well, of course that *is* what it says, it's an imperative language just > > > like most, but that is just how you *think* about things on a conceptual > > > level, there is nothing that says the machine code has to do the same > > > thing in the same order as you wrote! > > > > Which is exactly why these conversations are often difficult. There is > > a tension between pushing the as-if rule as far as possible within the > > compiler on the one hand and allowing developers to write code that does > > what is needed on the other. ;-) > > There is a tension between what users expect from the compiler and what > actually is promised. The compiler is not pushing the as-if rule any > further than it always has: it just becomes better at optimising over > time. The as-if rule is and always has been absolute. Heh! The fact that the compiler has become better at optimizing over time is exactly what has been pushing the as-if rule further. The underlying problem is that it is often impossible to write large applications (such as the Linux kernel) completely within the confines of the standard. Thus, most large applications, and especially concurrent applications, are vulnerable to either the compiler becoming better at optimizing or compilers pushing the as-if rule, however you want to say it. > What is needed to get any progress is for user expectations to be > feasible and not contradict existing requirements. See "^^^" above. Or additional requirements need to be accepted by the various compilation powers that be. Failing to acknowledge valid new user expectations is after all an excellent path to obsolescence. Thanx, Paul