Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp591561rwe; Fri, 26 Aug 2022 10:22:44 -0700 (PDT) X-Google-Smtp-Source: AA6agR7QpaH6Mgys2qWyJohKbXfnRqCeDWbtUYr837cgfuUnViAcj7xrwqSXmkLwRqqUNgjj8oM7 X-Received: by 2002:a17:907:6818:b0:731:e57:bf2c with SMTP id qz24-20020a170907681800b007310e57bf2cmr6323111ejc.61.1661534564160; Fri, 26 Aug 2022 10:22:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661534564; cv=none; d=google.com; s=arc-20160816; b=er9czO6QLs/gozhY1T75yGfw0iiI6Z3iYbXvgC//BjoRBNHeK1jCNIWSKxPkM0pQyC BaGvIH6zhstVjW/ZhCbPRowY6ihDatuvk50aUl4LCS0irTSxALK+nXZs115u+u8VJyOi b4ATUGUqSSabBKs4SlZIyw2RHUu3s9bPaYMJR1v3OhW8Ou3Iu+SjYIquGV4dXcjxfBNF jZQqqQmmUBh4XXLn+PTOEcFlw9IX5JECsT+LwXWYhrO1zPgjH4xjXihXhdGipGm+Qrqa QAhxRC2jjQRyaOvYLTvu4wg+1E2WWGNtwNUgP/z1xl1VCHfwDb1UTVAF18h1ZldHnWwe 8QpA== 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=1KY95sSYtl+cZ2dLIl9t+xUDY7HBgaWqtWgfoQo7Dh8=; b=b0kzNzFGFbx2M9OHWXZBiqS2GtLSnRmMcJQY4Bo8HQZqimVfjmGTzFgMZ5MLZ4xZQh 47uUSmvKWfSrz9vDBDMdW30JLkfwh9aNOEvgcqYljUkz9Let62Iz0lO4erXSVptESj9J cDl9EkRcuRV2NUpdOTIyiV6uU0sX3PJrClD9WQ8wFdsVgbwkquUR0zLiKbq+EPyrpuQ0 52AMfLffqCVTDDvcfCw3AgKsBWUa2euM3f4kHdN9OiXZWh6jrTxpyS2wTf3O8yiQQKLS S35TUXxAgimhEsl8wiB3BcHHOgrXPKc7DI2vF9IZEsC6lRaYr6fe3LKXhBhV6fzywUD9 oKOg== 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 n25-20020a170906089900b007312789a037si1412886eje.144.2022.08.26.10.22.17; Fri, 26 Aug 2022 10:22:44 -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 S235364AbiHZRKp (ORCPT + 99 others); Fri, 26 Aug 2022 13:10:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229717AbiHZRKm (ORCPT ); Fri, 26 Aug 2022 13:10:42 -0400 Received: from netrider.rowland.org (netrider.rowland.org [192.131.102.5]) by lindbergh.monkeyblade.net (Postfix) with SMTP id C8A018FD41 for ; Fri, 26 Aug 2022 10:10:40 -0700 (PDT) Received: (qmail 44494 invoked by uid 1000); 26 Aug 2022 13:10:39 -0400 Date: Fri, 26 Aug 2022 13:10:39 -0400 From: Alan Stern To: Peter Zijlstra Cc: "Paul E. McKenney" , parri.andrea@gmail.com, will@kernel.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, 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: <20220826124812.GA3007435@paulmck-ThinkPad-P17-Gen-1> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit 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, 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 Fri, Aug 26, 2022 at 06:23:24PM +0200, Peter Zijlstra wrote: > On Fri, Aug 26, 2022 at 05:48:12AM -0700, Paul E. McKenney wrote: > > Hello! > > > > I have not yet done more than glance at this one, but figured I should > > send it along sooner rather than later. > > > > "Verifying and Optimizing Compact NUMA-Aware Locks on Weak > > Memory Models", Antonio Paolillo, Hern?n Ponce-de-Le?n, Thomas > > Haas, Diogo Behrens, Rafael Chehab, Ming Fu, and Roland Meyer. > > https://arxiv.org/abs/2111.15240 > > > > The claim is that the queued spinlocks implementation with CNA violates > > LKMM but actually works on all architectures having a formal hardware > > memory model. > > > > Thoughts? > > So the paper mentions the following defects: > > - LKMM doesn't carry a release-acquire chain across a relaxed op That's right, although I'm not so sure this should be considered a defect... > - some babbling about a missing propagation -- ISTR Linux if stuffed > full of them, specifically we require stores to auto propagate > without help from barriers Not a missing propagation; a late one. Don't understand what you mean by "auto propagate without help from barriers". > - some handoff that is CNA specific and I've not looked too hard at > presently. > > > I think we should address that first one in LKMM, it seems very weird to > me a RmW would break the chain like that. An explicitly relaxed RMW (atomic_cmpxchg_relaxed(), to be precise). If the authors wanted to keep the release-acquire chain intact, why not use a cmpxchg version that has release semantics instead of going out of their way to use a relaxed version? To put it another way, RMW accesses and release-acquire accesses are unrelated concepts. You can have one without the other (in principle, anyway). So a relaxed RMW is just as capable of breaking a release-acquire chain as any other relaxed operation is. > Is there actual hardware that > doesn't behave? Not as far as I know, although that isn't very far. Certainly an other-multicopy-atomic architecture would make the litmus test succeed. But the LKMM does not require other-multicopy-atomicity. Alan