This is an archive of the discontinued LLVM Phabricator instance.

[XRay] Add atomic fences around non-atomic reads and writes
ClosedPublic

Authored by dberris on Nov 8 2018, 9:02 PM.

Details

Summary

We need these fences to ensure that other threads attempting to read
bytes in the buffer will see thw writes committed before the extents are
updated. Without these, the writes can be un-committed by the time the
buffer extents counter is updated -- the fences should ensure that the
records written into the log have completed by the time we observe the
buffer extents from different threads.

Diff Detail

Repository
rL LLVM

Event Timeline

dberris created this revision.Nov 8 2018, 9:02 PM
mboerger accepted this revision.Nov 8 2018, 10:02 PM
This revision is now accepted and ready to land.Nov 8 2018, 10:02 PM
This revision was automatically updated to reflect the committed changes.

What is the point of this change? The atomic_fetch_add operations already use memory_order_acq_rel, so the explicit fences are redundant.

jfb added a comment.Nov 9 2018, 8:41 PM

What is the point of this change? The atomic_fetch_add operations already use memory_order_acq_rel, so the explicit fences are redundant.

Agreed, these are all redundant. Ideally the compiler just eliminates the fences, and your change was a no-op :-)