summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2014-04-11 17:54:27 +0000
committerDmitry Vyukov <dvyukov@google.com>2014-04-11 17:54:27 +0000
commit51f5b5fd73f4779b8f75caa7ea787abc80a59db2 (patch)
treed675da7d3f0dc476597c5501b0d26c9552567f61
parent3bdcb52dd15639468f1b597b17c2a5addc0f8cb7 (diff)
downloadbcm5719-llvm-51f5b5fd73f4779b8f75caa7ea787abc80a59db2.tar.gz
bcm5719-llvm-51f5b5fd73f4779b8f75caa7ea787abc80a59db2.zip
tsan: serialize report printing in standalone deadlock detector
otherwise reports get intermixed llvm-svn: 206043
-rw-r--r--compiler-rt/lib/tsan/dd/dd_rtl.cc2
-rw-r--r--compiler-rt/lib/tsan/dd/dd_rtl.h1
2 files changed, 2 insertions, 1 deletions
diff --git a/compiler-rt/lib/tsan/dd/dd_rtl.cc b/compiler-rt/lib/tsan/dd/dd_rtl.cc
index 7f3c75e946b..729e79e8d35 100644
--- a/compiler-rt/lib/tsan/dd/dd_rtl.cc
+++ b/compiler-rt/lib/tsan/dd/dd_rtl.cc
@@ -39,6 +39,7 @@ static void PrintStackTrace(Thread *thr, u32 stk) {
static void ReportDeadlock(Thread *thr, DDReport *rep) {
if (rep == 0)
return;
+ BlockingMutexLock lock(&ctx->report_mutex);
Printf("==============================\n");
Printf("WARNING: lock-order-inversion (potential deadlock)\n");
for (int i = 0; i < rep->n; i++) {
@@ -52,7 +53,6 @@ static void ReportDeadlock(Thread *thr, DDReport *rep) {
}
}
Printf("==============================\n");
- Die();
}
Callback::Callback(Thread *thr)
diff --git a/compiler-rt/lib/tsan/dd/dd_rtl.h b/compiler-rt/lib/tsan/dd/dd_rtl.h
index 45d456e6615..ec777665d8f 100644
--- a/compiler-rt/lib/tsan/dd/dd_rtl.h
+++ b/compiler-rt/lib/tsan/dd/dd_rtl.h
@@ -44,6 +44,7 @@ typedef AddrHashMap<Mutex, 31051> MutexHashMap;
struct Context {
DDetector *dd;
+ BlockingMutex report_mutex;
MutexHashMap mutex_map;
};
OpenPOWER on IntegriCloud