mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-17 01:34:00 +08:00
doc: De-emphasize smp_read_barrier_depends
This commit keeps only the historical and low-level discussion of smp_read_barrier_depends(). Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> [ paulmck: Adjusted to allow for David Howells feedback on prior commit. ]
This commit is contained in:
parent
98c1ec7cef
commit
9ad3c143d7
@ -581,7 +581,8 @@ This guarantee was only partially premeditated.
|
|||||||
DYNIX/ptx used an explicit memory barrier for publication, but had nothing
|
DYNIX/ptx used an explicit memory barrier for publication, but had nothing
|
||||||
resembling <tt>rcu_dereference()</tt> for subscription, nor did it
|
resembling <tt>rcu_dereference()</tt> for subscription, nor did it
|
||||||
have anything resembling the <tt>smp_read_barrier_depends()</tt>
|
have anything resembling the <tt>smp_read_barrier_depends()</tt>
|
||||||
that was later subsumed into <tt>rcu_dereference()</tt>.
|
that was later subsumed into <tt>rcu_dereference()</tt> and later
|
||||||
|
still into <tt>READ_ONCE()</tt>.
|
||||||
The need for these operations made itself known quite suddenly at a
|
The need for these operations made itself known quite suddenly at a
|
||||||
late-1990s meeting with the DEC Alpha architects, back in the days when
|
late-1990s meeting with the DEC Alpha architects, back in the days when
|
||||||
DEC was still a free-standing company.
|
DEC was still a free-standing company.
|
||||||
|
@ -122,11 +122,7 @@ o Be very careful about comparing pointers obtained from
|
|||||||
Note that if checks for being within an RCU read-side
|
Note that if checks for being within an RCU read-side
|
||||||
critical section are not required and the pointer is never
|
critical section are not required and the pointer is never
|
||||||
dereferenced, rcu_access_pointer() should be used in place
|
dereferenced, rcu_access_pointer() should be used in place
|
||||||
of rcu_dereference(). The rcu_access_pointer() primitive
|
of rcu_dereference().
|
||||||
does not require an enclosing read-side critical section,
|
|
||||||
and also omits the smp_read_barrier_depends() included in
|
|
||||||
rcu_dereference(), which in turn should provide a small
|
|
||||||
performance gain in some CPUs (e.g., the DEC Alpha).
|
|
||||||
|
|
||||||
o The comparison is against a pointer that references memory
|
o The comparison is against a pointer that references memory
|
||||||
that was initialized "a long time ago." The reason
|
that was initialized "a long time ago." The reason
|
||||||
|
@ -600,8 +600,7 @@ don't forget about them when submitting patches making use of RCU!]
|
|||||||
|
|
||||||
#define rcu_dereference(p) \
|
#define rcu_dereference(p) \
|
||||||
({ \
|
({ \
|
||||||
typeof(p) _________p1 = p; \
|
typeof(p) _________p1 = READ_ONCE(p); \
|
||||||
smp_read_barrier_depends(); \
|
|
||||||
(_________p1); \
|
(_________p1); \
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -220,8 +220,7 @@ before it writes the new tail pointer, which will erase the item.
|
|||||||
|
|
||||||
Note the use of READ_ONCE() and smp_load_acquire() to read the
|
Note the use of READ_ONCE() and smp_load_acquire() to read the
|
||||||
opposition index. This prevents the compiler from discarding and
|
opposition index. This prevents the compiler from discarding and
|
||||||
reloading its cached value - which some compilers will do across
|
reloading its cached value. This isn't strictly needed if you can
|
||||||
smp_read_barrier_depends(). This isn't strictly needed if you can
|
|
||||||
be sure that the opposition index will _only_ be used the once.
|
be sure that the opposition index will _only_ be used the once.
|
||||||
The smp_load_acquire() additionally forces the CPU to order against
|
The smp_load_acquire() additionally forces the CPU to order against
|
||||||
subsequent memory references. Similarly, smp_store_release() is used
|
subsequent memory references. Similarly, smp_store_release() is used
|
||||||
|
@ -1818,7 +1818,7 @@ The Linux kernel has eight basic CPU memory barriers:
|
|||||||
GENERAL mb() smp_mb()
|
GENERAL mb() smp_mb()
|
||||||
WRITE wmb() smp_wmb()
|
WRITE wmb() smp_wmb()
|
||||||
READ rmb() smp_rmb()
|
READ rmb() smp_rmb()
|
||||||
DATA DEPENDENCY read_barrier_depends() smp_read_barrier_depends()
|
DATA DEPENDENCY READ_ONCE()
|
||||||
|
|
||||||
|
|
||||||
All memory barriers except the data dependency barriers imply a compiler
|
All memory barriers except the data dependency barriers imply a compiler
|
||||||
@ -2867,7 +2867,10 @@ access depends on a read, not all do, so it may not be relied on.
|
|||||||
|
|
||||||
Other CPUs may also have split caches, but must coordinate between the various
|
Other CPUs may also have split caches, but must coordinate between the various
|
||||||
cachelets for normal memory accesses. The semantics of the Alpha removes the
|
cachelets for normal memory accesses. The semantics of the Alpha removes the
|
||||||
need for coordination in the absence of memory barriers.
|
need for hardware coordination in the absence of memory barriers, which
|
||||||
|
permitted Alpha to sport higher CPU clock rates back in the day. However,
|
||||||
|
please note that smp_read_barrier_depends() should not be used except in
|
||||||
|
Alpha arch-specific code and within the READ_ONCE() macro.
|
||||||
|
|
||||||
|
|
||||||
CACHE COHERENCY VS DMA
|
CACHE COHERENCY VS DMA
|
||||||
|
Loading…
Reference in New Issue
Block a user