lkml.org 
[lkml]   [2023]   [Aug]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH 2/2] docs: memory-barriers: Add note on plain-accesses to address-dependency barriers
On Thu, Aug 03, 2023 at 03:24:07AM +0000, Joel Fernandes (Google) wrote:
> 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).

Hmmm...

Given that this is in a section marked "historical" (for the old
smp_read_barrier_depends() API), why not instead add a pointer to
Documentation/RCU/rcu_dereference.rst to the beginning of the section,
noted as the updated material?

Thanx, Paul

> +
> (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
>

\
 
 \ /
  Last update: 2023-08-03 20:52    [W:0.055 / U:1.576 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site