Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp2921787rwb; Fri, 20 Jan 2023 08:58:05 -0800 (PST) X-Google-Smtp-Source: AMrXdXsQHv5/PBF6Aq8USKQhpBTszT9U5EvX9rqSNeItqfE3HzNnnc3qHnCGvjKCR61sT5W+qF30 X-Received: by 2002:a17:907:c99c:b0:7c0:d6ba:c934 with SMTP id uj28-20020a170907c99c00b007c0d6bac934mr10183424ejc.13.1674233885391; Fri, 20 Jan 2023 08:58:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674233885; cv=none; d=google.com; s=arc-20160816; b=0fNZAS5JQ07ahektzPpX56zUF5xWJ+1Nx4m0QcZEG9xzBc4fyuWEqs3x9NzwH2p4Te zY8gMjdDCP0uhi6qV3gM4BpQvWzG3z3UeoPWtDlfKp8iF6C+YHJL+W8vA7PVKi5/GwFp JGIlUNBG6YVyyxKuab45T2tGGTHcu7KDuoMkQoJTlKvyz6FHzhkV1OESjCis/4EJRmYr vrl36fvU34ex6/iNsTj8KaJaDLlo5Yz1A2RcyW8UOsbMkSO8YIVxLbiqQ79v+0gAq6Zz 3Up9/kbi4LsbFtv66szSlKimnbq6reuwA8Rfn1sEvEjjVkTE/Z2JeTImIiolBk81kqZq 6KjQ== 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:message-id:subject:cc:to:from:date; bh=si4UyUQEQHLcUN9sF05qAt74zumXur2wHPk2QAKV/bI=; b=YMlhWeJjUQC6I74wUMFySBxNAlAvwDHv6z4FJOb4bI4m6mN5MguRp3O9XDVW6kD+Qb Glj0vMcNMCdYC/wj1qSztNjcKai+yEwrOO/6sQBtiaIbLme5Ycq5QXvyxU2eASTFh4Iy 7+WqArw8tHk2qmmyeWTofOMWnDcaqdNdeKE/RXul9xgyE0fgBSDIdds01Nf8gQpeS+RH kUlJcbTbowdCSNcJiUGyRFOrtiPd+PjeybitCSn8rG17H73SXbPeJ68MolaWQ8fpAeOG UlpIGNa7BlGlYPdgwF7qdlkdTxZktD0tpSaeeEeiceSU3Qj8j3aTTgn8qHfI/ahmlcWu GKsg== 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 hv13-20020a17090760cd00b0086652096f73si24209696ejc.193.2023.01.20.08.57.53; Fri, 20 Jan 2023 08:58:05 -0800 (PST) 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 S229744AbjATQeJ (ORCPT + 50 others); Fri, 20 Jan 2023 11:34:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229498AbjATQeI (ORCPT ); Fri, 20 Jan 2023 11:34:08 -0500 Received: from netrider.rowland.org (netrider.rowland.org [192.131.102.5]) by lindbergh.monkeyblade.net (Postfix) with SMTP id 0D0486C124 for ; Fri, 20 Jan 2023 08:33:38 -0800 (PST) Received: (qmail 38719 invoked by uid 1000); 20 Jan 2023 11:32:04 -0500 Date: Fri, 20 Jan 2023 11:32:04 -0500 From: Alan Stern To: Jonas Oberhauser Cc: Jonas Oberhauser , paulmck@kernel.org, parri.andrea@gmail.com, will@kernel.org, peterz@infradead.org, boqun.feng@gmail.com, npiggin@gmail.com, dhowells@redhat.com, j.alglave@ucl.ac.uk, luc.maranget@inria.fr, akiyks@gmail.com, dlustig@nvidia.com, joel@joelfernandes.org, urezki@gmail.com, quic_neeraju@quicinc.com, frederic@kernel.org, linux-kernel@vger.kernel.org, viktor@mpi-sws.org Subject: Re: [PATCH] tools/memory-model: Make ppo a subrelation of po Message-ID: References: <20230117193159.22816-1-jonas.oberhauser@huaweicloud.com> <75c74fe1-a846-aed8-c00c-45deeb1cfdda@huaweicloud.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,SPF_HELO_PASS,SPF_PASS 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 Fri, Jan 20, 2023 at 12:12:50PM +0100, Jonas Oberhauser wrote: > > > On 1/19/2023 9:06 PM, Alan Stern wrote: > > That's backward logic. Being strong isn't the reason the fences are > > A-cumulative. Indeed, the model could have been written not to assume > > that strong fences are A-cumulative. > > It's not just the model, it's also how strong fences are introduced in the > documentation. The documentation can be updated. > I agree though that you could decouple the notion of strong from > A-cumulativity. > But would anyone want a strong fence that is not A-cumulative? Why would anyone want a weak fence that isn't A-cumulative? :-) Architecture designers sometimes do strange things... > It's a bit like asking in C11 for a barrier that has the sequential > consistency guarantee of appearing in the global order S, but doesn't have > release or acquire semantics. Yes you could define that, but would it really > make sense? You're still missing the point. The important aspect of the fences in cumul-fence is that they are A-cumulative, not whether they are strong. You're fixating on an irrelevancy. > > This may be so, but I would like to point out that the memory model was > > not particularly designed to be as short or as simple as possible, but > > more to reflect transparently the intuitions that kernel programmers > > have about the ways ordering should work in the kernel. It may very > > well include redundancies as a result. I don't think that's a bad > > point. > > I agree that sometimes redundancies have value. But I think having, where > possible, a kind of minimal responsibility principle where each fence > appears in as few relations as possible also has value. > I've seen that when I try to help people in my team learn to use LKMM: they > see a specific type of fence and get stuck for a while chasing one of its > uses. For example, they may chase a long prop link using the only strong > fence in the example somewhere in the middle, which will then later turn out > to be a dead-end because what they need to use is pb. People who make that particular mistake should take a lesson from it: The presence of a strong fence should point them toward looking for an application of pb before looking at prop, because pb is is based on the special properties of strong fences whereas prop is not. > For someone who doesn't know that we never need to rely on that use to get > ordering, it basically doubles the amount of time spent looking at the graph > and chasing definitions. And for very good reasons there already are alot of > definitions even when redundancies are eliminated. IMO, people who try to use the memory model this way need to develop a good understanding of it first. (Although perhaps carrying out these sorts of exercises is _how_ people develop their understanding...) I don't regard it as a bad thing that by making a mistake through pursuing a redundant pathway, people can deepen their understanding. That's how one learns. > Perhaps I would say that including these redundancies is good for > understanding why the formalization makes sense, but excluding them is > better for actually using the formalization. > This includes both when looking at code while having a printout of the model > next to you, but also when trying to reason about LKMM itself (e.g., what > one might do when changes are made to LKMM and one wants to check that they > interact well with the existing parts of LKMM). Not necessarily so. You might _want_ a change to affect one of the redundant paths but not the other. > I think in the long term, increasing the usability is more important than > the obvious correctness. But maybe I'm biased because I'm mostly on the user > side of LKMM :D No doubt I'm guilty of having my own set of biases... Alan