Re: [v3,11/41] mips: reuse asm-generic/barrier.h

From
Leonid Yegoshin <hidden>
Date
2016-01-14 21:37:19
Also in
linux-arch, linux-arm-kernel, linux-mips, linux-s390, linux-sh, linux-um, linuxppc-dev, lkml, sparclinux
Reply to
Paul E. McKenney, 2016-01-14
On 01/14/2016 01:29 PM, Paul E. McKenney wrote:
quoted
On 01/14/2016 12:34 PM, Paul E. McKenney wrote:
quoted
The WRC+addr+addr is OK because data dependencies are not required to be
transitive, in other words, they are not required to flow from one CPU to
another without the help of an explicit memory barrier.
I don't see any reliable way to fit WRC+addr+addr into "DATA
DEPENDENCY BARRIERS" section recommendation to have data dependency
barrier between read of a shared pointer/index and read the shared
data based on that pointer. If you have this two reads, it doesn't
matter the rest of scenario, you should put the dependency barrier
in code anyway. If you don't do it in WRC+addr+addr scenario then
after years it can be easily changed to different scenario which
fits some of scenario in "DATA DEPENDENCY BARRIERS" section and
fails.
The trick is that lockless_dereference() contains an
smp_read_barrier_depends():

#define lockless_dereference(p) \
({ \
	typeof(p) _________p1 = READ_ONCE(p); \
	smp_read_barrier_depends(); /* Dependency order vs. p above. */ \
	(_________p1); \
})

Or am I missing your point?
WRC+addr+addr has no any barrier. lockless_dereference() has a barrier. I don't see a common points between this and that in your answer, sorry.

- Leonid.
Thread (15 messages) 15 messages, 6 authors, last reply 2016-01-27
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help