Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp2407141ybi; Sun, 28 Jul 2019 08:22:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqxfM38w06krG0OKvL6o2Dee8lh5UIapSj0Dvx6hFZniYDmUfU5spnEGOFXUjZ0etignvhTa X-Received: by 2002:aa7:8383:: with SMTP id u3mr32189082pfm.175.1564327333864; Sun, 28 Jul 2019 08:22:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564327333; cv=none; d=google.com; s=arc-20160816; b=fXpmYF26LH+mv9uLO2A13b6iEs42svGSPIuBsiq4uq5/hgLsW5sPS/qVvrVUw4rfL0 ytxHaFbXlApLklqIBb8juRlVDSqCYSVrh8y44vNnpfOPb0BmkAGHaJ88/wU4dEdeU8cq 3xhtUD2NoEo1D6gj4T2DCBjbT7611OGDq4w3vkh9HetoWTN5h9UyOrbZfmwy7h764TwW PL83mUVBXGjsMnmLvZPUS1yax1cDaSLgxQ04rZptaJRHPS6CY/rUf9kCQ/k/R9vhKbUe juPyxntGn3DGE79VsiYYnDd0UoBOzm2rF+i+HvDzuNeiMeI6gwYuNSab/hUEILYKGCSF EOZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=a9skpT1sSwUqktDYaW2plKE+BXOaJldB9nBUVKcxchI=; b=DxcJPgLzDrTYqZsoBZ+2ZSXg9q9N1pBToobyfQ6nRFD+EhOt0+GyPLMJLuu7s2+bcO fTkHNmQIa+MPShdMkPPrnBwjZIV+DB+gpL/1iPcFPnDq6CQMt83z4hn7KJg4KD3fqnYM jtiH6ZdLXojcP5EROdBQgbYdOVTpCzDqshqa1oHjBLbSBz/H28c9Ll6VFKcyPoP7yIFr knr3E73/1nna/a8O7KS/1S3k0nI++ob6rLuS+2X9GVahx+/hiwE2dbm+CBcZxnfojbim 09aVhhB8lD5vD/NQuxMjpigjRuZCWaNMGix2eoVlok/lmfPqJuXV1W2pYC455TWI7VVp jE5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=hB60gM+N; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a13si22281153pgn.359.2019.07.28.08.21.57; Sun, 28 Jul 2019 08:22:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=hB60gM+N; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726174AbfG1PUD (ORCPT + 99 others); Sun, 28 Jul 2019 11:20:03 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:34332 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726046AbfG1PUD (ORCPT ); Sun, 28 Jul 2019 11:20:03 -0400 Received: by mail-pg1-f194.google.com with SMTP id n9so20736236pgc.1 for ; Sun, 28 Jul 2019 08:20:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=a9skpT1sSwUqktDYaW2plKE+BXOaJldB9nBUVKcxchI=; b=hB60gM+N+CFJTC1n8Gee1qgCMfzgrUBRv0DO6eaWEoUf3Fuemtg1gDGXZYGQBqe0SV 0I5yfm7NE6yetEcSHoo0B+Io+WNLOM/W3wBI55Y4XBwHKgWdEQowbXdJY5CLWtQLePPP +PnzM3apy7+eAtTcj3Tutt8hMsEpxtLRtRmtI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=a9skpT1sSwUqktDYaW2plKE+BXOaJldB9nBUVKcxchI=; b=tOHc6hauIW4CFTfIZd9go61y/bOfY6oGFJs0zwo/xXAHDrLt9UqvEO8Qv82DjM6NqL fZJzTbmCyEdOMjHlLaA9+DjJghBoSjcLaZDQqqYoji1zpwI+RWn8m5KypruFzUp4eUjL S7hU0udbjy5sgv+d/Z8WOFWq4Q7XzvDBGyWoMcdn1oedvrA/RiPKzvh1hcJIUyda0K3J 0FbcOEuxpWOqnK9hveg9d+klDaSlnshNujeS63736ji6OQVicW/H5QeEioC+AwoLGb/3 af5fwM/UXOzJ9eIJIOoKDatKooOi8IXDzflJFw+ND/8vhduAwYxte7X1jR0SPKYpDE3l p7sg== X-Gm-Message-State: APjAAAXcmtTktjzk9UX1eajyJD6nSJGF1gpXE3VdipzGicRDoJ6XEhNo lg9ATG7eE61RT+1vQG1F70I= X-Received: by 2002:a63:5550:: with SMTP id f16mr83867531pgm.426.1564327201663; Sun, 28 Jul 2019 08:20:01 -0700 (PDT) Received: from localhost ([2620:15c:6:12:9c46:e0da:efbf:69cc]) by smtp.gmail.com with ESMTPSA id w4sm77496264pfn.144.2019.07.28.08.20.00 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 28 Jul 2019 08:20:00 -0700 (PDT) Date: Sun, 28 Jul 2019 11:19:59 -0400 From: Joel Fernandes To: Alan Stern Cc: linux-kernel@vger.kernel.org, kernel-team@android.com, Boqun Feng , Akira Yokosawa , Andrea Parri , Daniel Lustig , David Howells , Ingo Molnar , Jade Alglave , linux-arch@vger.kernel.org, Luc Maranget , Nicholas Piggin , "Paul E. McKenney" , Peter Zijlstra , Will Deacon Subject: Re: [PATCH v2] lkmm/docs: Correct ->prop example with additional rfe link Message-ID: <20190728151959.GA82871@google.com> References: <20190728031303.164545-1-joel@joelfernandes.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jul 28, 2019 at 10:48:51AM -0400, Alan Stern wrote: > On Sat, 27 Jul 2019, Joel Fernandes (Google) wrote: > > > The lkmm example about ->prop relation should describe an additional rfe > > link between P1's store to y and P2's load of y, which should be > > critical to establishing the ordering resulting in the ->prop ordering > > on P0. IOW, there are 2 rfe links, not one. > > > > Correct these in the docs to make the ->prop ordering on P0 more clear. > > > > Cc: kernel-team@android.com > > Reviewed-by: Boqun Feng > > Signed-off-by: Joel Fernandes (Google) > > --- > > This is not a good update. See below... No problem, thanks for the feedback. I am new to the LKMM so please bear with me.. I should have tagged this RFC. > > .../memory-model/Documentation/explanation.txt | 17 ++++++++++------- > > 1 file changed, 10 insertions(+), 7 deletions(-) > > > > diff --git a/tools/memory-model/Documentation/explanation.txt b/tools/memory-model/Documentation/explanation.txt > > index 68caa9a976d0..aa84fce854cc 100644 > > --- a/tools/memory-model/Documentation/explanation.txt > > +++ b/tools/memory-model/Documentation/explanation.txt > > @@ -1302,8 +1302,8 @@ followed by an arbitrary number of cumul-fence links, ending with an > > rfe link. You can concoct more exotic examples, containing more than > > one fence, although this quickly leads to diminishing returns in terms > > of complexity. For instance, here's an example containing a coe link > > -followed by two fences and an rfe link, utilizing the fact that > > -release fences are A-cumulative: > > +followed by a fence, an rfe link, another fence and and a final rfe link, > ^---^ > > +utilizing the fact that release fences are A-cumulative: > > I don't like this, for two reasons. First is the repeated "and" typo. Will fix the trivial typo, sorry about that. > More importantly, it's not necessary to go into this level of detail; a > better revision would be: > > +followed by two cumul-fences and an rfe link, utilizing the fact that > > This is appropriate because the cumul-fence relation is defined to > contain the rfe link which you noticed wasn't mentioned explicitly. No, I am talking about the P1's store to Y and P2's load of Y. That is not through a cumul-fence so I don't understand what you meant? That _is_ missing the rfe link I am referring to, that is left out. The example says r2 = 1 and then we work backwards from that. r2 could very well have been 0, there's no fence or anything involved, it just happens to be the executation pattern causing r2 = 1 and hence the rfe link. Right? > > int x, y, z; > > > > @@ -1334,11 +1334,14 @@ If x = 2, r0 = 1, and r2 = 1 after this code runs then there is a prop > > link from P0's store to its load. This is because P0's store gets > > overwritten by P1's store since x = 2 at the end (a coe link), the > > smp_wmb() ensures that P1's store to x propagates to P2 before the > > -store to y does (the first fence), the store to y propagates to P2 > > -before P2's load and store execute, P2's smp_store_release() > > -guarantees that the stores to x and y both propagate to P0 before the > > -store to z does (the second fence), and P0's load executes after the > > -store to z has propagated to P0 (an rfe link). > > +store to y does (the first fence), P2's store to y happens before P2's > ---------------------------------------^ > > This makes no sense, since P2 doesn't store to y. You meant P1's store > to y. Also, the use of "happens before" is here unnecessarily > ambiguous (is it an informal usage or does it refer to the formal > happens-before relation?). The original "propagates to" is better. Will reword this. > > +load of y (rfe link), P2's smp_store_release() ensures that P2's load > > +of y executes before P2's store to z (second fence), which implies that > > +that stores to x and y propagate to P2 before the smp_store_release(), which > > +means that P2's smp_store_release() will propagate stores to x and y to all > > +CPUs before the store to z propagates (A-cumulative property of this fence). > > +Finally P0's load of z executes after P2's store to z has propagated to > > +P0 (rfe link). > > Again, a better change would be simply to replace the two instances of > "fence" in the original text with "cumul-fence". Ok that's fine. But I still feel the rfe is not a part of the cumul-fence. The fences have nothing to do with the rfe. Or, I am missing something quite badly. Boqun, did you understand what Alan is saying? thanks, - Joel