Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2385258rwl; Sat, 8 Apr 2023 13:50:18 -0700 (PDT) X-Google-Smtp-Source: AKy350YiT7xCDXp0WlEsEwJWug3QYD/GR2x1Kv+bgU5qJi8Bf0UnuEIAMps6C2Q+leNSRAghmR8n X-Received: by 2002:a17:906:f285:b0:932:4990:2563 with SMTP id gu5-20020a170906f28500b0093249902563mr2336729ejb.24.1680987018276; Sat, 08 Apr 2023 13:50:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680987018; cv=none; d=google.com; s=arc-20160816; b=dPH09LojAsM4+2Hn74vBKMmjO1avUk4o1yv/Vq8qlbmsrkL64fL4ebi91AUAwjOzr0 M6gwW5ztWdfWV44vw/VLgwLESEJCAlH6gjwL0TDKmgZc8HUnNU4pTO3MwNUB3oHG/YMM oTFdZv8Jo1wY2z0XzpTAjK878tDJxi395c1MKOleraHeB9iImH+ju9NJkJ3prBBa44JH M4U4YC1jl3+V96efsTxSTV6nz4+Xh+xeeBkyvZNx687Abg/F28B9IkKvl/ww+mx7itZT EBfljqr5xqkMmV0idpzeLKzykb8fHYqxXVomz8zXCRdeUXGb9sjujBXTe1qAf98cWink jUVw== 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:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=Ko87CvONxZsYNQyXoVNLolBE5TNK7D5o68pedwRt9jg=; b=N7bAmFoKo0fUccnqb6C56scttnL9Juf9aRaCuT+xe3cMaTIba5LQ55jN3f0AbUU4V1 0uKG1SbYkCihqqlNZ9hDO9Xzm1AjNoglFgF8CcUOtVzxoWS0B1bwSOyYauqjGtui2Wd2 A3CEle8INzQ5luwB7nkfDGhdGNJ8jLBqfuAhAUNmuePjEg4+PxZT/PASLGQQQ8LPtmtt ZRF6PvdYSCrQNZ9HoBxwtlVUlos+9Oy60u3XIPcCWI3HLvuMJLRQPPwmL/t3rYb5NFaz T+f9Fmfy6Q8xvu+CUnRDUf1F2Jn7UU+dL+6s+/FJnQGH7MM+JyrhDL9r5zvkaaKUIaih T14Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uhRYc+Y1; 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 rg7-20020a1709076b8700b0094a49e36f7esi1098660ejc.1026.2023.04.08.13.49.52; Sat, 08 Apr 2023 13:50:18 -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=uhRYc+Y1; 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 S229506AbjDHUYs (ORCPT + 99 others); Sat, 8 Apr 2023 16:24:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229446AbjDHUYr (ORCPT ); Sat, 8 Apr 2023 16:24:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C3756590; Sat, 8 Apr 2023 13:24:46 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 0683060AD9; Sat, 8 Apr 2023 20:24:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5E056C433D2; Sat, 8 Apr 2023 20:24:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1680985485; bh=X+Lf7s5dxpEFVCEJOEx1czjjlt29a/yatD+un/fJqAQ=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=uhRYc+Y1+hCW9P1CDcRKRgNiYNMBPENHY190qpXn5hSNIV3avW33kY7A/JOVoDtjl jx+pPKFznD35W5rf5tAjUq9WfZAZxj4XKdv22EubKZGZsW7+WxEJpJCZBz476aL6G6 bpUd9MxmSLu4Vc0F45dEy0lXcUd9x1Y5pQe55is1Baa2KvEf6tzPyUNPuGKOpaBKdp 6B892Za8Dza9s9v+wcTn1WNVtK8OE/o+Cp2115Vb3CRbTs/gy8BRcGV6X8fDIXbW29 tkY+DdPm2PSn50EDt7qGzD17IY936DCjSt08XivlQEK9DEefaYRiuaBi4KFtmbb9yg DmNIAsG5DW2jw== Received: by paulmck-ThinkPad-P72.home (Postfix, from userid 1000) id DF06615404B5; Sat, 8 Apr 2023 13:24:44 -0700 (PDT) Date: Sat, 8 Apr 2023 13:24:44 -0700 From: "Paul E. McKenney" To: Jonas Oberhauser Cc: Joel Fernandes , Alan Stern , linux-kernel@vger.kernel.org, Boqun Feng , Jade Alglave , Luc Maranget , Peter Zijlstra , Will Deacon , Akira Yokosawa , Andrea Parri , Daniel Lustig , David Howells , Jonas Oberhauser , linux-arch@vger.kernel.org, Nicholas Piggin , Paul =?iso-8859-1?Q?Heidekr=FCger?= , Will Deacon Subject: Re: Litmus test names Message-ID: Reply-To: paulmck@kernel.org References: <3908932E-17D4-4B87-AB0C-D10564F10623@joelfernandes.org> <159545c3-0093-3cbd-e822-7298ae764966@huaweicloud.com> <20230408164956.GA680332@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-5.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable 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, Apr 08, 2023 at 08:57:57PM +0200, Jonas Oberhauser wrote: > > On 4/8/2023 6:49 PM, Joel Fernandes wrote: > > On Fri, Apr 07, 2023 at 05:49:02PM -0700, Paul E. McKenney wrote: > > > On Fri, Apr 07, 2023 at 03:05:01PM +0200, Jonas Oberhauser wrote: > > > > > > > > On 4/7/2023 2:12 AM, Joel Fernandes wrote: > > > > > > > > > > > On Apr 6, 2023, at 6:34 PM, Paul E. McKenney wrote: > > > > > > > > > > > > On Thu, Apr 06, 2023 at 05:36:13PM -0400, Alan Stern wrote: > > > > > > > Paul: > > > > > > > > > > > > > > I just saw that two of the files in > > > > > > > tools/memory-model/litmus-tests have > > > > > > > almost identical names: > > > > > > > > > > > > > >  Z6.0+pooncelock+pooncelock+pombonce.litmus > > > > > > >  Z6.0+pooncelock+poonceLock+pombonce.litmus > > > > > > > > > > > > > > They differ only by a lower-case 'l' vs. a capital 'L'.  It's > > > > > > > not at all > > > > > > > easy to see, and won't play well in case-insensitive filesystems. > > > > > > > > > > > > > > Should one of them be renamed? > > > > > > > > FWIW, if I move that smp_mb_after..() a step lower, that also makes the test > > work (see below). > > > > If you may look over quickly my analysis of why this smp_mb_after..() is > > needed, it is because what I marked as a and d below don't have an hb > > relation right? > > I think a and d have an hb relation due to the > a ->po-rel X ->rfe Y ->acq-po d > edges (where X and Y are the unlock/lock events I annotated in your example > below). > > Generally, an mb_unlock_lock isn't used to give you hb, but to turn some > (coe/fre) ; hb* edges into pb edges > > In this case, that would probably be > f ->fre a ->hb* f   (where a ->hb* f comes from a ->hb* d ->hb e ->hb f) > By adding the mb_unlock_lock_po in one of the right places, this becomes f > ->pb f, > thus forbidden. Yes, it is forbidden, and even on purpose. ;-) But please don't do this in real life. Having that READ_ONCE(*y) be ordered differently on different architectures is not what those reading your code will want to deal with. Thanx, Paul > Have fun, > jonas > > > > > > (* > > b ->rf c > > > > d ->co e > > > > e ->hb f > > > > basically the issue is a ->po b ->rf c ->po d does not imply a ->hb d > > *) > > > > P0(int *x, int *y, spinlock_t *mylock) > > { > > spin_lock(mylock); > > WRITE_ONCE(*x, 1); // a > > WRITE_ONCE(*y, 1); // b > > spin_unlock(mylock); // X > > } > > > > P1(int *y, int *z, spinlock_t *mylock) > > { > > int r0; > > > > spin_lock(mylock); // Y > > r0 = READ_ONCE(*y); // c > > smp_mb__after_spinlock(); // moving this a bit lower also works fwiw. > > WRITE_ONCE(*z, 1); // d > > spin_unlock(mylock); > > } > > > > P2(int *x, int *z) > > { > > int r1; > > > > WRITE_ONCE(*z, 2); // e > > smp_mb(); > > r1 = READ_ONCE(*x); // f > > } > > > > exists (1:r0=1 /\ z=2 /\ 2:r1=0) > > > > > > > Would someone like to to a "git mv" send the resulting patch? > > Yes I can do that in return as I am thankful in advance for the above > > discussion. ;) > > > > thanks, > > > > - Joel > > >