From nobody Sat Nov 23 21:22:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1729683659430700.3079551466119; Wed, 23 Oct 2024 04:40:59 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 5775B1B7C; Wed, 23 Oct 2024 07:40:58 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 8CB151B37; Wed, 23 Oct 2024 07:36:53 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id E98321B2E; Wed, 23 Oct 2024 07:36:50 -0400 (EDT) Received: from mail-ed1-f53.google.com (mail-ed1-f53.google.com [209.85.208.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 885F31AC5 for ; Wed, 23 Oct 2024 07:34:14 -0400 (EDT) Received: by mail-ed1-f53.google.com with SMTP id 4fb4d7f45d1cf-5cb6ca2a776so3750946a12.0 for ; Wed, 23 Oct 2024 04:34:14 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5cb66a654b9sm4351143a12.34.2024.10.23.04.34.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2024 04:34:10 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 6C4CE5F913; Wed, 23 Oct 2024 12:34:07 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1729683253; x=1730288053; darn=lists.libvirt.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=iZZo1oPZPqzjBeoixQ7wpptFRyTvJhgIff9wczeHXgQ=; b=ymwRiQ3rbR7hJWd+0ToKvdcQwgtzhyIk/HF/dAFiSLBs0ThFvmnO/TdK1YNQ7encVK 10AQqivPqeZsbhAHacHMWEUmWygIXP/qoqyTgQGmGOtBuiehqoWIcyHtGhBdOh4FCaVd pJUk2d7rFPiL4Ld51y0O2baCyYIwxsLzp5+TaBugHKa9AzJO+zo2MdO++YOya1EBDSbK f2qHGnEg8A+VW66Vb0BoDwy1UvXUVZOVmwxhgk3qoaiiVbwFPWy7NLazd2hthtDc20x8 P6qruikMYFTTn2h/XHxmDDbsFCbLkx08GNkqaXZ9p1Qb+JMjm7BOUfrX7ssu7TaxTw8N kGWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729683253; x=1730288053; 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=iZZo1oPZPqzjBeoixQ7wpptFRyTvJhgIff9wczeHXgQ=; b=vB68UdhuEghzGOL7yR+UbWKsEpQ8TjGq+87em5EQFeGNDqDynk+YUEHAz7tbYrwRgX Wa0lvPbRcAE8FXVLbO58aazUHBRjYkZSgTbEzvK6XpJdb0OMb4Cz7fhf0yUEaOrqvC+K F5t8KoUafMxzaDugfqjE9d7CIyDfVQuKBhOZGRxV96qrPKLu4UfRUaxvzRCZ1qoHCuM3 /I5v7vYF3XqF6up0mWytbb49Hs6aCWGbtR+qbWVvlLX/gtU4NRRmBP00XFTHsJuml4UZ nHYzHLwu1fAvYr9usm6TASsWmkptQfV9nxsZpF1FXBDYPeY3r4r3yYzGknEKJgjfz8dP nLlg== X-Forwarded-Encrypted: i=1; AJvYcCVYbxZs8uKWdsuoiucc5JZK/b6vt0gtrEWLLbgi+/qpR/OUJwpy+HBsUTFRWseIaUgieV/pYA==@lists.libvirt.org X-Gm-Message-State: AOJu0YzYFoKI61KNoZWzyUSCsB2g75qa1IQencaZAaz5l3WPQfk68D9U e+yADiIECIXgeOSKM+ei6fv1xHrSeo9t4LeZoIvV/OG5n6oKiZWcaNyrsWjQdDE= X-Google-Smtp-Source: AGHT+IFA0UaPGC8xcZ4LXhrZOMA5j/aP5IXRqvhXDz6QfMISSlPCIVK4HHHGWxBkVlt2kvmppngmEw== X-Received: by 2002:a05:6402:1955:b0:5cb:6718:7326 with SMTP id 4fb4d7f45d1cf-5cb8ad0734cmr1936187a12.21.1729683253220; Wed, 23 Oct 2024 04:34:13 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v3 05/18] docs/devel: update tsan build documentation Date: Wed, 23 Oct 2024 12:33:53 +0100 Message-Id: <20241023113406.1284676-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241023113406.1284676-1-alex.bennee@linaro.org> References: <20241023113406.1284676-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: TWDEXX5ZQ6MCKPEIJ3L4D2DGNUAWS4HF X-Message-ID-Hash: TWDEXX5ZQ6MCKPEIJ3L4D2DGNUAWS4HF X-MailFrom: alex.bennee@linaro.org X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0 CC: Zhao Liu , Eduardo Habkost , Pierrick Bouvier , Peter Maydell , Yanan Wang , John Snow , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , devel@lists.libvirt.org, Marcelo Tosatti , Riku Voipio , Wainer dos Santos Moschetta , Marcel Apfelbaum , Paolo Bonzini , Mahmoud Mandour , Laurent Vivier , Jiaxun Yang , "Edgar E. Iglesias" , Richard Henderson , Alexandre Iooss , qemu-arm@nongnu.org, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Cleber Rosa , kvm@vger.kernel.org, Beraldo Leal , Thomas Huth , =?UTF-8?q?Al ex=20Benn=C3=A9e?= X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1729683659904116600 Content-Type: text/plain; charset="utf-8" From: Pierrick Bouvier 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 Reviewed-by: Thomas Huth Message-Id: <20240910174013.1433331-4-pierrick.bouvier@linaro.org> Signed-off-by: Alex Benn=C3=A9e --- docs/devel/testing/main.rst | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/docs/devel/testing/main.rst b/docs/devel/testing/main.rst index 09725e8ea9..91f4dc61fb 100644 --- a/docs/devel/testing/main.rst +++ b/docs/devel/testing/main.rst @@ -628,20 +628,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.5