Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp1534054rwe; Sat, 27 Aug 2022 10:08:17 -0700 (PDT) X-Google-Smtp-Source: AA6agR491geJxzxhH4qqmujOMwHY6BnoTAp0DmUzvU9y7dflpQ4UPKbSpupdpFI0wu4QtHbHPBnk X-Received: by 2002:a17:906:6a0f:b0:730:df34:6ec4 with SMTP id qw15-20020a1709066a0f00b00730df346ec4mr8938269ejc.659.1661620097336; Sat, 27 Aug 2022 10:08:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661620097; cv=none; d=google.com; s=arc-20160816; b=aS2wykDJdqcxZRoyt595ZTxREMbjqfaUTdmUrWzjsgpWszBhqgS47tBd2UO5a7B+LP o8zgwBPK2VhO9vkAGMnlHnBDBewRt3y3UNYDrDOTk4SzRrSf90fVLIxzG+KHOGeTNQj5 4WYezgT7CvkbUE7jsbkz8aZ/cZRo2b+BPuSu1Kt/XOGbZZwiiTLiK3Em+NdfhDAwlOta dE+nE1Q7L6dXtNInScffp/w6lq3b/ABbhJUEYsA7aAKrfLoYKI4n/i6J3Ry0QAlxPOnF lwUdbloBJaKQpyC7Qyp+Amc7WbMlPMq+0eFMh0/ckfOeelRbkdW1MDhQ5Sx4sGDpkTF8 wjoA== 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:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=ta4/BgEguVS/FfocO9u6Nu+LRV9e0C+2N3Yw6siynkE=; b=ksMXkq20KI0RTGGvZtTEM3tdXL2qX29Feu+SRB25Dv2Ytv7leCToXAWrUE1ZU+Gwio Ri1pn3O6/0yYyEjiKK43w103k2vkCFPMv0A8iieMyHBSBmRX+3Is5f48Hx4s0I3d7ZrI vJ2rkItvnO2TuC7m1547JyUMjMjY6cOSWo1gLtjOn9DRbwye2ljT0k3MBCjH/1WaoDn3 70LCdt+33fPhgypOEt+jK0dGClMZK8UJctfmNC6XYi3vSGVKH3gfrse11k/8jQ1JnH2Q XP0aTQ4mwQH9zGPveux0Xhqk0n1xJxqbWOfkHjH7U0f5WlJT/DS1ZQUUk3+IpCQJdhIl VM0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=A2AkI5um; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gs6-20020a1709072d0600b0073da4a0f01csi4712356ejc.743.2022.08.27.10.07.51; Sat, 27 Aug 2022 10:08:17 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=A2AkI5um; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234086AbiH0REP (ORCPT + 99 others); Sat, 27 Aug 2022 13:04:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230024AbiH0REO (ORCPT ); Sat, 27 Aug 2022 13:04:14 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F922255AC; Sat, 27 Aug 2022 10:04:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CFC46B80966; Sat, 27 Aug 2022 17:04:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84600C433D6; Sat, 27 Aug 2022 17:04:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1661619850; bh=ifCIA4dNWh8Q4AzrrjoDnXchHg7H4+UCS/oi7vz+Mj8=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=A2AkI5um4s1GeoW+FJ+BIA4yYhOsndtFBlJhOGQNNzpVkOMtgpDh5yUQjPdd3zo2K dZ6reXlnM3iAa4sxqAUHqnz6K3ftoK/+Tm4v9N5OhaZXizDglY87hU2sEKnOkmctWm ROMs8pQ+Thxh/wXScne9SATahFytWcRdlYMWqsVdGsyNzg78m6jMYJPfk6Nzbm34LV YQnaDZUb7NrZzyPensUefrxvrCkuRJK9zDB2GOrMqmkF/z/mtwaeFhSpAO0Vnyomcy AtEpp3QDKRcHBNIqm98pI06jkMC6JRsgI0ccOCGxPgUkdkO8AcuO1ToV+rO0ESGazZ qa2NCXKzq3R0g== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 2A9635C03F3; Sat, 27 Aug 2022 10:04:10 -0700 (PDT) Date: Sat, 27 Aug 2022 10:04:10 -0700 From: "Paul E. McKenney" To: Alan Stern Cc: Peter Zijlstra , 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: <20220827170410.GG6159@paulmck-ThinkPad-P17-Gen-1> Reply-To: paulmck@kernel.org References: <20220826124812.GA3007435@paulmck-ThinkPad-P17-Gen-1> <20220826204219.GX6159@paulmck-ThinkPad-P17-Gen-1> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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, Aug 27, 2022 at 12:00:15PM -0400, Alan Stern wrote: > On Fri, Aug 26, 2022 at 01:42:19PM -0700, Paul E. McKenney wrote: > > On Fri, Aug 26, 2022 at 01:10:39PM -0400, Alan Stern wrote: > > > On Fri, Aug 26, 2022 at 06:23:24PM +0200, Peter Zijlstra wrote: > > > > 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. > > > > My first attempt with ppcmem suggests that powerpc does -not- behave > > this way. But that surprises me, just on general principles. Most likely > > I blew the litmus test shown below. > > > > Thoughts? > > The litmus test looks okay. > > As for your surprise, remember that PPC is B-cumulative, another > property which the LKMM does not require. B-cumulativity will also > force the original litmus test to succeed. (The situation is like ISA2 > in the infamous test6.pdf, except that y and z are separate variables in > ISA2 but are the same here. The RMW nature of lwarx/stwcx provides > the necessary R-W ordering in P1.) Got it, thank you! Thanx, Paul > > ------------------------------------------------------------------------ > > > > PPC MP+lwsyncs+atomic > > "LwSyncdWW Rfe LwSyncdRR Fre" > > Cycle=Rfe LwSyncdRR Fre LwSyncdWW > > { > > 0:r2=x; 0:r4=y; > > 1:r2=y; 1:r5=2; > > 2:r2=y; 2:r4=x; > > } > > P0 | P1 | P2 ; > > li r1,1 | lwarx r1,r0,r2 | lwz r1,0(r2) ; > > stw r1,0(r2) | stwcx. r5,r0,r2 | lwsync ; > > lwsync | | lwz r3,0(r4) ; > > li r3,1 | | ; > > stw r3,0(r4) | | ; > > exists (1:r1=1 /\ 2:r1=2 /\ 2:r3=0) > > > > ------------------------------------------------------------------------ > > > > $ ./ppcmem -model lwsync_read_block -model coherence_points MP+lwsyncs+atomic.litmus > > ... > > Test MP+lwsyncs+atomic Allowed > > States 9 > > 1:r1=0; 2:r1=0; 2:r3=0; > > 1:r1=0; 2:r1=0; 2:r3=1; > > 1:r1=0; 2:r1=1; 2:r3=1; > > 1:r1=0; 2:r1=2; 2:r3=0; > > 1:r1=0; 2:r1=2; 2:r3=1; > > 1:r1=1; 2:r1=0; 2:r3=0; > > 1:r1=1; 2:r1=0; 2:r3=1; > > 1:r1=1; 2:r1=1; 2:r3=1; > > 1:r1=1; 2:r1=2; 2:r3=1; > > No (allowed not found) > > Condition exists (1:r1=1 /\ 2:r1=2 /\ 2:r3=0) > > Hash=b7cec0e2ecbd1cb68fe500d6fe362f9c > > Observation MP+lwsyncs+atomic Never 0 9