[compiler-rt] r331163 - tsan: disable trace switching after multithreaded fork

Dmitry Vyukov via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 30 00:28:45 PDT 2018


Author: dvyukov
Date: Mon Apr 30 00:28:45 2018
New Revision: 331163

URL: http://llvm.org/viewvc/llvm-project?rev=331163&view=rev
Log:
tsan: disable trace switching after multithreaded fork

The problem is reported in:
https://github.com/google/sanitizers/issues/945

We already disable as much as possible after multithreaded fork,
trace switching is last place that can hang due to basic
operations (memory accesses, function calls).
Disable it too.


Modified:
    compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.cc
    compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.cc?rev=331163&r1=331162&r2=331163&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.cc (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.cc Mon Apr 30 00:28:45 2018
@@ -547,6 +547,10 @@ u32 CurrentStackId(ThreadState *thr, upt
 }
 
 void TraceSwitch(ThreadState *thr) {
+#if !SANITIZER_GO
+  if (ctx->after_multithreaded_fork)
+    return;
+#endif
   thr->nomalloc++;
   Trace *thr_trace = ThreadTrace(thr->tid);
   Lock l(&thr_trace->mtx);

Modified: compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h?rev=331163&r1=331162&r2=331163&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h (original)
+++ compiler-rt/trunk/lib/tsan/rtl/tsan_rtl.h Mon Apr 30 00:28:45 2018
@@ -520,7 +520,9 @@ struct Context {
   Context();
 
   bool initialized;
+#if !SANITIZER_GO
   bool after_multithreaded_fork;
+#endif
 
   MetaMap metamap;
 




More information about the llvm-commits mailing list