summaryrefslogtreecommitdiff
path: root/lib/tsan/rtl/tsan_stat.h
AgeCommit message (Collapse)Author
2017-07-12tsan: remove some clock-related statsDmitry Vyukov
The stats are too dependent on implementation and won't be relevant in future. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@307786 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-26tsan: add new mutex annotationsDmitry Vyukov
There are several problems with the current annotations (AnnotateRWLockCreate and friends): - they don't fully support deadlock detection (we need a hook _before_ mutex lock) - they don't support insertion of random artificial delays to perturb execution (again we need a hook _before_ mutex lock) - they don't support setting extended mutex attributes like read/write reentrancy (only "linker init" was bolted on) - they don't support setting mutex attributes if a mutex don't have a "constructor" (e.g. static, Java, Go mutexes) - they don't ignore synchronization inside of lock/unlock operations which leads to slowdown and false negatives The new annotations solve of the above problems. See tsan_interface.h for the interface specification and comments. Reviewed in https://reviews.llvm.org/D31093 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@298809 91177308-0d34-0410-b5e6-96231b3b80d8
2016-05-06tsan: fix a crashDmitry Vyukov
Fixes crash reported in: https://bugs.chromium.org/p/v8/issues/detail?id=4995 The problem is that we don't have a processor in a free interceptor during thread exit. The crash was introduced by introduction of Processors. However, previously we silently leaked memory which wasn't any better. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@268782 91177308-0d34-0410-b5e6-96231b3b80d8
2015-09-03tsan: speed up race deduplicationDmitry Vyukov
Race deduplication code proved to be a performance bottleneck in the past if suppressions/annotations are used, or just some races left unaddressed. And we still get user complaints about this: https://groups.google.com/forum/#!topic/thread-sanitizer/hB0WyiTI4e4 ReportRace already has several layers of caching for racy pcs/addresses to make deduplication faster. However, ReportRace still takes a global mutex (ThreadRegistry and ReportMutex) during deduplication and also calls mmap/munmap (which take process-wide semaphore in kernel), this makes deduplication non-scalable. This patch moves race deduplication outside of global mutexes and also removes all mmap/munmap calls. As the result, race_stress.cc with 100 threads and 10000 iterations become 30x faster: before: real 0m21.673s user 0m5.932s sys 0m34.885s after: real 0m0.720s user 0m23.646s sys 0m1.254s http://reviews.llvm.org/D12554 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@246758 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-30tsan: optimize memory access functionsDmitry Vyukov
The optimization is two-fold: First, the algorithm now uses SSE instructions to handle all 4 shadow slots at once. This makes processing faster. Second, if shadow contains the same access, we do not store the event into trace. This increases effective trace size, that is, tsan can remember up to 10x more previous memory accesses. Perofrmance impact: Before: [ OK ] DISABLED_BENCH.Mop8Read (2461 ms) [ OK ] DISABLED_BENCH.Mop8Write (1836 ms) After: [ OK ] DISABLED_BENCH.Mop8Read (1204 ms) [ OK ] DISABLED_BENCH.Mop8Write (976 ms) But this measures only fast-path. On large real applications the speedup is ~20%. Trace size impact: On app1: Memory accesses : 1163265870 Including same : 791312905 (68%) on app2: Memory accesses : 166875345 Including same : 150449689 (90%) 90% of filtered events means that trace size is effectively 10x larger. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@209897 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-11tsan: fix vector clocksDmitry Vyukov
the new optimizations break when thread ids gets reused (clocks go backwards) add the necessary tests as well git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@206035 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-24tsan: optimize vector clock operationsDmitry Vyukov
Make vector clock operations O(1) for several important classes of use cases. See comments for details. Below are stats from a large server app, 77% of all clock operations are handled as O(1). Clock acquire : 25983645 empty clock : 6288080 fast from release-store : 14917504 contains my tid : 4515743 repeated (fast) : 2141428 full (slow) : 2636633 acquired something : 1426863 Clock release : 2544216 resize : 6241 fast1 : 197693 fast2 : 1016293 fast3 : 2007 full (slow) : 1797488 was acquired : 709227 clear tail : 1 last overflow : 0 Clock release store : 3446946 resize : 200516 fast : 469265 slow : 2977681 clear tail : 0 Clock acquire-release : 820028 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@204656 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-21[tsan] add coarse-grained lock around the DeadlockDetector. We can do better ↵Kostya Serebryany
than that, but that's a start. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@201861 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-28tsan: remove interceptor statsDmitry Vyukov
They seems to be unused, but cause maintenance pain. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@200308 91177308-0d34-0410-b5e6-96231b3b80d8
2014-01-21Sanitize printf functions.Alexey Samsonov
Intercept and sanitize arguments passed to printf functions in ASan and TSan (don't do this in MSan for now). The checks are controlled by runtime flag (off by default for now). Patch http://llvm-reviews.chandlerc.com/D2480 by Yuri Gribov! git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@199729 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-02[sanitizer] Intercept textdomain.Evgeniy Stepanov
Patch by Alexander Taran. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@196098 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-28[sanitizer] Intercept times.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@195918 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-28[sanitizer] Intercept iconv.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@195917 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-27[sanitizer] Intercept __xpg_strerror_r.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@195839 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-02[sanitizer] Intercept strptime.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@193903 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-31[sanitizer] Intercept getline, getdelim.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@193730 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-29[sanitizer] Intercept drand48_r, lrand48_r.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@193655 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-29[sanitizer] Intercept sincos, remquo, lgamma, lgamma_r.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@193645 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-29tsan/asan: support pthread_setname_np to set thread namesDmitry Vyukov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@193602 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-25[sanitizer] Intercept tmpnam, tmpnam_r, tempnam.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@193415 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-25[sanitizer] Remove pthread_attr_getstackaddr interceptor.Evgeniy Stepanov
The function is deprecated. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@193409 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-25[sanitizer] Intercept pthread_attr_get*.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@193405 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-25[sanitizer] Intercept random_r.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@193396 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-24[sanitizer] Intercept shmctl.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@193348 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-23[sanitizer] Intercept ether_* functions.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@193241 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-22[sanitizer] Intercept initgroups.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@193158 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-18[sanitizer] Move statfs/fstatfs to common interceptors and add statvfs/fstatvfs.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@192965 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-18[sanitizer] Intercept getmntent, getmntent_r.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@192959 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-10tsan: add annotations to ignore synchronization operationsDmitry Vyukov
The annotations are AnnotateIgnoreSyncBegin/End, may be useful to ignore some infrastructure synchronization that introduces lots of false negatives. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@192355 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-03tsan: intercept _exit so that we can override exit statusDmitry Vyukov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@191898 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-03tsan: ignore interceptors coming from specified librariesDmitry Vyukov
LibIgnore allows to ignore all interceptors called from a particular set of dynamic libraries. LibIgnore remembers all "called_from_lib" suppressions from the provided SuppressionContext; finds code ranges for the libraries; and checks whether the provided PC value belongs to the code ranges. Also make malloc and friends interceptors use SCOPED_INTERCEPTOR_RAW instead of SCOPED_TSAN_INTERCEPTOR, because if they are called from an ignored lib, then must call our internal allocator instead of libc malloc. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@191897 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-27[sanitizer] Intercept backtrace, backtrace_symbols.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@191516 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-25[sanitizer] A bunch of libc interceptors.Evgeniy Stepanov
sigwait sigwaitinfo sigtimedwait sigemptyset sigfillset sigpending sigprocmask git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@191374 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-24[sanitizer] Intercept wordexp.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@191305 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-21tsan: ignore malloc/free/strdup when called from libjvmDmitry Vyukov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@191153 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-19tsan: fix linking of tsan runtime into dynamic librariesDmitry Vyukov
versioned symbols can not be linked into dynamic library w/o linker script also simplifies code as side effect git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@191056 91177308-0d34-0410-b5e6-96231b3b80d8
2013-09-02tsan: properly intercept pthread_cond functionsDmitry Vyukov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@189767 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-12[sanitizer] Intercept poll/ppoll.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@188177 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-12[sanitizer] Intercept getgroups.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@188167 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-08[sanitizer] Intercept scandir/scandir64.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@187982 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-08[sanitizer] Intercept strerror and strerror_r.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@187978 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-07[sanitizer] Intercept sched_getaffinity.Evgeniy Stepanov
Re-applying with a more reliable test case. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@187876 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-07Revert "[sanitizer] Intercept sched_getaffinity."David Blaikie
This reverts commit r187788. The test case is unreliable (as the test may be run in a situation in which it has no affinity with cpu0). This can be recommitted with a more reliable test - possibly using CPU_COUNT != 0 instead (I wasn't entirely sure that a process was guaranteed to have at least one affinity, though it seems reasonable, or I'd have made the change myself). git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@187841 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-06[sanitizer] Intercept sched_getaffinity.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@187788 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-30[msan] Intercept confstr.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@187412 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-16tsan: support sigsuspend() callDmitry Vyukov
Intercepting it makes it process pending signal before return. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@186400 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-09[sanitizer] Intercept realpath and canonicalize_file_name.Evgeniy Stepanov
Handle realpath(path, NULL) form. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@185921 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-04[sanitizer] Intercept tcgetattr.Evgeniy Stepanov
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@185626 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-04[sanitizer] More interceptors.Evgeniy Stepanov
bcopy strtoimax, strtoumax mbstowcs, mbsrtowcs, mbsnrtowcs wcstombs, wcsrtombs, wcsnrtombs git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@185624 91177308-0d34-0410-b5e6-96231b3b80d8
2013-07-02[sanitizer] Intercept mbtowc, mbrtowc, get_current_dir_name.Evgeniy Stepanov
Move getcwd to common interceptors. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@185424 91177308-0d34-0410-b5e6-96231b3b80d8