[PATCH] D54889: Fiber support for thread sanitizer

Dmitry Vyukov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 2 06:22:29 PST 2019


dvyukov added a comment.

In D54889#1337669 <https://reviews.llvm.org/D54889#1337669>, @yuri wrote:

> In D54889#1334579 <https://reviews.llvm.org/D54889#1334579>, @dvyukov wrote:
>
> > > I added default synchronization and flag to opt-out.
> >
> > Can you swicth to it in your codebase? I would expect that you need all (or almost all) of this synchronization anyway?
>
>
> Unfortunately, I can't check it. Current implementation of our codebase work fine with synchronization on fiber switch.
>
> I plan to implement another mode when fibers are not synchronized by default, but only when they call special synchronization APIs (events, mutexes etc.). Such way I can catch more errors in code when fibers are running in the same thread only by chance. In order to implement it, I need some way to opt-out of synchronization in tsan.


Sorry, I meant to switch to the built-in synchronization to validate that it works in real projects and either removes the need in manual synchronization annotations or at least significantly reduces the need in manual annotations.



================
Comment at: lib/tsan/rtl/tsan_rtl.h:885
+void FiberDestroy(ThreadState *fiber, uptr pc);
+void FiberSwitch(ThreadState *fiber, unsigned flags, uptr pc);
+
----------------
yuri wrote:
> dvyukov wrote:
> > It seems it should be `SwtchFiberFlags flags`. Or why do we need SwtchFiberFlags?
> We can't use enum type of parameter because it is combination of bits. This is done the same way as enum MutexFlags in tsan_sync.h
Then I guess I am out of arguments because I wrote that code :)


Repository:
  rCRT Compiler Runtime

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D54889/new/

https://reviews.llvm.org/D54889





More information about the llvm-commits mailing list