Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp5165581rwn; Mon, 12 Sep 2022 05:31:14 -0700 (PDT) X-Google-Smtp-Source: AA6agR4LWXpulsUjJ/fPBiUX/3rLJNNJvxe3mV5vg8nXevvucRn3hKwwARJjpFqxWr/uuQHvHFds X-Received: by 2002:aa7:8b52:0:b0:537:c6c7:3ef4 with SMTP id i18-20020aa78b52000000b00537c6c73ef4mr27299498pfd.48.1662985874599; Mon, 12 Sep 2022 05:31:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662985874; cv=none; d=google.com; s=arc-20160816; b=s54izXWovfMGpWPRy4mXpXVjwfrW7cH0rUH2OM1T9mEtP2JgTpZUnSojLQRTQzdG9w bWRYtVgfS9Reu/36IgLXp/cig2jFYzU1bjAYjNvH150yGKDvY/QP/mPU+Ll/yjm2igvp fG4Fi37fpVGT+dvJCEo5CHUailRc9FVbgnxxAy/PJ0Aicx3ZjwWxWIOCh6iIRIXgSCbR I9kjLo2TTrE8LWcOjw56ACb8YBzqFYlA+9sjPOdq4SdNS+8eYrZ/Da9/JChdIikgt5ml epoWWBWxZn5UnTVC9l7Z9zRvzJ/ThFbnvkA0GfSFuQqajBu16i7VhW2p2jIFfKvb8RDQ dOLQ== 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=G6L+wWHDljgDW+C14QIUDQ6k63BrGVozVhzWLGR8/eI=; b=bE05YxQym70I/cFdDzvXuC6/Dbzi+HbMsSbfpMl7UpzZNtu2lYNRX2oUK31I2fdS5q jr7MaFfgxmDsCm20Kn0EindQG7XXPl38CvbuCgqO+LZ4cfGX6t1uNAzGUj5YqRLbsVfz H5vbd5UGV4jRvaIF1Ja9pmcfQ4SqqlQbLzPooU0MOyeoj+Hp65L2TPi5G3IdyxkBEcFW cnLhsoPbrIamAN05yZYZ/xR8BqkQBuKFOmhFHY8CDGCk95INpIu5htwOW64Z+f/4zKpj tiERy18dVuzN7ktg2w3q8E09zEvkne2C2Ltolpj6woJArIA75//AgDvYC8lI/D2uXS4T afdg== 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 s12-20020a632c0c000000b00438f7762f93si3518144pgs.587.2022.09.12.05.30.55; Mon, 12 Sep 2022 05:31:14 -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 S229938AbiILMCI (ORCPT + 99 others); Mon, 12 Sep 2022 08:02:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229901AbiILMB2 (ORCPT ); Mon, 12 Sep 2022 08:01:28 -0400 Received: from netrider.rowland.org (netrider.rowland.org [192.131.102.5]) by lindbergh.monkeyblade.net (Postfix) with SMTP id D37322ED7C for ; Mon, 12 Sep 2022 05:01:05 -0700 (PDT) Received: (qmail 565827 invoked by uid 1000); 12 Sep 2022 08:01:03 -0400 Date: Mon, 12 Sep 2022 08:01:03 -0400 From: Alan Stern To: Jonas Oberhauser Cc: Joel Fernandes , Hernan Luis Ponce de Leon , Boqun Feng , Peter Zijlstra , "Paul E. McKenney" , "parri.andrea@gmail.com" , "will@kernel.org" , "npiggin@gmail.com" , "dhowells@redhat.com" , "j.alglave@ucl.ac.uk" , "luc.maranget@inria.fr" , "akiyks@gmail.com" , "dlustig@nvidia.com" , "linux-kernel@vger.kernel.org" , "linux-arch@vger.kernel.org" Subject: Re: "Verifying and Optimizing Compact NUMA-Aware Locks on Weak Memory Models" Message-ID: References: <674d0fda790d4650899e2fcf43894053@huawei.com> <34735a476c3b4913985de3403a6216bd@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <34735a476c3b4913985de3403a6216bd@huawei.com> 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, Sep 12, 2022 at 10:13:33AM +0000, Jonas Oberhauser wrote: > As I tried to explain before, this problem has nothing to do with > stores propagating within a given time to another core. Rather it is > due to two stores to the same location happening in a surprising > order. I.e., both stores propagate quickly to other cores, but in a > surprising coherence order.And if a wmb in the code is replaced by an > mb, then this co will create a pb cycle and become forbidden. > > Therefore this hang should be observable on a hypothetical LKMM > processor which makes use of all the relaxed liberty the LKMM allows. > However according to the authors of that paper (who are my colleagues > but I haven't been involved deeply in that work), not even Power+gcc > allow this reordering to happen, and if that's true it is probably > because the wmb is mapped to lwsync which is fully cumulative in Power > but not in LKMM. Yes, that's right. On ARM64 architectures the reordering is forbidden by other multi-copy atomicity, and on PPC is it forbidden by B-cumulativity (neither of which is part of the LKMM). If I'm not mistaken, another way to forbid it is to replace one of the relaxed atomic accesses with an atomic access having release semantics. Perhaps this change will find its way into the kernel source, since it has less overhead than replacing wmb with bm. Alan