[concurrency-interest] Does StampedLock need a releaseFence in theory?

Andrew Haley aph at redhat.com
Fri Jul 15 03:52:00 EDT 2016


On 14/07/16 20:19, Hans Boehm wrote:

> I think Martin does have a point here that I missed the first time.
> The data stores are "control-dependent" on the store in the CAS
> implementation.  ARM and Power effectively preserve ordering between
> control-dependent stores, though not a store followed by a load. But
> we really only care about stores here.
> 
> At least that's probably true; I'm not 100% sure whether stlxr
> success is viewed as dependent on the store itself for purposes of
> determining ordering. (Will Deacon might be able to answer?)

I don't think it matters.  The code will always look like

    stlxr status, data, [addr]
    cbnz status, retry
    str r1, [data1]
    str r2, [data2]

The stores are control-dependent on the CBNZ: they cannot be
speculated before the STLXR.

Andrew.



More information about the Concurrency-interest mailing list