Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp2316759rwb; Sun, 15 Jan 2023 13:06:19 -0800 (PST) X-Google-Smtp-Source: AMrXdXv/za9UJFaVnpRgKHQOjTbsaVPv7sNHJl39lWAEqYDukIdDyFWU+hUDx84G6NT34GyB+8rA X-Received: by 2002:a05:6a20:7f41:b0:b8:653a:6376 with SMTP id e1-20020a056a207f4100b000b8653a6376mr3078546pzk.2.1673816779322; Sun, 15 Jan 2023 13:06:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673816779; cv=none; d=google.com; s=arc-20160816; b=EhZbaTA+rqUvn4M5FOW25mOcyc6m/Owzpd75c010wF2n9eFuvBYdVxHQx/pBID6DAL Eg196fNH1IIvjP2nZzTP4ZNdLVYUhXHrwui7EXeMUjxjHFe6yBUk424S6YPvwvn0ibl5 NjsdBKXRm8xPJthqpuisj9T68p51w8x0jrcSdxA+YOY+ewWN0t6USFasITglk/crftwO nWclcch2ph6WoGNA7r+LsxOxbWfm3g6tPMrr11Olqx4t12yGnr9o5Yttr0Jfkoq1rsp7 SJ03ecIjScXXTHAfGgyKBltFMBmQB0islJWk3iShGcZV/saIzgOUdOvFMAD9+rwitX/5 EV6Q== 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=nnpzbLs4LJ7drWQ3msf0mibZUz9MhCJNlTBFOhBUIvw=; b=mtDpw+YgjViCfftIwndHYS/8KFSRukBEXE2WQH4ZZNOx9OlUbdUUeOgEUVrywLa7en skAetNJm1PAZHyJ38zE2m+aJHh7sX3Q/KJBMfUAlJYkKdArP9gZEoOVX+joN5CHI4uJX zVVHJRvq/fjB4Yzf4oFe8GkYctMmomGeyN1UekhGcBr44V0EU5LmlBHv9ldWq10iovtm RQF9YhsZckdh3ULBJyOhEyyPwqPsteadeBkjXfEcvISK/JDv1azkRUHUfCU+m+glO4/y MSx9bPYwwZVv4RQXhGgIYYaWTFqS70HwjHuJNsCCJ6cqFCn1Xc48lZDi8Rw26XPnY9r4 1bRQ== 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 z22-20020a656116000000b004a804c6d77dsi29957782pgu.186.2023.01.15.13.06.11; Sun, 15 Jan 2023 13:06:19 -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 S231451AbjAOUqP (ORCPT + 52 others); Sun, 15 Jan 2023 15:46:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231346AbjAOUqM (ORCPT ); Sun, 15 Jan 2023 15:46:12 -0500 Received: from netrider.rowland.org (netrider.rowland.org [192.131.102.5]) by lindbergh.monkeyblade.net (Postfix) with SMTP id 8ED1D13503 for ; Sun, 15 Jan 2023 12:46:11 -0800 (PST) Received: (qmail 106827 invoked by uid 1000); 15 Jan 2023 15:46:10 -0500 Date: Sun, 15 Jan 2023 15:46:10 -0500 From: Alan Stern To: "Paul E. McKenney" 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: 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: <20230115181052.GJ2948950@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 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. > 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. Alan