From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42567) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aOjbt-0007bR-4o for qemu-devel@nongnu.org; Thu, 28 Jan 2016 05:15:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aOjbp-0001WE-3d for qemu-devel@nongnu.org; Thu, 28 Jan 2016 05:15:29 -0500 Received: from mail-wm0-x229.google.com ([2a00:1450:400c:c09::229]:32830) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aOjbo-0001Vp-Sg for qemu-devel@nongnu.org; Thu, 28 Jan 2016 05:15:25 -0500 Received: by mail-wm0-x229.google.com with SMTP id l66so18386719wml.0 for ; Thu, 28 Jan 2016 02:15:24 -0800 (PST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= Date: Thu, 28 Jan 2016 10:15:14 +0000 Message-Id: <1453976119-24372-1-git-send-email-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PATCH v1 0/5] ThreadSanitizer support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: mttcg@listserver.greensocs.com, peter.maydell@linaro.org, mark.burton@greensocs.com, a.rigo@virtualopensystems.com, stefanha@redhat.com, pbonzini@redhat.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= , fred.konrad@greensocs.com 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