Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp5345933rwn; Mon, 12 Sep 2022 07:47:48 -0700 (PDT) X-Google-Smtp-Source: AA6agR5dKEvjs0x4JAE7ZGMyfRFO5KnFbiTjuC/4u/VWgbW1mYrdit/2BTe48PnG32gRj8Ui0OX6 X-Received: by 2002:a17:90a:c70b:b0:200:4366:d047 with SMTP id o11-20020a17090ac70b00b002004366d047mr24678243pjt.240.1662994067973; Mon, 12 Sep 2022 07:47:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662994067; cv=none; d=google.com; s=arc-20160816; b=Tlaq2bzpoe1DlaWhA4lgVbpZXeTib6qyB1AR5X2tiImTRiFIhUqzzvTdIhKtaAOUzT vtxoVQNSkicMp5RzPXsA9KyBm6VtCbdAbp0nU+zmlJJ1T09MUHWqV5dgpb3Cq54YXLpQ nopd5D2+SPHxf2QES2IzTvVdWHKYHpVTqWVljuYrYugCC+Q5fo+dvHu0hH1S7ufEGbzn 3Ti2P5TXQcvoWLd9bHgM7ZXHtMsqv2juwhDxH2P1SB2rRIqTU5zVihlALX2r/lZhdecB 45+ECXHTceGa6XulrnQR1h1he2+s34qjyU2zgKyR6EKpc/4NxStSh2ss49GHCZ8D+a35 UvSA== 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-transfer-encoding :content-disposition:mime-version:references:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=nZQF8QVeXNFNJOuJQmAtd8ZOuLgO3DGjfcvwj2RYNLg=; b=w+bVJeh0mjJQiMnk4CY76lDf4bTv7RDm532nnA30esltxEzMD4oMCa0w3c2AKglXXU lPqie28G2zZ2M+ui8DnSRLVuVGfNDuvWcBo+2TWtJ0gfSe1CWsYkskOp6eSZ7AOqAyYA VZD9GUgaaUZ39ZMF8XGoXF3JpBfTCElY3UreEjuf/oGusQN8j0vdrEnOY6GHjoI8CAmb 2qQoUV8PMWiX/c1wLUQ8rDvBg/3RoDQPC8OuvGxI0PfUztOAZPjz4vwKc68H6PGK7RwJ vqApEr0fzCfUe3troLXX7wCLTNuylOwOhyoC3C4tFh/0Ibq8jNf0ty7BEzkV3MxKX4Te w5TA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OaqqLDwb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m6-20020a170902f64600b00174e8a089b6si9459764plg.559.2022.09.12.07.47.34; Mon, 12 Sep 2022 07:47:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OaqqLDwb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229995AbiILOLY (ORCPT + 99 others); Mon, 12 Sep 2022 10:11:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229498AbiILOLW (ORCPT ); Mon, 12 Sep 2022 10:11:22 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BD4FFD00; Mon, 12 Sep 2022 07:11:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 41AEDB80D55; Mon, 12 Sep 2022 14:11:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B11EFC433C1; Mon, 12 Sep 2022 14:11:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1662991878; bh=OtpVMG63/twYTBPtJm030JQK0As6OlhIeF6G6tO5hfo=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=OaqqLDwbkO4VC/jDcesIgP4kTYD6Nfh85TxxKofogLQ7XydWFSNnLrWVlpKx+QxQy lx9Kk56VJeuFcv3c15xXCjpB+DX+1iCiEcTazL+ZX0X5YFJyhKX20rF11x00EfygKW X6HF72k3LhwCUzVnMItGq6a2QKWzIrMRcpeSUa6SZO1S2O8YaBqTkvcX8jkPJgt4BG WJvfeImAWDgqer/JfP48zuotOSbnelFLpdHTiuVbz1jeB8KbtPvGF7V2axxDRqcepO uCn0Qu0HaO1k5pqQ3IM9M4hl5A7y4BQITjTyfrGDwnku2qb7KtkY/br3rMWQyxezr2 2uORJK3YSqT7A== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 34B1C5C06AB; Mon, 12 Sep 2022 07:11:16 -0700 (PDT) Date: Mon, 12 Sep 2022 07:11:16 -0700 From: "Paul E. McKenney" To: Paul =?iso-8859-1?Q?Heidekr=FCger?= Cc: Alan Stern , Andrea Parri , Will Deacon , Peter Zijlstra , Boqun Feng , Nicholas Piggin , David Howells , Jade Alglave , Luc Maranget , Akira Yokosawa , Daniel Lustig , Joel Fernandes , Palmer Dabbelt , Michael Ellerman , linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, Marco Elver , Charalampos Mainas , Pramod Bhatotia , Soham Chakraborty , Martin Fink Subject: Re: [PATCH v2] tools/memory-model: Weaken ctrl dependency definition in explanation.txt Message-ID: <20220912141116.GK246308@paulmck-ThinkPad-P17-Gen-1> Reply-To: paulmck@kernel.org References: <20220830210821.3763660-1-paul.heidekrueger@in.tum.de> <20220912113838.GG246308@paulmck-ThinkPad-P17-Gen-1> <26A8E8E5-FA0B-4D5B-BDD1-3DA8E654965E@in.tum.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <26A8E8E5-FA0B-4D5B-BDD1-3DA8E654965E@in.tum.de> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 12, 2022 at 02:38:58PM +0100, Paul Heidekr?ger wrote: > On 12. Sep 2022, at 12:38, Paul E. McKenney wrote: > > > On Tue, Aug 30, 2022 at 09:08:20PM +0000, Paul Heidekr?ger wrote: > >> The current informal control dependency definition in explanation.txt is > >> too broad and, as discussed, needs to be updated. > >> > >> Consider the following example: > >> > >>> if(READ_ONCE(x)) > >>> return 42; > >>> > >>> WRITE_ONCE(y, 42); > >>> > >>> return 21; > >> > >> The read event determines whether the write event will be executed "at > >> all" - as per the current definition - but the formal LKMM does not > >> recognize this as a control dependency. > >> > >> Introduce a new definition which includes the requirement for the second > >> memory access event to syntactically lie within the arm of a non-loop > >> conditional. > >> > >> Link: https://lore.kernel.org/all/20220615114330.2573952-1-paul.heidekrueger@in.tum.de/ > >> Cc: Marco Elver > >> Cc: Charalampos Mainas > >> Cc: Pramod Bhatotia > >> Cc: Soham Chakraborty > >> Cc: Martin Fink > >> Signed-off-by: Paul Heidekr?ger > >> Co-developed-by: Alan Stern > > > > Hearing no objections, I reverted the old version and replaced it > > with this version. Thank you both! > > > > Thanx, Paul > > Oh, wait, there was further discussion [1, 2], and we finally agreed on [3]. > So [3] is the final version. > > I think me sending a v2 immediately after the v1 led to this out-of-order > discussion - sorry! My bad, and thank you for checking and letting me know! I have reverted to the proper state. Thanx, Paul > Many thanks, > Paul > > [1]: https://lore.kernel.org/all/663d568d-a343-d44b-d33d-29998bff8f70@joelfernandes.org/ > [2]: https://lore.kernel.org/all/D7E3D42D-2ABE-4D16-9DCA-0605F0C84F7D@in.tum.de/ > [3]: https://lore.kernel.org/all/20220903165718.4186763-1-paul.heidekrueger@in.tum.de/ > > > >> --- > >> > >> v2: > >> - Fix typos > >> - Fix indentation of code snippet > >> > >> v1: > >> @Alan, since I got it wrong the last time, I'm adding you as a co-developer after my > >> SOB. I'm sorry if this creates extra work on your side due to you having to > >> resubmit the patch now with your SOB if I understand correctly, but since it's > >> based on your wording from the other thread, I definitely wanted to give you > >> credit. > >> > >> tools/memory-model/Documentation/explanation.txt | 7 ++++--- > >> 1 file changed, 4 insertions(+), 3 deletions(-) > >> > >> diff --git a/tools/memory-model/Documentation/explanation.txt b/tools/memory-model/Documentation/explanation.txt > >> index ee819a402b69..0bca50cac5f4 100644 > >> --- a/tools/memory-model/Documentation/explanation.txt > >> +++ b/tools/memory-model/Documentation/explanation.txt > >> @@ -464,9 +464,10 @@ to address dependencies, since the address of a location accessed > >> through a pointer will depend on the value read earlier from that > >> pointer. > >> > >> -Finally, a read event and another memory access event are linked by a > >> -control dependency if the value obtained by the read affects whether > >> -the second event is executed at all. Simple example: > >> +Finally, a read event X and another memory access event Y are linked by > >> +a control dependency if Y syntactically lies within an arm of an if, > >> +else or switch statement and the condition guarding Y is either data or > >> +address-dependent on X. Simple example: > >> > >> int x, y; > >> > >> -- > >> 2.35.1 > >