[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160126172227.GG6357@twins.programming.kicks-ass.net>
Date: Tue, 26 Jan 2016 18:22:27 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Boqun Feng <boqun.feng@...il.com>
Cc: "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
Herbert Xu <herbert@...dor.apana.org.au>,
Leonid.Yegoshin@...tec.com, linux-mips@...ux-mips.org,
linux-ia64@...r.kernel.org, mst@...hat.com, will.deacon@....com,
virtualization@...ts.linux-foundation.org, hpa@...or.com,
sparclinux@...r.kernel.org, mingo@...nel.org,
linux-arch@...r.kernel.org, linux-s390@...r.kernel.org,
linux@....linux.org.uk,
user-mode-linux-devel@...ts.sourceforge.net,
linux-sh@...r.kernel.org, mpe@...erman.id.au, x86@...nel.org,
xen-devel@...ts.xenproject.org, mingo@...e.hu,
linux-xtensa@...ux-xtensa.org, james.hogan@...tec.com,
arnd@...db.de, stefano.stabellini@...citrix.com,
adi-buildroot-devel@...ts.sourceforge.net, ddaney.cavm@...il.com,
tglx@...utronix.de, linux-metag@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, andrew.cooper3@...rix.com,
linux-kernel@...r.kernel.org, ralf@...ux-mips.org, joe@...ches.com,
linuxppc-dev@...ts.ozlabs.org, davem@...emloft.net,
Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: [v3,11/41] mips: reuse asm-generic/barrier.h
On Wed, Jan 27, 2016 at 12:52:07AM +0800, Boqun Feng wrote:
> I recall that last time you and Linus came into a conclusion that even
> on Alpha, a barrier for read->write with data dependency is unnecessary:
>
> http://article.gmane.org/gmane.linux.kernel/2077661
>
> And in an earlier mail of that thread, Linus made his point that
> smp_read_barrier_depends() should only be used to order read->read.
>
> So right now, are we going to extend the semantics of
> smp_read_barrier_depends()? Can we just make smp_read_barrier_depends()
> still only work for read->read, and assume all the architectures won't
> reorder read->write with data dependency, so that the code above having
> a smp_rmb() also works?
That discussions was about control dependencies. So writes that _depend_
on a prior read having an explicit value.
So something like:
struct foo *x = READ_ONCE(*ptr);
smp_read_barrier_depends()
if (x->val == 5)
x->bar = 5;
In that case, the load of x->val must be complete and its value
determined _before_ the store to x->bar can happen.
This is distinct from:
struct foo *x = READ_ONCE(*ptr);
smp_read_barrier_depends();
x->bar = 5;
And its the second case where smp_read_barrier_depends() read->write
order matters.
Powered by blists - more mailing lists