mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Joel Fernandes (Google)" <joel@joelfernandes.org>
To: linux-kernel@vger.kernel.org, rcu@vger.kernel.org
Cc: "Joel Fernandes (Google)" <joel@joelfernandes.org>,
	Alan Stern <stern@rowland.harvard.edu>,
	Andrea Parri <parri.andrea@gmail.com>,
	Will Deacon <will@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Boqun Feng <boqun.feng@gmail.com>,
	Nicholas Piggin <npiggin@gmail.com>,
	David Howells <dhowells@redhat.com>,
	Jade Alglave <j.alglave@ucl.ac.uk>,
	Luc Maranget <luc.maranget@inria.fr>,
	"Paul E. McKenney" <paulmck@kernel.org>,
	Akira Yokosawa <akiyks@gmail.com>,
	Daniel Lustig <dlustig@nvidia.com>,
	Jonathan Corbet <corbet@lwn.net>
Subject: [PATCH 2/2] docs: memory-barriers: Add note on plain-accesses to address-dependency barriers
Date: Thu,  3 Aug 2023 03:24:07 +0000	[thread overview]
Message-ID: <20230803032408.2514989-2-joel@joelfernandes.org> (raw)
In-Reply-To: <20230803032408.2514989-1-joel@joelfernandes.org>

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@joelfernandes.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


  reply	other threads:[~2023-08-03  3:24 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-03  3:24 [PATCH 1/2] docs: rcu: Add cautionary note on plain-accesses to requirements Joel Fernandes (Google)
2023-08-03  3:24 ` Joel Fernandes (Google) [this message]
2023-08-03 18:52   ` [PATCH 2/2] docs: memory-barriers: Add note on plain-accesses to address-dependency barriers Paul E. McKenney
2023-08-04  5:11     ` Joel Fernandes
2023-08-04 13:52       ` Paul E. McKenney
2023-08-04 16:27         ` Joel Fernandes
2023-08-04 18:02           ` Paul E. McKenney
2023-08-03 12:08 ` [PATCH 1/2] docs: rcu: Add cautionary note on plain-accesses to requirements Alan Huang
2023-08-03 12:35   ` Joel Fernandes
2023-08-03 13:36     ` Alan Huang
2023-08-03 16:01       ` Joel Fernandes
2023-08-03 19:25         ` Alan Huang
2023-08-03 23:05           ` Joel Fernandes
2023-08-04 15:47             ` Alan Huang
2023-08-04 16:15               ` Joel Fernandes
2023-08-04  0:01           ` Paul E. McKenney
2023-08-04 12:33             ` Joel Fernandes
2023-08-04 14:00               ` Paul E. McKenney
2023-08-04 16:17                 ` Joel Fernandes
2023-08-04 17:02                   ` Paul E. McKenney
2023-08-04 16:33             ` Alan Huang
2023-08-04 17:27               ` Paul E. McKenney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230803032408.2514989-2-joel@joelfernandes.org \
    --to=joel@joelfernandes.org \
    --cc=akiyks@gmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=corbet@lwn.net \
    --cc=dhowells@redhat.com \
    --cc=dlustig@nvidia.com \
    --cc=j.alglave@ucl.ac.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luc.maranget@inria.fr \
    --cc=npiggin@gmail.com \
    --cc=parri.andrea@gmail.com \
    --cc=paulmck@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rcu@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®