haphazard icon indicating copy to clipboard operation
haphazard copied to clipboard

Use fastbarriers

Open ibraheemdev opened this issue 3 years ago • 11 comments

Implements the light/heavy barriers using membarrier.

ibraheemdev avatar Feb 27 '22 22:02 ibraheemdev

Can you rebase onto master?

jonhoo avatar Feb 28 '22 01:02 jonhoo

Codecov Report

Merging #25 (ed27d5b) into main (ba8ffcc) will not change coverage. The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main      #25   +/-   ##
=======================================
  Coverage   84.08%   84.08%           
=======================================
  Files           8        9    +1     
  Lines         817      817           
=======================================
  Hits          687      687           
  Misses        130      130           
Impacted Files Coverage Δ
src/lib.rs 30.37% <ø> (-3.36%) :arrow_down:
src/record.rs 100.00% <ø> (ø)
src/domain.rs 85.71% <100.00%> (ø)
src/hazard.rs 73.43% <100.00%> (ø)
src/sync.rs 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update ba8ffcc...ed27d5b. Read the comment docs.

codecov-commenter avatar Feb 28 '22 01:02 codecov-commenter

Oh, I just pushed a change that re-adds the Miri isolation to make debugging easier. But I suppose we may have to re-disable it for this :thinking:

jonhoo avatar Feb 28 '22 01:02 jonhoo

Hmmm, miri doesn't support the membarrier syscall. I guess it should just use a regular fence under cfg(miri) then?

ibraheemdev avatar Feb 28 '22 02:02 ibraheemdev

Ah, yes, let's do that instead! I'd rather keep Miri's isolation if we can :+1:

jonhoo avatar Feb 28 '22 02:02 jonhoo

It's arguably something that could be fixed in membarriers actually — consider Miri a platform that doesn't support other barrier types.

jonhoo avatar Feb 28 '22 02:02 jonhoo

Error: | = note: the thumbv7m-none-eabi target may not support the standard library = note: std is required by winapi because it does not declare #![no_std]

This is odd, because winapi is no_std :thinking:

ibraheemdev avatar Feb 28 '22 02:02 ibraheemdev

It seems membarrier is using an older winapi interface that presumably required std: https://github.com/jeehoonkang/membarrier-rs/issues/21. membarrier seems to be unmaintained... maybe we should just inline it? cc @jeehoonkang

ibraheemdev avatar Feb 28 '22 03:02 ibraheemdev

Hi! Thanks for your interest in the membarrier crate. I think I don't have enough bandwidth to address this issue myself, but I'm happy to accept PRs.

jeehoonkang avatar Mar 13 '22 14:03 jeehoonkang

This is an old thread, but I did submit a PR for the membarrier crate to update the windows api used. We can wait to see if it gets merged, or we can do what DataDog did and just have a membarrier.rs with the relevant code since it's pretty small and I believe the licenses are compatible.

Edit: PR has been merged into master! Is there anything stopping this from getting merged/is it worth merging?

Pesky01 avatar Mar 16 '23 21:03 Pesky01

That's awesome! I'd still like to see this land, and I believe the change is pretty much good as-is and would just need a rebase + an update to the version number listed in Cargo.toml to capture that change. @ibraheemdev you up for a quick touch-up of this PR?

jonhoo avatar Mar 18 '23 21:03 jonhoo