From nobody Sun Nov 24 11:43:01 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1723675375; cv=none; d=zohomail.com; s=zohoarc; b=ZFdp0aItl+alv5LcF/1xZ1HBw6I4AT//DhAIg7/by5R59GweekqRPwwYIPFQJHmcnZVpDi63q3syr/VyUchrHSX7MhtT6P/kE7TFbnscW6A9UNCr5gmUdHqEXBhnu9YZsl9deSJ8zWkOAoY8LIY723iVpoW0FTgCEogfRNf2n+I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1723675375; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=zJho7r2KSIGZArJtcY0/tQGk0chbARupwvgFA11PnCQ=; b=dOLftp7BdRPXNznHRLBBg+OGuF0EalML67laWJhJ3xWJbJ34KiVFw/NDZc3k+8bq/wLwf8/1p/1MisweXPI9wUhx9r8MMymgfoz+eTuR/jVwnZ+hhusz15OBXrlSHl0tX7zZisYOhQ2D85+i6bjUgl8NNw+FHbhXAauSxX8jOB4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1723675375164256.0538085055215; Wed, 14 Aug 2024 15:42:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1seMgb-0002Bb-LS; Wed, 14 Aug 2024 18:41:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1seMga-00025j-7L for qemu-devel@nongnu.org; Wed, 14 Aug 2024 18:41:44 -0400 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1seMgY-0007MF-3N for qemu-devel@nongnu.org; Wed, 14 Aug 2024 18:41:43 -0400 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1fc60c3ead4so3563805ad.0 for ; Wed, 14 Aug 2024 15:41:41 -0700 (PDT) Received: from linaro.vn.shawcable.net ([2604:3d08:9384:1d00:5b09:8db7:b002:cf61]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-201f03b2874sm1225595ad.308.2024.08.14.15.41.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Aug 2024 15:41:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1723675301; x=1724280101; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zJho7r2KSIGZArJtcY0/tQGk0chbARupwvgFA11PnCQ=; b=JVxdkMoYel9RVeqopVLQ2iRIOhWom3bCyiVWwV2ja6LbKNnn5AD14/H0iYAC03fURo i3Yru+g26uG3gpgWqywVbL5p++TOmftESo1rroAQRoTLqWJP63EjaKDg++CT3B4XXs3b 1xCh3+EiRDo5pKqfe/GGzN4tbbwR5DItHc3EXMtFid8QtxNrRdsGj0y50kfkHxTPvxGg x1CdKp3CODGy2DjuY0nQj+V29z+oKBaOxUKDr3Kv0Je5UwjCzNx8wmxblg2FwDyrmfQx vrKVZlNdDVR7rKxRisSwLR/AzeOBAMXqbFSYoqes13v1dAGNze5HeFHtkGdkszECoOjC Sr8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723675301; x=1724280101; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zJho7r2KSIGZArJtcY0/tQGk0chbARupwvgFA11PnCQ=; b=rspFR3ol3AeOTVnHkNTGi22zZnxqOEM2uY8D8u42M4Bh77Y3C4jSCarU6pdfjHugJg ta5RoplW3n5oW9BBhCSqAB/ZKZuRYJ3fr5Gp6af9KxJ/CdQ9p4y9hoZRChcQ3vC8U06t 2/eEUK6cmQLMlXKHy86QlMVbCTRVdCidAyqSJJkEeoSL/CNSdSpMjwR7GVxd9ZeZ7Z5k I/zFwnO7BjTnW2YKG1DU9ztNeed74EKvlCCTeAeNVVCEIl4pS2BMHi4+isKLHlbmDIP1 De5XjeEe8elGJzumR5Ma/2uljdNTwfT2lRHBQiR8Ylhsl6I7BwR3n8weLoeMNNkHKC5z L9FQ== X-Gm-Message-State: AOJu0Yz/OCRqvKw50OY2R4r2HjVchVY++iNFVmROdgSQ9dHafUQptvy0 /DAXUxW6+P/QEJzAGY1TV1EmcTE2AVc+jL1b4VFjRTRtqs89aTYazCQoF1MYPtuOEUUtksL/tZl F/PM= X-Google-Smtp-Source: AGHT+IHfpUHmltRgG/gVjytdo0w2YyJNJqcCukrC0Pgjx2S3EMn+ubfqhC4bAxsC2vTGIUfXWKdtyQ== X-Received: by 2002:a17:903:11c8:b0:1ff:49c:1562 with SMTP id d9443c01a7336-201d64d8afcmr48133095ad.56.1723675300659; Wed, 14 Aug 2024 15:41:40 -0700 (PDT) From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: Beraldo Leal , David Hildenbrand , Thomas Huth , Marcelo Tosatti , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Paolo Bonzini , kvm@vger.kernel.org, Wainer dos Santos Moschetta , qemu-s390x@nongnu.org, =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Ilya Leoshkevich , Pierrick Bouvier Subject: [PATCH v2 4/4] docs/devel: update tsan build documentation Date: Wed, 14 Aug 2024 15:41:32 -0700 Message-Id: <20240814224132.897098-5-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240814224132.897098-1-pierrick.bouvier@linaro.org> References: <20240814224132.897098-1-pierrick.bouvier@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::62d; envelope-from=pierrick.bouvier@linaro.org; helo=mail-pl1-x62d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1723675377015116600 Content-Type: text/plain; charset="utf-8" Mention it's now possible to build with gcc, instead of clang, and explain how to build a sanitized glib version. Signed-off-by: Pierrick Bouvier --- docs/devel/testing.rst | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/docs/devel/testing.rst b/docs/devel/testing.rst index af73d3d64fb..f10cfc3f786 100644 --- a/docs/devel/testing.rst +++ b/docs/devel/testing.rst @@ -634,20 +634,38 @@ Building and Testing with TSan It is possible to build and test with TSan, with a few additional steps. These steps are normally done automatically in the docker. =20 -There is a one time patch needed in clang-9 or clang-10 at this time: +TSan is supported for clang and gcc. +One particularity of sanitizers is that all the code, including shared obj= ects +dependencies, should be built with it. +In the case of TSan, any synchronization primitive from glib (GMutex for +instance) will not be recognized, and will lead to false positives. + +To build a tsan version of glib: =20 .. code:: =20 - sed -i 's/^const/static const/g' \ - /usr/lib/llvm-10/lib/clang/10.0.0/include/sanitizer/tsan_interface.h + $ git clone --depth=3D1 --branch=3D2.81.0 https://github.com/GNOME/glib= .git + $ cd glib + $ CFLAGS=3D"-O2 -g -fsanitize=3Dthread" meson build + $ ninja -C build =20 To configure the build for TSan: =20 .. code:: =20 - ../configure --enable-tsan --cc=3Dclang-10 --cxx=3Dclang++-10 \ + ../configure --enable-tsan \ --disable-werror --extra-cflags=3D"-O0" =20 +When executing qemu, don't forget to point to tsan glib: + +.. code:: + + $ glib_dir=3D/path/to/glib + $ export LD_LIBRARY_PATH=3D$glib_dir/build/gio:$glib_dir/build/glib:$gl= ib_dir/build/gmodule:$glib_dir/build/gobject:$glib_dir/build/gthread + # check correct version is used + $ ldd build/qemu-x86_64 | grep glib + $ qemu-system-x86_64 ... + The runtime behavior of TSAN is controlled by the TSAN_OPTIONS environment variable. =20 --=20 2.39.2