Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp5113250rwb; Tue, 17 Jan 2023 09:19:26 -0800 (PST) X-Google-Smtp-Source: AMrXdXutV7lhWzHpvgJ0ydlOI5rBdrNP5K2IelkfuqulbhuA3Iyt62OT8he4unG5bygopyf5RZmI X-Received: by 2002:a17:90b:3d8e:b0:228:ff8d:3 with SMTP id pq14-20020a17090b3d8e00b00228ff8d0003mr3957277pjb.15.1673975966577; Tue, 17 Jan 2023 09:19:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673975966; cv=none; d=google.com; s=arc-20160816; b=mzd5FCipLUiMOheXmicmApIZBdi/hXjjxUHsNCzZtHs1epLNAD3HQY1xP4DXRh0Ca6 DsvArtXk6eKFgja2uytM6eqZCMwv6UL2e+VHteHrA+yyOMAUOA5sVJoqg0f3xT06mRtw 1G1t0wUbJNgLqLgcJwTVua+2JB2vIhpNarADOA9EE1iG0YGO4XmL4bPi0FDJ8DqD2FaA 180h0ggow6FG1BPrlBYLzs0UXgPVoJXxX9GoWn5544EvTf+nkUQlt7VHN1X0ZlDBu0Gs cussJm03ysqwyIEdgmDuYHldrJ6woTDsQcNNG5X2FiIGCtpzfrUHx+5RSyl+gP95qqqm joYw== 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=EOkurDyRdrkGqdzepGnk3wdxHSidiA0mupQ1kwjs5LU=; b=lpjc1g2I4J1cty4Y9UxCmEf3vZrgXo5hezjR8COz7HQh7HAxQSuX2SkuP2t5cNnscH yKTRroDz0sL9vMi06VhBuGpqlSF0jvxSpCeihfY8bKEwCrt95462Kb4syrRzTuRjIqLs ylmGfZ+y0oeiDb27j36O8FPJQIVonMom6NSQ1IKOwdSmxw9wA6OSehmwM+ChV1YSDuXb quk8gdW95vgTv2GR6OSMCEtYXaIHf7XDTeqqAzI49ChPsTXaTkMtIYFr2al8S35KdUi2 0PNHxWxES6aneAmvYzOUPI6bb/PGRitM54jRainhrS5MA82F+nZLvX1rXiJCGBKFKNGv JKYw== 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 ot16-20020a17090b3b5000b002293e2400e1si13295324pjb.93.2023.01.17.09.19.20; Tue, 17 Jan 2023 09:19:26 -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; 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 S231207AbjAQP4j (ORCPT + 48 others); Tue, 17 Jan 2023 10:56:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230070AbjAQP4g (ORCPT ); Tue, 17 Jan 2023 10:56:36 -0500 Received: from netrider.rowland.org (netrider.rowland.org [192.131.102.5]) by lindbergh.monkeyblade.net (Postfix) with SMTP id 2E36A2B29C for ; Tue, 17 Jan 2023 07:56:34 -0800 (PST) Received: (qmail 169915 invoked by uid 1000); 17 Jan 2023 10:56:34 -0500 Date: Tue, 17 Jan 2023 10:56:34 -0500 From: Alan Stern To: "Paul E. McKenney" Cc: Andrea Parri , Jonas Oberhauser , Peter Zijlstra , 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: References: <20230115181052.GJ2948950@paulmck-ThinkPad-P17-Gen-1> <20230116042329.GN2948950@paulmck-ThinkPad-P17-Gen-1> <20230116190652.GZ2948950@paulmck-ThinkPad-P17-Gen-1> <20230116221357.GA2948950@paulmck-ThinkPad-P17-Gen-1> <20230117151416.GI2948950@paulmck-ThinkPad-P17-Gen-1> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230117151416.GI2948950@paulmck-ThinkPad-P17-Gen-1> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,SPF_HELO_PASS,SPF_PASS 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 Tue, Jan 17, 2023 at 07:14:16AM -0800, Paul E. McKenney wrote: > On Tue, Jan 17, 2023 at 12:46:28PM +0100, Andrea Parri wrote: > > This was reminiscent of old discussions, in fact, we do have: > > > > [tools/memory-model/Documentation/litmus-tests.txt] > > > > e. Although sleepable RCU (SRCU) is now modeled, there > > are some subtle differences between its semantics and > > those in the Linux kernel. For example, the kernel > > might interpret the following sequence as two partially > > overlapping SRCU read-side critical sections: > > > > 1 r1 = srcu_read_lock(&my_srcu); > > 2 do_something_1(); > > 3 r2 = srcu_read_lock(&my_srcu); > > 4 do_something_2(); > > 5 srcu_read_unlock(&my_srcu, r1); > > 6 do_something_3(); > > 7 srcu_read_unlock(&my_srcu, r2); > > > > In contrast, LKMM will interpret this as a nested pair of > > SRCU read-side critical sections, with the outer critical > > section spanning lines 1-7 and the inner critical section > > spanning lines 3-5. > > > > This difference would be more of a concern had anyone > > identified a reasonable use case for partially overlapping > > SRCU read-side critical sections. For more information > > on the trickiness of such overlapping, please see: > > https://paulmck.livejournal.com/40593.html > > Good point, if we do change the definition, we also need to update > this documentation. > > > More recently/related, > > > > https://lore.kernel.org/lkml/20220421230848.GA194034@paulmck-ThinkPad-P17-Gen-1/T/#m2a8701c7c377ccb27190a6679e58b0929b0b0ad9 > > It would not be a bad thing for LKMM to be able to show people the > error of their ways when they try non-nested partially overlapping SRCU > read-side critical sections. Or, should they find some valid use case, > to help them prove their point. ;-) Isn't it true that the current code will flag srcu-bad-nesting if a litmus test has non-nested overlapping SRCU read-side critical sections? And if it is true, is there any need to change the memory model at this point? (And if it's not true, that's most likely due to a bug in herd7.) Alan