Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1631440pxb; Thu, 4 Mar 2021 17:00:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJxgBp6dgVQZzPlqv9SVy3G17qeLgcD9VsVBXxNsglMFjXKTUQ5QvgTeE73tpsPpTFgJGlrM X-Received: by 2002:a02:3846:: with SMTP id v6mr7172319jae.7.1614906016553; Thu, 04 Mar 2021 17:00:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614906016; cv=none; d=google.com; s=arc-20160816; b=fG8u0Y0NdUmzt59jgFSH4Tv3nxfxfx0v42fXNJ8uubvGXLXmXQIm3w/XVyr5T/q7ql IP1g2G84A6N2h4+GhXs+LICrmcjwaswfhHZbTvdOmux+2sXcXzMIgKy6diV8FK6XNz3A 7vslmdfxrGqbr3EQfg8fIesNPIDapLTDcaVFCNPho/0NbbZfZYmqP7gsrgLKLftKf8yC GyyZa9lJ9ZXGWyaxqfsafThgrP8hQmJdbxNzMhYAJzlQzwue2AGgHDRHmYf+RWabwIPx I5CEDvT/pYrBdLoKJjvHP4SQtmRBmZyPxAxn0fk21i07RUZwf7RwhFH6P+XJ9zpBNQG/ /8ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=kQdSrUDj9RnxLhNeTPcngCJUyhK5+F5OGLXbf3E2+OM=; b=Se75LLeSDpY5ItqI+hftTXulH9uEa9XW2vW7m6rtOWtJoJp9K8xRAdEwv4IELwV2wK K4KUE91E24iq9T+FRP4Q3w+8R08S+0vip9+xilXpQMwsKIsgmbdTErYFxw0yXLADQPJM SBBG/PjbnghygQiKq08GtHg1g8z47/pI+JTpwsui217RIjslcVmuyNgndSdXmrA3cHm5 RpUN/8dn6TDbo0vAfRHtbvoNDO2NLjgYX6kPaSB+thwqFxXsldENY1AKxgFY8bumihjP WgAKnCK/+Qeg/VZsGTAWXYkfJo+4KXRpkBfTqM6Z0ZszObjuZF03zvUsXzYZLWUP+dQn DS3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IGCHvZtM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n1si870136ioc.54.2021.03.04.17.00.03; Thu, 04 Mar 2021 17:00:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IGCHvZtM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S241350AbhCDWGV (ORCPT + 99 others); Thu, 4 Mar 2021 17:06:21 -0500 Received: from mail.kernel.org ([198.145.29.99]:51628 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241291AbhCDWGK (ORCPT ); Thu, 4 Mar 2021 17:06:10 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2AFE364FE4; Thu, 4 Mar 2021 22:05:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1614895530; bh=suBm0AczXfyXCs3/V7HzIWZ/odWc295qpMNQ8Wvt/jU=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=IGCHvZtMqr9FWLNaUf3U3CLqpuMkFZmqx9pzimcS24Un+XK1z+RP8IlHZI0VsCMsm UsADwtFH8pXcjSha+vSakj937JdgrFTpv5zE9AtP7h2wsRYIvkQk8uZpikyUQM2Wq5 A0yUX+fq102C4k5bBJ7nbnAguFaVyLg2d9U6fe+af2Da7ocP73VGWXDa7ItfJrmz6c uL9CCDbdtxUFAzmI/Gysu3q864E9Rkkee8PwaixZ1M0bX7uRz6u75pP+4eyfuvtOq1 /9dBNUamy3lW1n3aGHX+J5+ZneXzOGcHNbUTMMuOp0Wvf8VWl+jjpbfDAEP1EHJbMY wbFt1OgbApewg== Received: by paulmck-ThinkPad-P72.home (Postfix, from userid 1000) id EC2953522B62; Thu, 4 Mar 2021 14:05:29 -0800 (PST) Date: Thu, 4 Mar 2021 14:05:29 -0800 From: "Paul E. McKenney" To: Alan Stern Cc: =?iso-8859-1?Q?Bj=F6rn_T=F6pel?= , bpf , LKML , parri.andrea@gmail.com, Will Deacon , Peter Zijlstra , boqun.feng@gmail.com, npiggin@gmail.com, dhowells@redhat.com, j.alglave@ucl.ac.uk, luc.maranget@inria.fr, akiyks@gmail.com, dlustig@nvidia.com, joel@joelfernandes.org, Toke =?iso-8859-1?Q?H=F8iland-J=F8rgensen?= , "Karlsson, Magnus" Subject: Re: XDP socket rings, and LKMM litmus tests Message-ID: <20210304220529.GW2696@paulmck-ThinkPad-P72> Reply-To: paulmck@kernel.org References: <20210302235019.GT2696@paulmck-ThinkPad-P72> <20210303171221.GA1574518@rowland.harvard.edu> <20210303174022.GD2696@paulmck-ThinkPad-P72> <20210303202246.GC1582185@rowland.harvard.edu> <20210303220348.GL2696@paulmck-ThinkPad-P72> <20210304032101.GB1594980@rowland.harvard.edu> <20210304050407.GN2696@paulmck-ThinkPad-P72> <20210304153524.GA1612307@rowland.harvard.edu> <20210304190515.GS2696@paulmck-ThinkPad-P72> <20210304212753.GB14408@rowland.harvard.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210304212753.GB14408@rowland.harvard.edu> User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 04, 2021 at 04:27:53PM -0500, Alan Stern wrote: > On Thu, Mar 04, 2021 at 11:05:15AM -0800, Paul E. McKenney wrote: > > On Thu, Mar 04, 2021 at 10:35:24AM -0500, Alan Stern wrote: > > > On Wed, Mar 03, 2021 at 09:04:07PM -0800, Paul E. McKenney wrote: > > > > On Wed, Mar 03, 2021 at 10:21:01PM -0500, Alan Stern wrote: > > > > > On Wed, Mar 03, 2021 at 02:03:48PM -0800, Paul E. McKenney wrote: > > > > > > On Wed, Mar 03, 2021 at 03:22:46PM -0500, Alan Stern wrote: > > > > > > > > > > > And I cannot immediately think of a situation where > > > > > > > > this approach would break that would not result in a data race being > > > > > > > > flagged. Or is this yet another failure of my imagination? > > > > > > > > > > > > > > By definition, an access to a local variable cannot participate in a > > > > > > > data race because all such accesses are confined to a single thread. > > > > > > > > > > > > True, but its value might have come from a load from a shared variable. > > > > > > > > > > Then that load could have participated in a data race. But the store to > > > > > the local variable cannot. > > > > > > > > Agreed. My thought was that if the ordering from the initial (non-local) > > > > load mattered, then that initial load must have participated in a > > > > data race. Is that true, or am I failing to perceive some corner case? > > > > > > Ordering can matter even when no data race is involved. Just think > > > about how much of the memory model is concerned with ordering of > > > marked accesses, which don't participate in data races unless there is > > > a conflicting plain access somewhere. > > > > Fair point. Should I have instead said "then that initial load must > > have run concurrently with a store to that same variable"? > > I'm losing track of the point you were originally trying to make. > > Does ordering matter when there are no conflicting accesses? Sure. > Consider this: > > A: r1 = READ_ONCE(x); > B: WRITE_ONCE(y, r1); > smp_wmb(); > C: WRITE_ONCE(z, 1); > > Even if there are no other accesses to y at all (let alone any > conflicting ones), the mere existence of B forces A to be ordered before > C, and this is easily detectable by a litmus test. Given that herd7 treats all local variables as registers (including forbidding taking their addresses), and given that we are not thinking of treating local-variable accesses as if they were marked, this is likely all moot. But just in case... I was trying to figure out if there was a litmus test of the following form where it might make a difference if local-variable accesses were treated as if they were marked. So is there something like this: r1 = x; if (r1) WRITE_ONCE(y, 1); where implicitly treating the accesses to r1 as marked would make a difference. I was thinking that any such example would have to result in LKMM flagging the load from x as a data race. However, your example inserting the smp_wmb() does shed some doubt on that theory. This of course is moot unless we come back to treating local-variable accesses as if they were marked. Thanx, Paul