Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp3318086rwb; Fri, 20 Jan 2023 14:26:21 -0800 (PST) X-Google-Smtp-Source: AMrXdXuWnu7amlnoNR8iff+yyuAjH+PLewbEbKFjI7pmMu4s5TzxWcl/KS1hoBqs8SVhnyrl4tOf X-Received: by 2002:aa7:910c:0:b0:58d:a924:9ce with SMTP id 12-20020aa7910c000000b0058da92409cemr15920961pfh.7.1674253581110; Fri, 20 Jan 2023 14:26:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674253581; cv=none; d=google.com; s=arc-20160816; b=Gr9PZS8UKW4gVZKM6Ll4jxXS6V7O74z3ngEgbjZBvoRvfx/6SrexJiuUuDjD+3eHBl NParYBGMOseN8uEcYD45feJY0RWS3ZPqXEKNq0r49ZOiB82ZU1Z7YuaUy5bnaYlHJ3ob nYcnKjEW3uFgWlMnA1sqWVWEU1PglNTN7FTvq8LI3mvEFtxtZnUvTDgby/m1JG9Ybmu4 X34Zck8nHLEsZPu6aAsD9z3OC97bzJWY2lwpNwBYeM9R+YZqW7dcQbdOasIxKP/xuHeG qdDwxYun6AbvvM88LjFZXTEwp/uFRA6u5l3zH0gQ3+P+adZkPvUm1oIaDlvAFFiJlZWS JLFw== 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=vmZ2r6mDp0g/TQS51J4byhzVW+VtnLv44zWGZff9TLA=; b=QDQa/F6lnnotvzze/pd9a2PtsAuPZeoe+Rh1w/oUx56pgkfottxMeDUX68y93Jplg4 Xa1pGuamBZXXB73BCxradzCKQQsZr3rqHKtkLWrAbgM/N6qCAfchQxWyVd3vZI2G+pB9 OUwlLOdztMFsAYaY3zGYVNUvw/yLhGkuuJdmUJRE/iWDrnIBbGrQsC2PN2SNYSg1gk2u 4w+GgYr0GlEmcWCaWzE+he9+uT9PewB5u2ofJNYpDvpdGVi8Da4bUrPQ6G2RswBx8Euz 3yUk6fZ9xa4MV1dDwmVxJHzH8+m3d8iux22+ZIbdoj0fKz/vXVk8ACFKLwELJrfCOkBj uVKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IHDxRfui; 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 q6-20020a056a00088600b00572698b413esi45369833pfj.195.2023.01.20.14.26.14; Fri, 20 Jan 2023 14:26:21 -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=IHDxRfui; 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 S229501AbjATVhd (ORCPT + 52 others); Fri, 20 Jan 2023 16:37:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229379AbjATVhd (ORCPT ); Fri, 20 Jan 2023 16:37:33 -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 AFCA543914 for ; Fri, 20 Jan 2023 13:37:31 -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 DE4A6CE2AB6 for ; Fri, 20 Jan 2023 21:37:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE4F5C433EF; Fri, 20 Jan 2023 21:37:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674250648; bh=0DBSmP2vyNqu+oxytuTdeFsmN6xFvQcBg4PiuLnSEd8=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=IHDxRfuiZw/KNe5MEbpxwpw6kn57dkRVF0ZUgDRCs0kY7g5JaAy+dRMAI+J81c2BV bZHhoyvMERS68GIfJhuwzCGsiMSlg+KYzaG4/bF5HQzEPfSQa/QJlib7dlBKQyv5nv CJ7tq+BQW9C1sxogRGx2pgBUrlSboX6NJTuMzT1SzsbjhiZXyG1CVnUjZmrn7lOs1X x9RF1zEHOn+DFbo8lEkyT+HagjghNoURc61L1+zmnTMITMeIVc++kuh39JnJvFuqXD v3XKNladg7l4osnvH1y+rICs+ZhSqpg9gSca0HgrMbyZGxOhmxzXQD2jU4oa8Q+TtH ghvFP9YbMYIBg== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 81DF15C08A4; Fri, 20 Jan 2023 13:37:27 -0800 (PST) Date: Fri, 20 Jan 2023 13:37:27 -0800 From: "Paul E. McKenney" To: Jonas Oberhauser Cc: Alan Stern , 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: <20230120213727.GX2948950@paulmck-ThinkPad-P17-Gen-1> Reply-To: paulmck@kernel.org References: <20230118211201.GL2948950@paulmck-ThinkPad-P17-Gen-1> <09f084d2-6128-7f83-b2a5-cbe236b1678d@huaweicloud.com> <20230119001147.GN2948950@paulmck-ThinkPad-P17-Gen-1> <0fae983b-2a7c-d44e-8881-53d5cc053f09@huaweicloud.com> <20230119184107.GT2948950@paulmck-ThinkPad-P17-Gen-1> <20230119215304.GA2948950@paulmck-ThinkPad-P17-Gen-1> <20230120153909.GF2948950@paulmck-ThinkPad-P17-Gen-1> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit 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 Fri, Jan 20, 2023 at 09:46:55PM +0100, Jonas Oberhauser wrote: > > > On 1/20/2023 4:39 PM, Paul E. McKenney wrote: > > On Fri, Jan 20, 2023 at 10:43:10AM +0100, Jonas Oberhauser wrote: > > > > > I don't think Boqun's patch is hard to repair. > > > Besides the issue you mention, I think it's also missing Sync-srcu, which > > > seems to be linked by loc based on its first argument. > > > > > > How about something like this? > > > > > > let ALL-LOCKS = LKR | LKW | UL | LF | RU | Srcu-lock | Srcu-unlock | > > > Sync-srcu flag ~empty ~[ALL_LOCKS | IW] ; loc ; [ALL-LOCKS] as > > > mixed-lock-accesses > > > > > > If you're using something that isn't a lock or intial write on the same location as a lock, you get the flag. > > Wouldn't that unconditionally complain about the first srcu_read_lock() > > in a given process? Or am I misreading those statements? > > > > I unfolded the definition step by step and it seems I was careless when > distributing the ~ over the [] operator. > I should have written: > > flag ~empty [~(ALL_LOCKS | IW)] ; loc ; [ALL-LOCKS] as mixed-lock-accesses > > but somehow I thought I can save the parentheses by putting the ~ on the > outside. > Now on the off-chance that this is kind of how you already read the > relation, let me unfold it step-by-step. > > Let's assume that the sequence s of operations on this location is > ? s = initial write , (perhaps some gps) , first read lock , read > lock&unlock&gp ... > then the flag would appear if the specified relation isn't empty. That would > be the case if there are a and b that are linked by > > a ->[~(ALL_LOCKS | IW)] ; loc ; [ALL-LOCKS] b > > This means a is neither in ALL_LOCKS nor in IW, while b is ALL-LOCKS; and furthermore, they are equal to a' and b' resp. that are related by loc, i.e., appear in this sequence s. Thus both a and b are actually appearing both in the sequence s. > However, every event in the sequence s is either in ALL_LOCKS or in IW, which contradicts the assumption that a is in the sequence and in neither of the sets. Because of this contradiction, the flag doesn't appear if the sequence looks like this. > > More generally, if every event in the sequence is either the initial write or one of (srcu-) lock,unlock,up,down,sync, there won't be a flag. > > In contrast, if the sequence has the form > s' = initial write, (normal srcu events), some other acces x, (normal srcu events) > and y is one of the srcu events in this sequence, then > x ->[~(ALL_LOCKS | IW)] ; loc ; [ALL_LOCKS] y > and you get a flag. Thank you! When I get done messing with NMIs, I will give this a go. Just out of curiosity, are you sent up to run LKMM locally at your end? Thanx, Paul