[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 20/25] docs: explain effect of smp_read_barrier_depends() on moder
From: |
Paolo Bonzini |
Subject: |
[PULL 20/25] docs: explain effect of smp_read_barrier_depends() on modern architectures |
Date: |
Fri, 21 Apr 2023 11:33:11 +0200 |
The documentation for smp_read_barrier_depends() does not mention the
architectures
for which it is an optimization, for example ARM and PPC. As a result, it is
not
clear to the reader why one would use it. Relegate Alpha to a footnote together
with other architectures where it is equivalent to smp_rmb().
Suggested-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
docs/devel/atomics.rst | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/docs/devel/atomics.rst b/docs/devel/atomics.rst
index 81ec26be1771..248076375bfe 100644
--- a/docs/devel/atomics.rst
+++ b/docs/devel/atomics.rst
@@ -220,10 +220,9 @@ They come in six kinds:
retrieves the address to which the second load will be directed),
the processor will guarantee that the first LOAD will appear to happen
before the second with respect to the other components of the system.
- However, this is not always true---for example, it was not true on
- Alpha processors. Whenever this kind of access happens to shared
- memory (that is not protected by a lock), a read barrier is needed,
- and ``smp_read_barrier_depends()`` can be used instead of ``smp_rmb()``.
+ Therefore, unlike ``smp_rmb()`` or ``qatomic_load_acquire()``,
+ ``smp_read_barrier_depends()`` can be just a compiler barrier on
+ weakly-ordered architectures such as Arm or PPC[#]_.
Note that the first load really has to have a _data_ dependency and not
a control dependency. If the address for the second load is dependent
@@ -231,6 +230,10 @@ They come in six kinds:
than actually loading the address itself, then it's a _control_
dependency and a full read barrier or better is required.
+.. [#] The DEC Alpha is an exception, because ``smp_read_barrier_depends()``
+ needs a processor barrier. On strongly-ordered architectures such
+ as x86 or s390, ``smp_rmb()`` and ``qatomic_load_acquire()`` can
+ also be compiler barriers only.
Memory barriers and ``qatomic_load_acquire``/``qatomic_store_release`` are
mostly used when a data structure has one thread that is always a writer
--
2.40.0
- [PULL 08/25] target/i386: Avoid unreachable variable declaration in mmu_translate(), (continued)
- [PULL 08/25] target/i386: Avoid unreachable variable declaration in mmu_translate(), Paolo Bonzini, 2023/04/21
- [PULL 11/25] target/mips: tcg: detect out-of-bounds accesses to cpu_gpr and cpu_gpr_hi, Paolo Bonzini, 2023/04/21
- [PULL 10/25] coverity: update COMPONENTS.md, Paolo Bonzini, 2023/04/21
- [PULL 13/25] io: mark mixed functions that can suspend, Paolo Bonzini, 2023/04/21
- [PULL 12/25] qapi-gen: mark coroutine QMP command functions as coroutine_fn, Paolo Bonzini, 2023/04/21
- [PULL 18/25] postcopy-ram: do not use qatomic_mb_read, Paolo Bonzini, 2023/04/21
- [PULL 14/25] migration: mark mixed functions that can suspend, Paolo Bonzini, 2023/04/21
- [PULL 15/25] monitor: mark mixed functions that can suspend, Paolo Bonzini, 2023/04/21
- [PULL 16/25] target/i386: Change wrong XFRM value in SGX CPUID leaf, Paolo Bonzini, 2023/04/21
- [PULL 17/25] block-backend: remove qatomic_mb_read(), Paolo Bonzini, 2023/04/21
- [PULL 20/25] docs: explain effect of smp_read_barrier_depends() on modern architectures,
Paolo Bonzini <=
- [PULL 21/25] nbd: a BlockExport always has a BlockBackend, Paolo Bonzini, 2023/04/21
- [PULL 23/25] configure: Honour cross-prefix when finding ObjC compiler, Paolo Bonzini, 2023/04/21
- [PULL 19/25] qemu-coroutine: remove qatomic_mb_read(), Paolo Bonzini, 2023/04/21
- [PULL 22/25] coverity: unify Fedora dockerfiles, Paolo Bonzini, 2023/04/21
- [PULL 25/25] tests: lcitool: Switch to OpenSUSE Leap 15.4, Paolo Bonzini, 2023/04/21
- [PULL 24/25] tests: libvirt-ci: Update to commit '2fa24dce8bc', Paolo Bonzini, 2023/04/21
- Re: [PULL 00/25] First batch of misc patches for QEMU 8.1, Richard Henderson, 2023/04/22