Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1727697ybi; Sat, 27 Jul 2019 17:11:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqx7zU8pVmAY5r8Shb7oeMm683/KIe02F3wLr4G8khMz53xFJ/PdzFLT7HKrk9Cjlo6gJvlt X-Received: by 2002:a62:b515:: with SMTP id y21mr29969660pfe.213.1564272661407; Sat, 27 Jul 2019 17:11:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564272661; cv=none; d=google.com; s=arc-20160816; b=KYCnkSRy3vr4w86/vBtRB0jBcWLhHu9Xb3wWlMWY60LJ2UJ/xi3Dyyr4Evd73rbSJB 372v4cqjt2RHZHq7JfGfVgPKxzYN+kZnwFLGFQ3o+Yak9+dXcHDD1Qf06FgHagqUNvWJ w1F5bNHFmNXBnuTCUFmUhL3LdRxGwQKtfRpMkQVwkNFvuNmPmcf7xI56tuoHWKrLQVwf 78hE7Mhg+QntxpZUE3Wb6AgxT9ODXYQIWD1dZ5bN844A4UJzwrRxBgNKKBzTMkiTwVwD bMIzEasBuG/hy1D7P+x2RjGhqRn6P0+pBusKkx7LFjwHvFwM0GaeQvWvLkF2jVOLKfgU JtpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=5J+lD5ch8vXzDJuyJtECfbLzKiPriUkT07c6KSz94ZM=; b=kUH/txZqDYX9uS0KGXWlvDhqFhWRfrBwljq0Fo/OdHY1AWsaxt3lXVzTV1Ah03c77+ GPjHAZD2E/VxPcDLbQdqXItU/88f0h7+q1+7t9C60ujfFQKDSn0P2wEcuZzS3Q6SykZh uBkRc6PzaCj5pxYrxI1y8wgsFs6g80UVQBmbPkYYVPvUtNPMFqxNDnj9MGVeX7JT2a2b xibCEFXp6I4ISxiqUhwV/zm8mtbCT/Crxp98ze0yF7/tSWSsdSKW+6ywq0ey+sMCyzBM pqL07tz7bOp1DfPvZ/Ea4BFAIHMjZJsTBIlC+mvmqxrSQoLg1TELEaUTtrGTZqeK1UnA 7YcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=T2o1krj4; 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 x2si22815261pfi.163.2019.07.27.17.10.15; Sat, 27 Jul 2019 17:11:01 -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=T2o1krj4; 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 S1729017AbfG1AAs (ORCPT + 99 others); Sat, 27 Jul 2019 20:00:48 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:41060 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727363AbfG1AAs (ORCPT ); Sat, 27 Jul 2019 20:00:48 -0400 Received: by mail-pg1-f193.google.com with SMTP id x15so16094383pgg.8 for ; Sat, 27 Jul 2019 17:00:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=5J+lD5ch8vXzDJuyJtECfbLzKiPriUkT07c6KSz94ZM=; b=T2o1krj4j0LVp1ELAOPb3Xh8vljPGm838t4cE023O8kfUYUlIWvOPMl9I+iKUwIbsO 6hgWJDFBQ/5H0J/B+LwPJlcz+TAqoTzkiF4gdMAXBmxZohnCwJQi6BsgiPLQE5bz3+BJ S55Dn8azPOsOJ1FUVJUyKX1r++VF8Gtjo2FC8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=5J+lD5ch8vXzDJuyJtECfbLzKiPriUkT07c6KSz94ZM=; b=RMOuJDLUOuMU9xflS+dKAekBfuS4D+j1p9nRNUUBWDri3JQOiBKWPskGNM6ZQzEU2K B02f7d7V4vENoA9tXKGOMCG6SYeLlrNGDrBuZ4kiKWn8AglPOXk4vFca4son8WljF/ol PMe7aaYjlYDnoYmZG4DplINiZ4kqfrKvWBG7sMo5eFR2CQbv248B5jP3JCvwWmfBfgN4 Em88UUraiuPJr8Xjlyg7+0ZXC708tmBOD32ZM2aKyUzTq9q2mPXlLf9o0IfIBA3AE8pk p9YxRrBjhX+RHxek7P+gBHEUo9qxzQYkMn4FFduLuaDNGSNyf3aMZFouq8jnTIwHtxnF uOwA== X-Gm-Message-State: APjAAAWvmuE+Uf0h/btLZdtJ+gpRSbNWkGBr6DAKc4J63OSX1XmAocSB hoE1AQIB2rf84+Jj+7G54+Js/Ady X-Received: by 2002:a63:df06:: with SMTP id u6mr43778549pgg.96.1564272046916; Sat, 27 Jul 2019 17:00:46 -0700 (PDT) Received: from joelaf.cam.corp.google.com ([2620:15c:6:12:9c46:e0da:efbf:69cc]) by smtp.gmail.com with ESMTPSA id b36sm88051384pjc.16.2019.07.27.17.00.43 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sat, 27 Jul 2019 17:00:46 -0700 (PDT) From: "Joel Fernandes (Google)" To: linux-kernel@vger.kernel.org Cc: "Joel Fernandes (Google)" , Akira Yokosawa , Alan Stern , Andrea Parri , Boqun Feng , Daniel Lustig , David Howells , Jade Alglave , linux-arch@vger.kernel.org, Luc Maranget , Nicholas Piggin , "Paul E. McKenney" , Peter Zijlstra , Will Deacon Subject: [PATCH] docs/lkmm: Correct ->prop example with additional rfe link Date: Sat, 27 Jul 2019 20:00:31 -0400 Message-Id: <20190728000031.112364-1-joel@joelfernandes.org> X-Mailer: git-send-email 2.22.0.709.g102302147b-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This lkmm example 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 in P0 more clear. Signed-off-by: Joel Fernandes (Google) --- tools/memory-model/Documentation/explanation.txt | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/tools/memory-model/Documentation/explanation.txt b/tools/memory-model/Documentation/explanation.txt index 68caa9a976d0..6c0dfaac7f04 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: int x, y, z; @@ -1334,11 +1334,13 @@ 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 +load of y (rfe link), P2's smp_store_release() ensures that P2's load +of y executes before P2's store of z (second fence), which also would +imply that stores to x and y happen 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 does (A-cumulative property of this fence). +Finally P0's load executes after store to z has propagated to P0 (rfe link). In summary, the fact that the hb relation links memory access events in the order they execute means that it must not have cycles. This -- 2.22.0.709.g102302147b-goog