Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp3264523rwn; Sat, 10 Sep 2022 08:11:14 -0700 (PDT) X-Google-Smtp-Source: AA6agR7utsTuSDnW8VULPDcEW3V5saurd/Pw7UKCzjq/AeqLWnCAf9b3bn0XcjnZeQRCTnksqgZK X-Received: by 2002:a17:907:743:b0:740:ef93:2ffc with SMTP id xc3-20020a170907074300b00740ef932ffcmr13678697ejb.514.1662822674683; Sat, 10 Sep 2022 08:11:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662822674; cv=none; d=google.com; s=arc-20160816; b=bEL1HxZJ6K0s8QSZFQznCl9EQu2VKfqzSvflbk5sK2TGsvZ/LxZmb0FFoPVJUQSAnJ g+QplVWcGCyqt1k6yrwhguSIXnhxCN1f1BthZCaU45OhcTEQIxJ95HT3kEsE7qzuOSru j8v7wWkfW6NQ6bB2ipndj0AoZzf4+mHsJ030gO82vVRKUhACAT7Raa/uffh8pEc2ERai 1O5LVjWKB78cu/V4RtACBdFX2063DdD5HWLeK2F6dLbhwlyPLDfNmgYljdnxoEG94MXk PtJ0M+4eFgi+GSYhZqfj0ymj55SUfiQBEuqpcJS2/tIqGFd66JwCIUiWSm9jI3tY5U9o ltJw== 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=yzVZbdZot4vYG3r23bKloXopIEdZAGZBwf0A/kYwVbU=; b=d9EAo/R5zJbvQ3jeijCOICYzxbC45NhYShnZrEZAGDmnTxREryjklpTLMBIjyFW6Iw sLKJN4j8OapoNXPP4Wn36SWffjUTQuDIrRSkIaQJVFVLFhE7gpoUTVuGII4IRq+prCr2 dUjbEn+KxzibACpS9+UlCOJohWfbLn1jStrjEJuLca9teuQJPmnMtomdALDrD6OWhZDr t7LJFHxx+G7Of9aO/v/1y36PEBxzbd9SHRIRSo9WwkYhFRpzDU7c058tlQQHi1w07m+P I5Kpo+6/IsNsAGwotOuO/U5IOhWdskUAXmrvRF9X/FlYt4PY0KJCq/F7epscO4lMH6i7 0ZWQ== 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 fj4-20020a1709069c8400b007799e328e10si3235843ejc.999.2022.09.10.08.10.48; Sat, 10 Sep 2022 08:11: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 S229521AbiIJPDf (ORCPT + 99 others); Sat, 10 Sep 2022 11:03:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229583AbiIJPDc (ORCPT ); Sat, 10 Sep 2022 11:03:32 -0400 Received: from netrider.rowland.org (netrider.rowland.org [192.131.102.5]) by lindbergh.monkeyblade.net (Postfix) with SMTP id 7F01F4661D for ; Sat, 10 Sep 2022 08:03:31 -0700 (PDT) Received: (qmail 520554 invoked by uid 1000); 10 Sep 2022 11:03:30 -0400 Date: Sat, 10 Sep 2022 11:03:30 -0400 From: Alan Stern To: Hernan Luis Ponce de Leon Cc: Jonas Oberhauser , 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" , "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> <674d0fda790d4650899e2fcf43894053@huawei.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, 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 Sat, Sep 10, 2022 at 12:11:36PM +0000, Hernan Luis Ponce de Leon wrote: > > What they mean seems to be that a prop relation followed only by wmb > (not mb) doesn't enforce the order of some writes to the same > location, leading to the claimed hang in qspinlock (at least as far as > LKMM is concerned). You were quoting Jonas here, right? The email doesn't make this obvious because it doesn't have two levels of "> > " markings. > What we mean is that wmb does not give the same propagation properties as mb. In general, _no_ two distinct relations in the LKMM have the same propagation properties. If wmb always behaved the same way as mb, we wouldn't use two separate words for them. > The claim is based on these relations from the memory model > > let strong-fence = mb | gp > ... > let cumul-fence = [Marked] ; (A-cumul(strong-fence | po-rel) | wmb | > po-unlock-lock-po) ; [Marked] > let prop = [Marked] ; (overwrite & ext)? ; cumul-fence* ; > [Marked] ; rfe? ; [Marked] Please be more specific. What difference between mb and wmb are you concerned about? Can you give a small litmus test that illustrates this difference? Can you explain in more detail how this difference affects the qspinlock implementation? > From an engineering perspective, I think the only issue is that cat > *currently* does not have any syntax for this, Syntax for what? The difference between wmb and mb? > nor does herd currently > implement the await model checking techniques proposed in those works > (c.f. Theorem 5.3. in the "making weak memory models fair" paper, > which says that for this kind of loop, iff the mo-maximal reads in > some graph are read in a loop iteration that does not exit the loop, > the loop can run forever). However GenMC and I believe also Dat3M and > recently also Nidhugg support such techniques. It may not even be too > much effort to implement something like this in herd if desired. I believe that herd has no way to express the idea of a program running forever. On the other hand, it's certainly true (in all of these models) than for any finite number N, there is a feasible execution in which a loop runs for more than N iterations before the termination condition eventually becomes true. Alan > The Dartagnan model checker uses the Theorem 5.3 from above to detect > liveness violations. > > We did not try to come up with a litmus test about the behavior > because herd7 cannot reason about liveness. > However, if anybody is interested, the violating execution is shown here > https://github.com/huawei-drc/cna-verification/blob/master/verification-output/BUG1.png > > Hernan