Re: [RFC PATCH v2] memory-barriers: remove smp_mb__after_unlock_lock()

From: Benjamin Herrenschmidt
Date: Mon Jul 13 2015 - 18:38:12 EST


On Mon, 2015-07-13 at 17:54 +0200, Peter Zijlstra wrote:

> That said, I don't think this could even happen on PPC because we have
> load_acquire and store_release, this means that:
>
> *A = a
> lwsync
> store_release M
> load_acquire N
> lwsync
> *B = b
>
> And since the store to M is wrapped inside two lwsync there must be
> strong store order, and because the load from N is equally wrapped in
> two lwsyncs there must also be strong load order.
>
> In fact, no store/load can cross from before the first lwsync to after
> the latter and the other way around.
>
> So in that respect it does provide full load-store ordering. What it
> does not provide is order for M and N, nor does it provide transitivity,
> but looking at our documentation I'm not at all sure we guarantee that
> in any case.

The problem is if you have a load after the second lwsync, that load can
go up pass the store release. This has caused issues when N or M is what
you are trying to order against. That's why we had to add a sync to
spin_is_locked or similar.

Ben.

>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/