[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230803032408.2514989-2-joel@joelfernandes.org>
Date: Thu, 3 Aug 2023 03:24:07 +0000
From: "Joel Fernandes (Google)" <joel@...lfernandes.org>
To: linux-kernel@...r.kernel.org, rcu@...r.kernel.org
Cc: "Joel Fernandes (Google)" <joel@...lfernandes.org>,
Alan Stern <stern@...land.harvard.edu>,
Andrea Parri <parri.andrea@...il.com>,
Will Deacon <will@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Boqun Feng <boqun.feng@...il.com>,
Nicholas Piggin <npiggin@...il.com>,
David Howells <dhowells@...hat.com>,
Jade Alglave <j.alglave@....ac.uk>,
Luc Maranget <luc.maranget@...ia.fr>,
"Paul E. McKenney" <paulmck@...nel.org>,
Akira Yokosawa <akiyks@...il.com>,
Daniel Lustig <dlustig@...dia.com>,
Jonathan Corbet <corbet@....net>
Subject: [PATCH 2/2] docs: memory-barriers: Add note on plain-accesses to address-dependency barriers
The compiler has the ability to cause misordering by destroying
address-dependency barriers if comparison operations are used. Add a
note about this to memory-barriers.txt and point to rcu-dereference.rst
for more information.
Signed-off-by: Joel Fernandes (Google) <joel@...lfernandes.org>
---
Documentation/memory-barriers.txt | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/Documentation/memory-barriers.txt b/Documentation/memory-barriers.txt
index 06e14efd8662..acc8ec5ce563 100644
--- a/Documentation/memory-barriers.txt
+++ b/Documentation/memory-barriers.txt
@@ -435,6 +435,11 @@ Memory barriers come in four basic varieties:
variables such as READ_ONCE() and rcu_dereference() provide implicit
address-dependency barriers.
+ [!] Note that address dependency barriers can be destroyed by comparison
+ of a pointer obtained by a marked accessor such as READ_ONCE() or
+ rcu_dereference() with some value. For an example of this, see
+ rcu_dereference.rst (part where the comparison of pointers is discussed).
+
(3) Read (or load) memory barriers.
A read barrier is an address-dependency barrier plus a guarantee that all
--
2.41.0.585.gd2178a4bd4-goog
Powered by blists - more mailing lists