| /freebsd/contrib/llvm-project/compiler-rt/lib/tsan/rtl/ |
| H A D | tsan_rtl_mutex.cpp | 25 void ReportDeadlock(ThreadState *thr, uptr pc, DDReport *r); 26 void ReportDestroyLocked(ThreadState *thr, uptr pc, uptr addr, 30 ThreadState *thr; member 33 Callback(ThreadState *thr, uptr pc) in Callback() 34 : thr(thr) in Callback() 36 DDCallback::pt = thr->proc()->dd_pt; in Callback() 37 DDCallback::lt = thr->dd_lt; in Callback() 40 StackID Unwind() override { return CurrentStackId(thr, pc); } in Unwind() 41 int UniqueTid() override { return thr->tid; } in UniqueTid() 44 void DDMutexInit(ThreadState *thr, uptr pc, SyncVar *s) { in DDMutexInit() argument [all …]
|
| H A D | tsan_rtl_thread.cpp | 24 ThreadContext::ThreadContext(Tid tid) : ThreadContextBase(tid), thr(), sync() {} in ThreadContext() 74 static void ThreadCheckIgnore(ThreadState *thr) { in ThreadCheckIgnore() argument 77 if (thr->ignore_reads_and_writes) in ThreadCheckIgnore() 78 ReportIgnoresEnabled(thr->tctx, &thr->mop_ignore_set); in ThreadCheckIgnore() 79 if (thr->ignore_sync) in ThreadCheckIgnore() 80 ReportIgnoresEnabled(thr->tctx, &thr->sync_ignore_set); in ThreadCheckIgnore() 83 static void ThreadCheckIgnore(ThreadState *thr) {} in ThreadCheckIgnore() argument 86 void ThreadFinalize(ThreadState *thr) { in ThreadFinalize() argument 87 ThreadCheckIgnore(thr); in ThreadFinalize() 89 if (!ShouldReport(thr, ReportTypeThreadLeak)) in ThreadFinalize() [all …]
|
| H A D | tsan_fd.cpp | 56 static FdSync *allocsync(ThreadState *thr, uptr pc) { in allocsync() argument 57 FdSync *s = (FdSync*)user_alloc_internal(thr, pc, sizeof(FdSync), in allocsync() 69 static void unref(ThreadState *thr, uptr pc, FdSync *s) { in unref() argument 75 user_free(thr, pc, s, false); in unref() 80 static FdDesc *fddesc(ThreadState *thr, uptr pc, int fd) { in fddesc() argument 88 void *p = user_alloc_internal(thr, pc, size, kDefaultAlignment, false); in fddesc() 90 MemoryResetRange(thr, (uptr)&fddesc, (uptr)p, size); in fddesc() 94 user_free(thr, pc, p, false); in fddesc() 101 static void init(ThreadState *thr, uptr pc, int fd, FdSync *s, in init() argument 103 FdDesc *d = fddesc(thr, pc, fd); in init() [all …]
|
| H A D | tsan_rtl.h | 117 ThreadState *thr; // currently wired thread, or nullptr member 146 ThreadState *thr; member 245 void set_cur_thread(ThreadState *thr); 255 ThreadState *thr = reinterpret_cast<ThreadState *>(cur_thread_placeholder); in cur_thread_init() local 256 if (UNLIKELY(!thr->current)) in cur_thread_init() 257 thr->current = thr; in cur_thread_init() 258 return thr->current; in cur_thread_init() 260 inline void set_cur_thread(ThreadState *thr) { in set_cur_thread() argument 261 reinterpret_cast<ThreadState *>(cur_thread_placeholder)->current = thr; in set_cur_thread() 271 ThreadState *thr; variable [all …]
|
| H A D | tsan_rtl.cpp | 80 static TracePart* TracePartAlloc(ThreadState* thr) { in TracePartAlloc() argument 85 Trace* trace = &thr->tctx->trace; in TracePartAlloc() 89 DPrintf("#%d: TracePartAlloc: part=%p\n", thr->tid, part); in TracePartAlloc() 152 bool attached = tctx->thr && tctx->thr->slot; in DoResetImpl() 172 &tctx->thr->trace_pos, in DoResetImpl() 181 if (tctx->thr && !tctx->thr->slot) { in DoResetImpl() 182 atomic_store_relaxed(&tctx->thr->trace_pos, 0); in DoResetImpl() 183 tctx->thr->trace_prev_pc = 0; in DoResetImpl() 196 slot.thr = nullptr; in DoResetImpl() 233 void DoReset(ThreadState* thr, uptr epoch) SANITIZER_NO_THREAD_SAFETY_ANALYSIS { in DoReset() argument [all …]
|
| H A D | tsan_mman.cpp | 90 ThreadState *thr = cur_thread(); in ScopedGlobalProcessor() local 91 if (thr->proc()) in ScopedGlobalProcessor() 108 ProcWire(gp->proc, thr); in ScopedGlobalProcessor() 113 ThreadState *thr = cur_thread(); in ~ScopedGlobalProcessor() local 114 if (thr->proc() != gp->proc) in ~ScopedGlobalProcessor() 116 ProcUnwire(gp->proc, thr); in ~ScopedGlobalProcessor() 177 static void SignalUnsafeCall(ThreadState *thr, uptr pc) { in SignalUnsafeCall() argument 178 if (atomic_load_relaxed(&thr->in_signal_handler) == 0 || in SignalUnsafeCall() 179 !ShouldReport(thr, ReportTypeSignalUnsafe)) in SignalUnsafeCall() 182 ObtainCurrentStack(thr, pc, &stack); in SignalUnsafeCall() [all …]
|
| H A D | tsan_interceptors_posix.cpp | 185 void EnterBlockingFunc(ThreadState *thr) { in EnterBlockingFunc() argument 191 atomic_store(&thr->in_blocking_func, 1, memory_order_relaxed); in EnterBlockingFunc() 192 if (atomic_load(&thr->pending_signals, memory_order_relaxed) == 0) in EnterBlockingFunc() 194 atomic_store(&thr->in_blocking_func, 0, memory_order_relaxed); in EnterBlockingFunc() 195 ProcessPendingSignals(thr); in EnterBlockingFunc() 267 static ThreadSignalContext *SigCtx(ThreadState *thr) { in SigCtx() argument 270 uptr ctx = atomic_load(&thr->signal_ctx, memory_order_relaxed); in SigCtx() 271 if (ctx == 0 && !thr->is_dead) { in SigCtx() 274 MemoryResetRange(thr, (uptr)&SigCtx, pctx, sizeof(ThreadSignalContext)); in SigCtx() 275 if (atomic_compare_exchange_strong(&thr->signal_ctx, &ctx, pctx, in SigCtx() [all …]
|
| H A D | tsan_rtl_access.cpp | 18 ALWAYS_INLINE USED bool TryTraceMemoryAccess(ThreadState* thr, uptr pc, in TryTraceMemoryAccess() argument 25 if (UNLIKELY(!TraceAcquire(thr, &ev))) in TryTraceMemoryAccess() 28 uptr pc_delta = pc - thr->trace_prev_pc + (1 << (EventAccess::kPCBits - 1)); in TryTraceMemoryAccess() 29 thr->trace_prev_pc = pc; in TryTraceMemoryAccess() 38 TraceRelease(thr, ev); in TryTraceMemoryAccess() 52 TraceRelease(thr, evex); in TryTraceMemoryAccess() 57 bool TryTraceMemoryAccessRange(ThreadState* thr, uptr pc, uptr addr, uptr size, in TryTraceMemoryAccessRange() argument 62 if (UNLIKELY(!TraceAcquire(thr, &ev))) in TryTraceMemoryAccessRange() 64 thr->trace_prev_pc = pc; in TryTraceMemoryAccessRange() 74 TraceRelease(thr, ev); in TryTraceMemoryAccessRange() [all …]
|
| H A D | tsan_interface_ann.cpp | 32 ScopedAnnotation(ThreadState *thr, const char *aname, uptr pc) in ScopedAnnotation() argument 33 : thr_(thr) { in ScopedAnnotation() 49 ThreadState *thr = cur_thread(); \ 51 ScopedAnnotation sa(thr, __func__, caller_pc); \ 152 Release(thr, pc, addr); in AnnotateHappensBefore() 157 Acquire(thr, pc, addr); in AnnotateHappensAfter() 175 MutexCreate(thr, pc, m, MutexFlagWriteReentrant); in AnnotateRWLockCreate() 180 MutexCreate(thr, pc, m, MutexFlagWriteReentrant | MutexFlagLinkerInit); in AnnotateRWLockCreateStatic() 185 MutexDestroy(thr, pc, m); in AnnotateRWLockDestroy() 192 MutexPostLock(thr, pc, m, MutexFlagDoPreLockOnPostLock); in AnnotateRWLockAcquired() [all …]
|
| H A D | tsan_fd.h | 41 void FdAcquire(ThreadState *thr, uptr pc, int fd); 42 void FdRelease(ThreadState *thr, uptr pc, int fd); 43 void FdAccess(ThreadState *thr, uptr pc, int fd); 44 void FdClose(ThreadState *thr, uptr pc, int fd, bool write = true); 45 void FdFileCreate(ThreadState *thr, uptr pc, int fd); 46 void FdDup(ThreadState *thr, uptr pc, int oldfd, int newfd, bool write); 47 void FdPipeCreate(ThreadState *thr, uptr pc, int rfd, int wfd); 48 void FdEventCreate(ThreadState *thr, uptr pc, int fd); 49 void FdSignalCreate(ThreadState *thr, uptr pc, int fd); 50 void FdInotifyCreate(ThreadState *thr, uptr pc, int fd); [all …]
|
| H A D | tsan_interface_java.cpp | 60 ThreadState *thr = cur_thread(); \ 61 (void)thr; 65 Initialize(thr); in __tsan_java_init() 66 DPrintf("#%d: java_init(0x%zx, 0x%zx)\n", thr->tid, heap_begin, heap_size); in __tsan_java_init() 78 DPrintf("#%d: java_fini()\n", thr->tid); in __tsan_java_fini() 81 int status = Finalize(thr); in __tsan_java_fini() 82 DPrintf("#%d: java_fini() = %d\n", thr->tid, status); in __tsan_java_fini() 88 DPrintf("#%d: java_alloc(0x%zx, 0x%zx)\n", thr->tid, ptr, size); in __tsan_java_alloc() 96 OnUserAlloc(thr, 0, ptr, size, false); in __tsan_java_alloc() 101 DPrintf("#%d: java_free(0x%zx, 0x%zx)\n", thr->tid, ptr, size); in __tsan_java_free() [all …]
|
| H A D | tsan_rtl_proc.cpp | 24 proc->thr = nullptr; in ProcCreate() 34 CHECK_EQ(proc->thr, nullptr); in ProcDestroy() 45 void ProcWire(Processor *proc, ThreadState *thr) { in ProcWire() argument 46 CHECK_EQ(thr->proc1, nullptr); in ProcWire() 47 CHECK_EQ(proc->thr, nullptr); in ProcWire() 48 thr->proc1 = proc; in ProcWire() 49 proc->thr = thr; in ProcWire() 52 void ProcUnwire(Processor *proc, ThreadState *thr) { in ProcUnwire() argument 53 CHECK_EQ(thr->proc1, proc); in ProcUnwire() 54 CHECK_EQ(proc->thr, thr); in ProcUnwire() [all …]
|
| H A D | tsan_interface_atomic.cpp | 228 static T AtomicRMW(ThreadState *thr, uptr pc, volatile T *a, T v, morder mo) { in AtomicRMW() argument 229 MemoryAccess(thr, pc, (uptr)a, AccessSize<T>(), kAccessWrite | kAccessAtomic); in AtomicRMW() 232 SlotLocker locker(thr); in AtomicRMW() 234 auto s = ctx->metamap.GetSyncOrCreate(thr, pc, (uptr)a, false); in AtomicRMW() 237 thr->clock.ReleaseAcquire(&s->clock); in AtomicRMW() 239 thr->clock.Release(&s->clock); in AtomicRMW() 241 thr->clock.Acquire(s->clock); in AtomicRMW() 245 IncrementEpoch(thr); in AtomicRMW() 263 static T Atomic(ThreadState *thr, uptr pc, morder mo, const volatile T *a) { in Atomic() 268 MemoryAccess(thr, pc, (uptr)a, AccessSize<T>(), in Atomic() [all …]
|
| H A D | tsan_interface.cpp | 31 ThreadState *thr = cur_thread(); in __tsan_read16_pc() local 32 MemoryAccess(thr, pc_no_pac, (uptr)addr, 8, kAccessRead); in __tsan_read16_pc() 33 MemoryAccess(thr, pc_no_pac, (uptr)addr + 8, 8, kAccessRead); in __tsan_read16_pc() 38 ThreadState *thr = cur_thread(); in __tsan_write16_pc() local 39 MemoryAccess(thr, pc_no_pac, (uptr)addr, 8, kAccessWrite); in __tsan_write16_pc() 40 MemoryAccess(thr, pc_no_pac, (uptr)addr + 8, 8, kAccessWrite); in __tsan_write16_pc() 47 ThreadState *thr = cur_thread(); in __tsan_unaligned_read16() local 48 UnalignedMemoryAccess(thr, pc, (uptr)addr, 8, kAccessRead); in __tsan_unaligned_read16() 49 UnalignedMemoryAccess(thr, pc, (uptr)addr + 8, 8, kAccessRead); in __tsan_unaligned_read16() 54 ThreadState *thr = cur_thread(); in __tsan_unaligned_write16() local [all …]
|
| H A D | tsan_platform_mac.cpp | 64 static void ThreadStateDestructor(void *thr) { in ThreadStateDestructor() argument 65 int res = pthread_setspecific(thread_state_key, thr); in ThreadStateDestructor() 96 ThreadState *thr = (ThreadState *)pthread_getspecific(thread_state_key); in cur_thread() local 97 if (UNLIKELY(!thr)) { in cur_thread() 98 thr = (ThreadState *)MmapOrDie(sizeof(ThreadState), "ThreadState"); in cur_thread() 99 int res = pthread_setspecific(thread_state_key, thr); in cur_thread() 102 return thr; in cur_thread() 105 void set_cur_thread(ThreadState *thr) { in set_cur_thread() argument 106 int res = pthread_setspecific(thread_state_key, thr); in set_cur_thread() 111 ThreadState *thr = (ThreadState *)pthread_getspecific(thread_state_key); in cur_thread_finalize() local [all …]
|
| /freebsd/contrib/llvm-project/compiler-rt/lib/tsan/go/ |
| H A D | tsan_go.cpp | 143 auto *thr = (ThreadState *)Alloc(sizeof(ThreadState)); in AllocGoroutine() local 144 internal_memset(thr, 0, sizeof(*thr)); in AllocGoroutine() 145 return thr; in AllocGoroutine() 151 ThreadState *thr = AllocGoroutine(); in __tsan_init() local 152 main_thr = *thrp = thr; in __tsan_init() 153 Initialize(thr); in __tsan_init() 154 *procp = thr->proc1; in __tsan_init() 160 ThreadState *thr = main_thr; in __tsan_fini() local 161 int res = Finalize(thr); in __tsan_fini() 169 void __tsan_read(ThreadState *thr, void *addr, void *pc) { in __tsan_read() argument [all …]
|
| H A D | test.c | 18 void __tsan_init(void **thr, void **proc, void (*cb)(long, void*)); 21 void __tsan_go_start(void *thr, void **chthr, void *pc); 22 void __tsan_go_end(void *thr); 25 void __tsan_proc_wire(void *proc, void *thr); 26 void __tsan_proc_unwire(void *proc, void *thr); 27 void __tsan_read(void *thr, void *addr, void *pc); 28 void __tsan_write(void *thr, void *addr, void *pc); 29 void __tsan_func_enter(void *thr, void *pc); 30 void __tsan_func_exit(void *thr); 31 void __tsan_malloc(void *thr, void *pc, void *p, unsigned long sz); [all …]
|
| /freebsd/contrib/xz/src/liblzma/common/ |
| H A D | stream_decoder_mt.c | 201 struct worker_thread *thr; member 323 struct worker_thread *thr = thr_ptr; in worker_enable_partial_update() local 325 mythread_sync(thr->mutex) { in worker_enable_partial_update() 326 thr->partial_update_enabled = true; in worker_enable_partial_update() 327 mythread_cond_signal(&thr->cond); in worker_enable_partial_update() 335 struct worker_thread *thr = thr_ptr; in worker_decoder() local 342 mythread_mutex_lock(&thr->mutex); in worker_decoder() 345 if (thr->state == THR_IDLE) { in worker_decoder() 346 mythread_cond_wait(&thr->cond, &thr->mutex); in worker_decoder() 350 if (thr->state == THR_EXIT) { in worker_decoder() [all …]
|
| H A D | stream_encoder_mt.c | 183 worker_thread *thr; member 202 worker_error(worker_thread *thr, lzma_ret ret) in worker_error() argument 207 mythread_sync(thr->coder->mutex) { in worker_error() 208 if (thr->coder->thread_error == LZMA_OK) in worker_error() 209 thr->coder->thread_error = ret; in worker_error() 211 mythread_cond_signal(&thr->coder->cond); in worker_error() 219 worker_encode(worker_thread *thr, size_t *out_pos, worker_state state) in worker_encode() argument 221 assert(thr->progress_in == 0); in worker_encode() 222 assert(thr->progress_out == 0); in worker_encode() 225 thr->block_options = (lzma_block){ in worker_encode() [all …]
|
| /freebsd/contrib/llvm-project/compiler-rt/lib/tsan/dd/ |
| H A D | dd_rtl.cpp | 21 static u32 CurrentStackTrace(Thread *thr, uptr skip) { in CurrentStackTrace() argument 23 thr->ignore_interceptors = true; in CurrentStackTrace() 25 thr->ignore_interceptors = false; in CurrentStackTrace() 31 static void PrintStackTrace(Thread *thr, u32 stk) { in PrintStackTrace() argument 33 thr->ignore_interceptors = true; in PrintStackTrace() 35 thr->ignore_interceptors = false; in PrintStackTrace() 38 static void ReportDeadlock(Thread *thr, DDReport *rep) { in ReportDeadlock() argument 47 PrintStackTrace(thr, rep->loop[i].stk[1]); in ReportDeadlock() 51 PrintStackTrace(thr, rep->loop[i].stk[0]); in ReportDeadlock() 57 Callback::Callback(Thread *thr) in Callback() argument [all …]
|
| H A D | dd_interceptors.cpp | 19 static __thread Thread *thr; variable 29 if (thr != 0) in InitThread() 36 thr = (Thread*)InternalAlloc(sizeof(*thr)); in InitThread() 37 internal_memset(thr, 0, sizeof(*thr)); in InitThread() 38 ThreadInit(thr); in InitThread() 45 MutexDestroy(thr, (uptr)m); in INTERCEPTOR() 51 MutexBeforeLock(thr, (uptr)m, true); in INTERCEPTOR() 53 MutexAfterLock(thr, (uptr)m, true, false); in INTERCEPTOR() 61 MutexAfterLock(thr, (uptr)m, true, true); in INTERCEPTOR() 67 MutexBeforeUnlock(thr, (uptr)m, true); in INTERCEPTOR() [all …]
|
| /freebsd/sys/dev/hwt/ |
| H A D | hwt_hook.c | 63 struct hwt_thread *thr; in hwt_switch_in() local 80 thr = hwt_thread_lookup(ctx, td); in hwt_switch_in() 81 if (thr == NULL) { in hwt_switch_in() 86 dprintf("%s: thr %p index %d tid %d on cpu_id %d\n", __func__, thr, in hwt_switch_in() 87 thr->thread_id, td->td_tid, cpu_id); in hwt_switch_in() 89 hwt_backend_configure(ctx, cpu_id, thr->thread_id); in hwt_switch_in() 99 struct hwt_thread *thr; in hwt_switch_out() local 115 thr = hwt_thread_lookup(ctx, td); in hwt_switch_out() 116 if (thr == NULL) { in hwt_switch_out() 121 dprintf("%s: thr %p index %d tid %d on cpu_id %d\n", __func__, thr, in hwt_switch_out() [all …]
|
| H A D | hwt_thread.c | 74 struct hwt_thread *thr; in hwt_thread_first() local 78 thr = TAILQ_FIRST(&ctx->threads); in hwt_thread_first() 80 KASSERT(thr != NULL, ("thr is NULL")); in hwt_thread_first() 82 return (thr); in hwt_thread_first() 91 struct hwt_thread *thr; in hwt_thread_lookup() local 96 TAILQ_FOREACH(thr, &ctx->threads, next) { in hwt_thread_lookup() 97 if (thr->td == td) { in hwt_thread_lookup() 99 return (thr); in hwt_thread_lookup() 116 struct hwt_thread *thr; in hwt_thread_alloc() local 124 thr = malloc(sizeof(struct hwt_thread), M_HWT_THREAD, in hwt_thread_alloc() [all …]
|
| /freebsd/contrib/llvm-project/openmp/runtime/src/ |
| H A D | ompt-specific.cpp | 52 kmp_info_t *thr = ompt_get_thread(); in __ompt_get_teaminfo() local 54 if (thr) { in __ompt_get_teaminfo() 55 kmp_team *team = thr->th.th_team; in __ompt_get_teaminfo() 105 kmp_info_t *thr = ompt_get_thread(); in __ompt_get_task_info_object() local 107 if (thr) { in __ompt_get_task_info_object() 108 kmp_taskdata_t *taskdata = thr->th.th_current_task; in __ompt_get_task_info_object() 145 kmp_info_t *thr = ompt_get_thread(); in __ompt_get_scheduling_taskinfo() local 147 if (thr) { in __ompt_get_scheduling_taskinfo() 148 kmp_taskdata_t *taskdata = thr->th.th_current_task; in __ompt_get_scheduling_taskinfo() 260 void __ompt_lw_taskteam_init(ompt_lw_taskteam_t *lwt, kmp_info_t *thr, int gtid, in __ompt_lw_taskteam_init() argument [all …]
|
| /freebsd/sys/ddb/ |
| H A D | db_thread.c | 54 struct thread *thr; in db_set_thread() local 58 thr = db_lookup_thread(tid, false); in db_set_thread() 59 if (thr != NULL) { in db_set_thread() 60 err = kdb_thr_select(thr); in db_set_thread() 63 (long)thr->td_tid); in db_set_thread() 82 struct thread *thr; in db_show_threads() local 84 thr = kdb_thr_first(); in db_show_threads() 85 while (!db_pager_quit && thr != NULL) { in db_show_threads() 86 db_printf(" %6ld (%p) (stack %p) ", (long)thr->td_tid, thr, in db_show_threads() 87 thr->td_kstack); in db_show_threads() [all …]
|