This is an archive of the discontinued LLVM Phabricator instance.

tsan: don't print __tsan_atomic* functions in report stacks
ClosedPublic

Authored by dvyukov on Jul 28 2021, 8:07 AM.

Details

Summary

Currently tsan_atomic* functions do FuncEntry/Exit using caller PC
and then use current PC (pointing to
tsan_atomic* itself) during
memory access handling. As the result the top function in reports
involving atomics is __tsan_atomic* and the next frame points to user code.

Remove FuncEntry/Exit in atomic functions and use caller PC
during memory access handling. This removes __tsan_atomic*
from the top of report stacks, so that they point right to user code.

The motivation for this is performance.
Some atomic operations are very hot (mostly loads),
so removing FuncEntry/Exit is beneficial.
This also reduces thread trace consumption (1 event instead of 3).

tsan_atomic* at the top of the stack is not necessary
and does not add any new information. We already say
"atomic write of size 4", "
tsan_atomic32_store" does not add
anything new.

It also makes reports consistent between atomic and non-atomic
accesses. For normal accesses we say "previous write" and point
to user code; for atomics we say "previous atomic write" and now
also point to user code.

Diff Detail

Event Timeline

dvyukov created this revision.Jul 28 2021, 8:07 AM
dvyukov requested review of this revision.Jul 28 2021, 8:07 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 28 2021, 8:07 AM
Herald added a subscriber: Restricted Project. · View Herald Transcript
vitalybuka accepted this revision.Jul 28 2021, 10:50 AM
vitalybuka added inline comments.
compiler-rt/lib/tsan/rtl/tsan_interface_atomic.cpp
488–494

SCOPED part is misleading now.

This revision is now accepted and ready to land.Jul 28 2021, 10:50 AM
dvyukov updated this revision to Diff 362477.Jul 28 2021, 11:32 AM

renamed SCOPED_ATOMIC to ATOMIC_IMPL

compiler-rt/lib/tsan/rtl/tsan_interface_atomic.cpp
488–494

renamed SCOPED_ATOMIC to ATOMIC_IMPL
(and removed /**/)

This revision was landed with ongoing or failed builds.Jul 28 2021, 11:34 AM
This revision was automatically updated to reflect the committed changes.