Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3046459iog; Mon, 27 Jun 2022 08:05:48 -0700 (PDT) X-Google-Smtp-Source: AGRyM1unmZpoLuSwuXhA2Kz1YvncX/8ctXEgVsEGjiobxBNJdlpuGfUbODQbB/dF88++lfYCqx4o X-Received: by 2002:a17:90b:194:b0:1ec:96dd:fef2 with SMTP id t20-20020a17090b019400b001ec96ddfef2mr15836690pjs.195.1656342348427; Mon, 27 Jun 2022 08:05:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656342348; cv=none; d=google.com; s=arc-20160816; b=PcRT4mMx3pHS60YNwz0TnqzkJq9tU3zLbkZZc5C3G8It13qIb5H2ON6Ol73xN42F+R XSX57zseiYlihC+f9PQCBbHrtnGjSYHMpwpuL6aQlYu7J2fs947PUvTLqFldQdVZehGq wfwy9oDqGpyLK/vzohxpZ7RvTD03CXQw+AJx+TEM4dpERbv+LDHNDBoLC5Yp1JqMCzu4 tgjNMq9dbWLuJHor/8tzner1okqPLxSqYHSOVCKaM6pXJy2ZvsivAz39b3j+aMmNGkj3 FTm7ocTkh7vYC3ohh1DRtpTdTult6fzMxK4ayZ6NKTcgwfMKbswWaP4prtCi29+Wiq/O xGwQ== 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:message-id:subject:cc :to:from:date; bh=hybMmpT/eILGs/wDiC0uzxDLFLEMikLR8J6xaza8djY=; b=OpQm/sKBMFomT/tLQQR7yMdEkDHE+sNyUWmBRJVkT7DQY6/crXIGD/bsLkLTazq0e1 oaqS2H2kejennsiOxGkv+YqyWjyW95JQtFP2dVlsgtQgpVbo1Dhm8fO0YrLkbKp3kxZF G2HFIsRWW+7R8b1QE3OUfBbFPi1Pc0SyKpvmWEDjvvj1AJQSvcvBezuVSV9hMA0J0vc1 v4d0OHGiwKzwSS3yAR8P+V68MMpPEC7w8EyUc3svn1DmNmxdgh9+nzYnJjnrB00P0zKQ ZNZjWYD/rZueYLnwmGozRKLclZReMttLRq2FK0ibnLN30UYfuOFMxyFKPqpv+X/DT03V ojjA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w15-20020a63d74f000000b00408bab1b61csi14449980pgi.673.2022.06.27.08.05.34; Mon, 27 Jun 2022 08:05:48 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235478AbiF0O4O (ORCPT + 99 others); Mon, 27 Jun 2022 10:56:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234416AbiF0O4L (ORCPT ); Mon, 27 Jun 2022 10:56:11 -0400 Received: from netrider.rowland.org (netrider.rowland.org [192.131.102.5]) by lindbergh.monkeyblade.net (Postfix) with SMTP id E804B167D2 for ; Mon, 27 Jun 2022 07:56:09 -0700 (PDT) Received: (qmail 121219 invoked by uid 1000); 27 Jun 2022 10:56:09 -0400 Date: Mon, 27 Jun 2022 10:56:09 -0400 From: Alan Stern To: Paul =?iso-8859-1?Q?Heidekr=FCger?= Cc: clang-built-linux , linux-toolchains@vger.kernel.org, Andrea Parri , Will Deacon , Peter Zijlstra , Boqun Feng , Nicholas Piggin , David Howells , Jade Alglave , Luc Maranget , "Paul E. McKenney" , Akira Yokosawa , Daniel Lustig , Joel Fernandes , Nathan Chancellor , Nick Desaulniers , Tom Rix , Palmer Dabbelt , LKML , linux-arch , Marco Elver , Charalampos Mainas , Pramod Bhatotia , Soham Chakraborty , Martin Fink Subject: Re: [PATCH RFC] tools/memory-model: Adjust ctrl dependency definition Message-ID: References: <20220615114330.2573952-1-paul.heidekrueger@in.tum.de> <50B9D7C1-B11D-4583-9814-BFFF2C80D8CA@in.tum.de> <04B4DBD6-1262-4905-9E85-9466FC104895@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: <04B4DBD6-1262-4905-9E85-9466FC104895@in.tum.de> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no 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, Jun 27, 2022 at 11:47:43AM +0200, Paul Heidekr?ger wrote: > > > On 21. Jun 2022, at 16:24, Alan Stern wrote: > > > > On Tue, Jun 21, 2022 at 01:59:27PM +0200, Paul Heidekr?ger wrote: > >> OK. So, LKMM limits the scope of control dependencies to its arm(s), hence > >> there is a control dependency from the last READ_ONCE() before the loop > >> exists to the WRITE_ONCE(). > >> > >> But then what about the following: > >> > >>> int *x, *y; > >>> > >>> int foo() > >>> { > >>> /* More code */ > >>> > >>> if(READ_ONCE(x)) > >>> return 42; > >>> > >>> /* More code */ > >>> > >>> WRITE_ONCE(y, 42); > >>> > >>> /* More code */ > >>> > >>> return 0; > >>> } > >> > >> The READ_ONCE() determines whether the WRITE_ONCE() will be executed at all, > >> but the WRITE_ONCE() doesn't lie in the if condition's arm. > > > > So in this case the LKMM would not recognize that there's a control > > dependency, even though it clearly exists. > > Oh, that's unfortunate. > > Then I would still argue that the "at all" definition is misleading. This I agree, and I would welcome a patch improving the definition. Perhaps something along the lines of what I wrote earlier in this email thread. > time in the other direction as I had initially proposed though, as the above > example is a case where "at all" holds true, but LKMM doesn't cover it. Or > do you think that caveating this in litmus-tests.txt, e.g. via the patch we > had recently worked out [1], is enough? No, the explanation should be improved. Alan