summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cc
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2013-10-10 15:58:12 +0000
committerDmitry Vyukov <dvyukov@google.com>2013-10-10 15:58:12 +0000
commitfbb194ff34afe58bc1ba67c974c7a8afd658ff70 (patch)
tree5f552c67544a17d7cd5ca84cb9e90267aab0f74e /compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cc
parent9558af461d6c9df419e22254befb18cd80af06a3 (diff)
downloadbcm5719-llvm-fbb194ff34afe58bc1ba67c974c7a8afd658ff70.tar.gz
bcm5719-llvm-fbb194ff34afe58bc1ba67c974c7a8afd658ff70.zip
tsan: add annotations to ignore synchronization operations
The annotations are AnnotateIgnoreSyncBegin/End, may be useful to ignore some infrastructure synchronization that introduces lots of false negatives. llvm-svn: 192355
Diffstat (limited to 'compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cc')
-rw-r--r--compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cc20
1 files changed, 8 insertions, 12 deletions
diff --git a/compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cc b/compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cc
index 81e1b0a2acb..3ed1457ef1e 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cc
+++ b/compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cc
@@ -41,8 +41,7 @@ void ThreadContext::OnDead() {
void ThreadContext::OnJoined(void *arg) {
ThreadState *caller_thr = static_cast<ThreadState *>(arg);
- caller_thr->clock.acquire(&sync);
- StatInc(caller_thr, StatSyncAcquire);
+ AcquireImpl(caller_thr, 0, &sync);
sync.Reset();
}
@@ -59,10 +58,7 @@ void ThreadContext::OnCreated(void *arg) {
args->thr->fast_state.IncrementEpoch();
// Can't increment epoch w/o writing to the trace as well.
TraceAddEvent(args->thr, args->thr->fast_state, EventTypeMop, 0);
- args->thr->clock.set(args->thr->tid, args->thr->fast_state.epoch());
- args->thr->fast_synch_epoch = args->thr->fast_state.epoch();
- args->thr->clock.release(&sync);
- StatInc(args->thr, StatSyncRelease);
+ ReleaseImpl(args->thr, 0, &sync);
#ifdef TSAN_GO
creation_stack.ObtainCurrent(args->thr, args->pc);
#else
@@ -108,8 +104,7 @@ void ThreadContext::OnStarted(void *arg) {
#endif
thr = args->thr;
thr->fast_synch_epoch = epoch0;
- thr->clock.set(tid, epoch0);
- thr->clock.acquire(&sync);
+ AcquireImpl(thr, 0, &sync);
thr->fast_state.SetHistorySize(flags()->history_size);
const uptr trace = (epoch0 / kTracePartSize) % TraceParts();
Trace *thr_trace = ThreadTrace(thr->tid);
@@ -128,10 +123,7 @@ void ThreadContext::OnFinished() {
thr->fast_state.IncrementEpoch();
// Can't increment epoch w/o writing to the trace as well.
TraceAddEvent(thr, thr->fast_state, EventTypeMop, 0);
- thr->clock.set(thr->tid, thr->fast_state.epoch());
- thr->fast_synch_epoch = thr->fast_state.epoch();
- thr->clock.release(&sync);
- StatInc(thr, StatSyncRelease);
+ ReleaseImpl(thr, 0, &sync);
}
epoch1 = thr->fast_state.epoch();
@@ -170,6 +162,10 @@ static void ThreadCheckIgnore(ThreadState *thr) {
Printf("ThreadSanitizer: thread T%d finished with ignores enabled.\n",
thr->tid);
}
+ if (thr->ignore_sync) {
+ Printf("ThreadSanitizer: thread T%d finished with sync ignores enabled.\n",
+ thr->tid);
+ }
}
void ThreadFinalize(ThreadState *thr) {
OpenPOWER on IntegriCloud