Hi, Here is a proper V1 of the ThreadSanitizer patches I posted earlier this week. While my motivation is to have additional tools when stress testing MTTCG these should still be generally useful.
I've dropped the CFLAGS ordering patch which while useful for applying debug flags isn't needed for this series. However during experimentation is turns out various different invocations are needed for enabling the thread sanitizer depending on your GCC version and distro packaging of it. As a result there are now two configure patches, one for --extra-ldflags and one that introduces --extra-libs. Examples are included in the patches. To build on my work machine (Ubuntu 14.04 LTS) I installed the latest/greatest GCC PPA and configured with: ./configure ${TARGET_LIST} --cc=gcc-5 --cxx=g++-5 \ --extra-cflags="-fsanitize=thread" --extra-libs="-ltsan" \ --with-coroutine=gthread The third patch ensure we use the __atomic builtins for all atomic functions if we have it available. This is needed so the ThreadSanitizer can properly instrument the code but we should use it anyway for consistency. The code generation for atomic accesses on x86 it unaffected. I've gone through it with Paolo's review comments and cleaned it up considerably. The final two patches fix up some warnings the sanitizer threw up. I haven't completed a fully clean make check run yet as building with the gthread coroutines seems to currently break "make check" in master. However the default coroutine implementation is sufficiently funky to confuse tsan. Additional change comments are included bellow the -- in the other patches. Alex Bennée (5): configure: introduce --extra-libs configure: ensure ldflags propagated to config_host include/qemu/atomic.h: default to __atomic functions async.c: various atomic fixes for tsan thread-pool: atomic fixes from tsan Makefile | 4 +- async.c | 12 ++-- configure | 15 +++- include/qemu/atomic.h | 178 +++++++++++++++++++++++++++++++---------------- tests/test-thread-pool.c | 8 +-- thread-pool.c | 12 ++-- 6 files changed, 148 insertions(+), 81 deletions(-) -- 2.7.0