Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp2690127rwb; Sun, 15 Jan 2023 20:40:47 -0800 (PST) X-Google-Smtp-Source: AMrXdXvfcxAWjGESw8Ydlodm8DzGqMuGX6Gr4lQhRjL/k8m5Hwqmr6nDEJpc+IiPhS4hRhFozdhW X-Received: by 2002:a17:906:8478:b0:84d:373b:39da with SMTP id hx24-20020a170906847800b0084d373b39damr27491252ejc.40.1673844047400; Sun, 15 Jan 2023 20:40:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673844047; cv=none; d=google.com; s=arc-20160816; b=u6tbGSSbuQE1vWvx/4akqNJLwXR1qB3z1QavMhsWP7iGDLWwSGSEuj7A20TVx3mf4X 3ZVrGLB2fKmkmvIBthBiP1eOx4AKIOumnfmEj1TO8ulD5dOkw0gL1g7nKeLAtrvblb8b ENw9LyW7Y8gIyt+GO/ZlSTCdq/pVIlNhELQ60JfOnnTuogKSDXb4mllCS0xXc6Bc/AZ9 ndQJGKbrCT2o9z/6SbFqxSrVGlQafDaUXBGebBBx/I2JWTdIkFtA7RlL22I4xjeIxxlh THVqg/oiGaHLL4vONPhcikgoPIDimnwzWeWZCpwiM66yizi4y9gFE6id6kUWMCcD/k9k gVFw== 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=Hh12JrNKv1BdxmWrANrpYtg0/U5WK8uFr4Yg8LrwrhU=; b=q9YzZFa57L6ZEae8wk75Oe6uDsOKAHnxZ/4IDuQqB5mXk4yN7j9REy74aQZj+3jIy7 SUwH4VG+gifaZEvpEnFxAJ6wyA7InoFOqVl4HPAv8ahY1oi9nbn7PO5YgZmE1f3pdVfZ wusyXZttJXOVu5OfcpYHToeNmyOxXGJGnxZC0rV2H9egqHOR8rpRCHRgDR04N76P3+sv nRcfEvDMRbLrKpQvhfJjdeEjyNcnxjCty6e/S68PNZedfHJIJ5vGfIRcRDJ8yaaofT7L 48HOC9sY8B05APtvLLudU3PX9esITkKL96V09CqFePEDNC/lPrK91T54Ucg2pxU930Cw nP6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AdBGaBot; 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 wy7-20020a170906fe0700b00787bacce740si6149027ejb.537.2023.01.15.20.40.35; Sun, 15 Jan 2023 20:40:47 -0800 (PST) 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=AdBGaBot; 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 S231824AbjAPEXq (ORCPT + 52 others); Sun, 15 Jan 2023 23:23:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231600AbjAPEXf (ORCPT ); Sun, 15 Jan 2023 23:23:35 -0500 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F06527287 for ; Sun, 15 Jan 2023 20:23:33 -0800 (PST) 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 sin.source.kernel.org (Postfix) with ESMTPS id 38727CE0E6D for ; Mon, 16 Jan 2023 04:23:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 40587C433F1; Mon, 16 Jan 2023 04:23:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673843010; bh=uBwOkwg1UCWxHI6qxy+Mb2Hb07Za0sTuWaXP/3A1mSo=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=AdBGaBotY6RfxcQGTYZTYZk26vYbZcEmOtClkzBY/v5X3SltTru6ceQoUrAxs4P+t 1Km1nH3QxAckZwmvY+OsFES4frQJ8NpaL94UcVwb/DVHfJZEH/XRu3R1optyS4GPbi vBwnYpcKDzFW6Q1eEjdCAzL+gFTUnrNmXkg4pKHvAb0Ylq7DZxFPgs5BN3eGwzGU66 WF0OFm4XezJzgpjUpZDDSfHfxlOsS1IvCtBWFAJNeF2du9Oz76OCQdIAWpUgZZP/7k dWIcqY2zWl8EaGq2awNPP7vfQKFshuQKRJxwZDQ97/Sfb0/Gb4QLf+ul0tlGJvYsgM lOnh4tRmxiogA== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id A07615C05A0; Sun, 15 Jan 2023 20:23:29 -0800 (PST) Date: Sun, 15 Jan 2023 20:23:29 -0800 From: "Paul E. McKenney" To: Alan Stern Cc: Jonas Oberhauser , Peter Zijlstra , "parri.andrea" , will , "boqun.feng" , npiggin , dhowells , "j.alglave" , "luc.maranget" , akiyks , dlustig , joel , urezki , quic_neeraju , frederic , Kernel development list Subject: Re: Internal vs. external barriers (was: Re: Interesting LKMM litmus test) Message-ID: <20230116042329.GN2948950@paulmck-ThinkPad-P17-Gen-1> Reply-To: paulmck@kernel.org References: <20230113200706.GI4028633@paulmck-ThinkPad-P17-Gen-1> <20230113203241.GA2958699@paulmck-ThinkPad-P17-Gen-1> <136d019d8c8049f6b737627df830e66f@huawei.com> <20230114175343.GF2948950@paulmck-ThinkPad-P17-Gen-1> <20230114181537.GA493203@paulmck-ThinkPad-P17-Gen-1> <20230115051510.GG2948950@paulmck-ThinkPad-P17-Gen-1> <20230115181052.GJ2948950@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 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 Sun, Jan 15, 2023 at 03:46:10PM -0500, Alan Stern wrote: > On Sun, Jan 15, 2023 at 10:10:52AM -0800, Paul E. McKenney wrote: > > On Sun, Jan 15, 2023 at 11:23:31AM -0500, Alan Stern wrote: > > > On Sat, Jan 14, 2023 at 09:15:10PM -0800, Paul E. McKenney wrote: > > > > What am I missing here? > > > > > > I don't think you're missing anything. This is a matter for Boqun or > > > Luc; it must have something to do with the way herd treats the > > > srcu_read_lock() and srcu_read_unlock() primitives. > > > > It looks like we need something that tracks (data | rf)* between > > the return value of srcu_read_lock() and the second parameter of > > srcu_read_unlock(). The reason for rf rather than rfi is the upcoming > > srcu_down_read() and srcu_up_read(). > > Or just make herd treat srcu_read_lock(s) as an annotated equivalent of > READ_ONCE(&s) and srcu_read_unlock(s, v) as an annotated equivalent of > WRITE_ONCE(s, v). But with some special accomodation to avoid > interaction with the new carry-dep relation. This is a modification to herd7 you are suggesting? Otherwise, I am suffering a failure of imagination on how to properly sort it from the other READ_ONCE() and WRITE_ONCE() instances. > > But what I will do in the meantime is to switch back to a commit that > > simply flags nesting of same-srcu_struct SRCU read-side critical sections, > > while blindly assuming that the return value of a given srcu_read_lock() > > is passed in to the corresponding srcu_read_unlock(): > > > > ------------------------------------------------------------------------ > > > > (* Compute matching pairs of Srcu-lock and Srcu-unlock, but prohibit nesting *) > > let srcu-unmatched = Srcu-lock | Srcu-unlock > > let srcu-unmatched-po = ([srcu-unmatched] ; po ; [srcu-unmatched]) & loc > > let srcu-unmatched-locks-to-unlock = ([Srcu-lock] ; po ; [Srcu-unlock]) & loc > > let srcu-rscs = srcu-unmatched-locks-to-unlock \ (srcu-unmatched-po ; srcu-unmatched-po) > > > > (* Validate nesting *) > > flag ~empty Srcu-lock \ domain(srcu-rscs) as unbalanced-srcu-locking > > flag ~empty Srcu-unlock \ range(srcu-rscs) as unbalanced-srcu-locking > > > > (* Check for use of synchronize_srcu() inside an RCU critical section *) > > flag ~empty rcu-rscs & (po ; [Sync-srcu] ; po) as invalid-sleep > > > > (* Validate SRCU dynamic match *) > > flag ~empty different-values(srcu-rscs) as srcu-bad-nesting > > > > ------------------------------------------------------------------------ > > > > Or is there some better intermediate position that could be taken? > > Do you mean go back to the current linux-kernel.bell? The code you > wrote above is different, since it prohibits nesting. Not to the current linux-kernel.bell, but, as you say, making the change to obtain a better approximation by prohibiting nesting. Thanx, Paul