Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't use atomic_thread_fence under TSAN #544

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

romasandu-gaijin
Copy link

@romasandu-gaijin romasandu-gaijin commented Sep 30, 2024

TSAN is one of the best tools for checking correctness of concurrent programs out there, but sadly, it does not support atomic_thread_fence and unlikely ever will.

But for good codegen on ARM we NEED atomic_thread_fence in shared_ptr. Hence, we need to selectively use it only when TSAN is disabled and fallback to an unconditional acq_rel operation where the ARM acquire fence will be performed even when we are not releaseing the last reference. This is pretty much equivalent semantically, but avoids false-positive TSAN reports.

Tackles #543.

TSAN is one of the best tools for checking correctness of
concurrent programs out there, but sadly, it does not support
atomic_thread_fence and unlikely ever will.

But for good codegen on ARM we NEED atomic_thread_fence in
shared_ptr. Hence, we need to selectively use it only when
TSAN is disabled and fallback to an unconditional acq_rel
operation where the ARM acquire fence will be performed even when
we are not releaseing the last reference. This is pretty much
equivalent semantically, but avoids false-positive TSAN reports.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant