[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160118081929.GA30420@gondor.apana.org.au>
Date: Mon, 18 Jan 2016 16:19:29 +0800
From: Herbert Xu <herbert@...dor.apana.org.au>
To: paulmck@...ux.vnet.ibm.com
Cc: Leonid.Yegoshin@...tec.com, linux-mips@...ux-mips.org,
linux-ia64@...r.kernel.org, mst@...hat.com, peterz@...radead.org,
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
Paul E. McKenney <paulmck@...ux.vnet.ibm.com> wrote:
>
> You could use SYNC_ACQUIRE() to implement read_barrier_depends() and
> smp_read_barrier_depends(), but SYNC_RMB probably does not suffice.
> The reason for this is that smp_read_barrier_depends() must order the
> pointer load against any subsequent read or write through a dereference
> of that pointer. For example:
>
> p = READ_ONCE(gp);
> smp_rmb();
> r1 = p->a; /* ordered by smp_rmb(). */
> p->b = 42; /* NOT ordered by smp_rmb(), BUG!!! */
> r2 = x; /* ordered by smp_rmb(), but doesn't need to be. */
>
> In contrast:
>
> p = READ_ONCE(gp);
> smp_read_barrier_depends();
> r1 = p->a; /* ordered by smp_read_barrier_depends(). */
> p->b = 42; /* ordered by smp_read_barrier_depends(). */
> r2 = x; /* not ordered by smp_read_barrier_depends(), which is OK. */
>
> Again, if your hardware maintains local ordering for address
> and data dependencies, you can have read_barrier_depends() and
> smp_read_barrier_depends() be no-ops like they are for most
> architectures.
>
> Does that help?
This is crazy! smp_rmb started out being strictly stronger than
smp_read_barrier_depends, when did this stop being the case?
--
Email: Herbert Xu <herbert@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Powered by blists - more mailing lists