From patchwork Tue Sep 10 17:40:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pierrick Bouvier X-Patchwork-Id: 13799113 Received: from mail-pj1-f43.google.com (mail-pj1-f43.google.com [209.85.216.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DD5D419E7E0 for ; Tue, 10 Sep 2024 17:40:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725990025; cv=none; b=Z0vxfU1VIp6/YBlUJ7+YyaS4GQxn0uipHXKAS2gsVkfg6ciUNYlDB49ar0PEmyOVv1bWsyEWHzspEas6fxnCvKgwQkOITI2rav8qGUzhYceeFoxzUtXq25gWVil1BCuWXUC3g69aCNyARzNun53pFC/ZcBIdqx+GQa+CxN1Ep7E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725990025; c=relaxed/simple; bh=aA0WW/1yWrYVllqWDzAQlSXu/FtRYFRaq8LhdH9+qFY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=rc8l+pHS90mw7NP8gqtkiGYH4iNlhOZy3C+KIzG7SZPDWmQhsNR+UnuvOxqgwlCm03oStsAHu4TLWnhPT+KXWZFiE8GmFJ0mlywy4DpA7sf9b/20dIArVecfEOsUBK4C//b89MY8nYdPoZ0Cz8nHfiEqTPMX5DiuY+PssgPd5cg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=Hzw+1jp7; arc=none smtp.client-ip=209.85.216.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Hzw+1jp7" Received: by mail-pj1-f43.google.com with SMTP id 98e67ed59e1d1-2d877dab61fso3776543a91.3 for ; Tue, 10 Sep 2024 10:40:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725990023; x=1726594823; darn=vger.kernel.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=5Z1RdXPVj5atb8+PpKq/fmgLYxIn7PDouvny9pPcuV8=; b=Hzw+1jp7uFYjmT1UaldW59xGVG1IN4P1iruy1yY3h66daXa+iswddJ4J60/t4aw9t1 dvcFkqcJpWXkh+1UHy8t5PoM4zIhGnxSubpAtjOoSyJC4HhJT6IPLTTIzcMQkgpUYtPX P5J2q6uW0f5Ymz4yt/vcYMEmKxpMnwtkIXI2Js3gqGHAtB8s2DDDGNARpPW1Chk/SRmJ 1AXVgdp+BIWqxbDHeIkHrXQIs8T6zXkji/rdH5SJ+mkAC8mDylvb2wMbk/Dnz+HT0lHi uulN1y7v72QR7hJiqJ8tKmx1DNb6bqSNGuWXyr/ZSaXWnDZcMby54YbWc4jkFZWVc5mJ 74xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725990023; x=1726594823; 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=5Z1RdXPVj5atb8+PpKq/fmgLYxIn7PDouvny9pPcuV8=; b=bn4ZdtmPKOkQjO08AxwH9Ib3FTHuWFaB5JcAqeh4YzJekvs1o3HpJeVTESAUuyaAnJ CF9IdW4O+pzNi7bN872K2bo6t90CZtFLjzs3ILdRQTJnwyldE9bsE4kCRk//DFdP7TSu QZrQ7MltoerMZLyAdW2VKATh+Sx1dAwFvNXvSddSdL0vrsr8Fvq0wkC1ZsZX8rsSIfoI YswT9FQuTimZr4MijdaeqPPCDxGNQlWbisGIp1HLM1J01RRhFoX+OUTo9Yh4lzGuyRe2 /0rjU3PPCNh8vCrxzpyevC56KOxuPNwn6YIsRr/HByy7H8W0fqzjZnWap/n9eP8a3JWN VqxQ== X-Forwarded-Encrypted: i=1; AJvYcCURA6bzj1KapJdksCoQiS1EegZKGdaFvak8XNQGB4Pjn1sFyiY7i66KQmv7SHpvfIAfVnI=@vger.kernel.org X-Gm-Message-State: AOJu0Yx0nmaMn0myJN89dYmJLU1I7Ye8+5EZDUM91syrKRt6XH4hjn6e tSzHsaNVdNlzNQHxv+rprUAp9/oqMJv4MQe2E56Tpc4TAkt62D4qs0DOI7I+mC4= X-Google-Smtp-Source: AGHT+IG6zIVst4fam3ycj2QQzyd81h1e4xxXf0bTor2s5c8iE8a6MWU0szq+VZSbcxp0XJSKGVESRA== X-Received: by 2002:a17:90a:3f8b:b0:2d8:ee39:47d with SMTP id 98e67ed59e1d1-2dad4efe336mr14872686a91.2.1725990022993; Tue, 10 Sep 2024 10:40:22 -0700 (PDT) Received: from linaro.vn.shawcable.net ([2604:3d08:9384:1d00::9633]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2db04966d3asm6682751a91.38.2024.09.10.10.40.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 10:40:22 -0700 (PDT) From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: Wainer dos Santos Moschetta , Richard Henderson , Paolo Bonzini , Ilya Leoshkevich , =?utf-8?q?Alex_Benn=C3=A9e?= , David Hildenbrand , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , kvm@vger.kernel.org, Thomas Huth , Marcelo Tosatti , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , qemu-s390x@nongnu.org, Beraldo Leal , Pierrick Bouvier Subject: [PATCH v3 1/3] meson: hide tsan related warnings Date: Tue, 10 Sep 2024 10:40:11 -0700 Message-Id: <20240910174013.1433331-2-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240910174013.1433331-1-pierrick.bouvier@linaro.org> References: <20240910174013.1433331-1-pierrick.bouvier@linaro.org> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 When building with gcc-12 -fsanitize=thread, gcc reports some constructions not supported with tsan. Found on debian stable. qemu/include/qemu/atomic.h:36:52: error: ‘atomic_thread_fence’ is not supported with ‘-fsanitize=thread’ [-Werror=tsan] 36 | #define smp_mb() ({ barrier(); __atomic_thread_fence(__ATOMIC_SEQ_CST); }) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Pierrick Bouvier --- meson.build | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index fbda17c987e..8a587bd52cc 100644 --- a/meson.build +++ b/meson.build @@ -504,7 +504,15 @@ if get_option('tsan') prefix: '#include ') error('Cannot enable TSAN due to missing fiber annotation interface') endif - qemu_cflags = ['-fsanitize=thread'] + qemu_cflags + tsan_warn_suppress = [] + # gcc (>=11) will report constructions not supported by tsan: + # "error: ‘atomic_thread_fence’ is not supported with ‘-fsanitize=thread’" + # https://gcc.gnu.org/gcc-11/changes.html + # However, clang does not support this warning and this triggers an error. + if cc.has_argument('-Wno-tsan') + tsan_warn_suppress = ['-Wno-tsan'] + endif + qemu_cflags = ['-fsanitize=thread'] + tsan_warn_suppress + qemu_cflags qemu_ldflags = ['-fsanitize=thread'] + qemu_ldflags endif From patchwork Tue Sep 10 17:40:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pierrick Bouvier X-Patchwork-Id: 13799114 Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EA8241A7063 for ; Tue, 10 Sep 2024 17:40:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725990027; cv=none; b=GRv5w/xdtYkwnmj9WrblvLNcYnRNmNn+l1Wh0uOviLozE+s79uQiijywd9SZw539IhtGihU/EatMkZ5AGQG7amRznQPaxaz1HWz6acJDCrjSMMAQnVwS4gWb4sCkPA6gjmLAkSWvoxVDf5whz7IzQ75NUNDnm61symXmqkDmPIo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725990027; c=relaxed/simple; bh=yBjdXAtnte4NW3LwRNXWR5icfGV4Bb+iEw3W8CIUl+c=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=RqbILZr/pZnFWqwxuhvhuFMX8sLPyZpjx6BNh1QraPCtlv7Cd0TnXDeT89u+QCsCyU1Z6btFeBOiHMeuxwB2885ZicmXloSsi7abT+QZ7OA2NyE2C5fnBG+sbOQ6MxglirJ+hT82hm/DLD2QCHoMmD6oEl8PxMlEZ8K46S6QgX8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=DLzaqKa8; arc=none smtp.client-ip=209.85.216.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="DLzaqKa8" Received: by mail-pj1-f53.google.com with SMTP id 98e67ed59e1d1-2d8b96c18f0so4564116a91.2 for ; Tue, 10 Sep 2024 10:40:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725990024; x=1726594824; darn=vger.kernel.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=PxK/kUedWi76nv9Z4j6eZ6ETsIVX17z0F3roB87C/Q0=; b=DLzaqKa8/kRZExX43MQPiQjxLiJotx1qVSxdsfdqtgfw2uKXNpy+TcbdxR/kamIGwO 7NrT6Sndvf9QJ78YZ95n6QcjzRtqGfBqgoXxDRJ328SyQkZVIBIa0kK128Y1Onm30O0p /GqSsliuMgoQ+rZj/XT4on2xYWKrOo9q+qehz6T/FUOvozJf3rpM5qBaLads8au9b2Tm FCQ6cTcKN/1F56srN/9ovFEDzNdbTwAH/8WwizmnCYbdBoCk/uTQ43RVSmId9Me4/KvW sVuufF5+FEncVupEMjs7TeiqBnnJxWnOwH+HNY4tjlY5y1/R+i7P3oLKzYnr//L3S+GU WZgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725990024; x=1726594824; 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=PxK/kUedWi76nv9Z4j6eZ6ETsIVX17z0F3roB87C/Q0=; b=Kq+Y9iWXH85p1EVBUJjloJKRUzUfQcqUDP2LCEorx2jiqXMZUXIh/H1j9IZrMOYKjB uEw/3QY/3b5Uje30NHIRjTFm9w1sq9wevKQ8q0Stb3L1kzOL4qxkF9SyiE99NKrPLPp7 DmYFSd9lm5U9ue3oPy/TQNhIHGvWzYAY/bTx8LBD4JHNm6gxoWDTbiHF5SQcHB0fqNYB m6eq00y/yhvsDE+BWaRPiSuOBpWpKla2O/+gH5yipGyG5M2SSN1Kt+1L6jl4aDUnX1yV +U7k7wcaXaE4t9aHSDQowFhWypiEOBoKh4McXp+chAwWi9SkfSNSPhiYNz5CdMDTyXRE s4bA== X-Forwarded-Encrypted: i=1; AJvYcCUTFL5l+cDb1C0hNKt3BZIOw0IUTatMXdjSGrluTI7gUihPkKwwAG5XYrzYT6QZlBq7Uak=@vger.kernel.org X-Gm-Message-State: AOJu0YyZxwOtMQ/l1JKakArugnvWKaBQv3wB4pkHg60s//Qz+3tC85Zz hNKSzVQqMYYYep31e5WX6PFg7PeFwYGSdd5IYfhBpaANZC91rgFuNUlioD1fjpg= X-Google-Smtp-Source: AGHT+IHIEh2gOaDV+kP/9BofpfisOSSU+8HsXyUxQbN5hvDsWwuXez7jJ9Dt81kkjIr+UHHAmLwAYg== X-Received: by 2002:a17:90b:3c43:b0:2da:5156:1253 with SMTP id 98e67ed59e1d1-2dad50141cbmr5998023a91.21.1725990024249; Tue, 10 Sep 2024 10:40:24 -0700 (PDT) Received: from linaro.vn.shawcable.net ([2604:3d08:9384:1d00::9633]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2db04966d3asm6682751a91.38.2024.09.10.10.40.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 10:40:23 -0700 (PDT) From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: Wainer dos Santos Moschetta , Richard Henderson , Paolo Bonzini , Ilya Leoshkevich , =?utf-8?q?Alex_Benn=C3=A9e?= , David Hildenbrand , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , kvm@vger.kernel.org, Thomas Huth , Marcelo Tosatti , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , qemu-s390x@nongnu.org, Beraldo Leal , Pierrick Bouvier Subject: [PATCH v3 2/3] target/i386: fix build warning (gcc-12 -fsanitize=thread) Date: Tue, 10 Sep 2024 10:40:12 -0700 Message-Id: <20240910174013.1433331-3-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240910174013.1433331-1-pierrick.bouvier@linaro.org> References: <20240910174013.1433331-1-pierrick.bouvier@linaro.org> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Found on debian stable. ../target/i386/kvm/kvm.c: In function ‘kvm_handle_rdmsr’: ../target/i386/kvm/kvm.c:5345:1: error: control reaches end of non-void function [-Werror=return-type] 5345 | } | ^ ../target/i386/kvm/kvm.c: In function ‘kvm_handle_wrmsr’: ../target/i386/kvm/kvm.c:5364:1: error: control reaches end of non-void function [-Werror=return-type] 5364 | } Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson Signed-off-by: Pierrick Bouvier --- target/i386/kvm/kvm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index 2fa88ef1e37..308b0e1cb37 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -5770,7 +5770,7 @@ static int kvm_handle_rdmsr(X86CPU *cpu, struct kvm_run *run) } } - assert(false); + g_assert_not_reached(); } static int kvm_handle_wrmsr(X86CPU *cpu, struct kvm_run *run) @@ -5789,7 +5789,7 @@ static int kvm_handle_wrmsr(X86CPU *cpu, struct kvm_run *run) } } - assert(false); + g_assert_not_reached(); } static bool has_sgx_provisioning; From patchwork Tue Sep 10 17:40:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierrick Bouvier X-Patchwork-Id: 13799115 Received: from mail-pg1-f171.google.com (mail-pg1-f171.google.com [209.85.215.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1EE691A707C for ; Tue, 10 Sep 2024 17:40:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725990027; cv=none; b=BWdTAiolEfOPTpES0okZ3ZY83NIpKbChwLuK7t7ePUeLKo+DgZz83U8q43CB0/PEHk9ismpwBDxl8NOa3X0Qt9oeQQ58o2tctV7uCTBuQGyXy+45GlCCTjZ7YoPslVa4rglTHQpRWgx/nPEyH5EBVxofw1KIhy1aJOD1DGPySjo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725990027; c=relaxed/simple; bh=ttAsv3D6Iwp9QivWIaLu03Xlt9EFoz/vJPFHC4td/f8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ee0PoJIovqNrkgIvFdJy0URBVajqSqgUr2ti2mFvqsEDvzV3ee03C3lZpFwtHllC8KvcogIRwBEbDQCc1MZUzD2gngmAOoC87YrwV7IRYV/Laxhjo+yDqGYteoxaLVgcd+eI7cznSFy3UQwVyXBeYiOUCPZJAizrHso831XwBhk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=dfSfqdxA; arc=none smtp.client-ip=209.85.215.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="dfSfqdxA" Received: by mail-pg1-f171.google.com with SMTP id 41be03b00d2f7-7ae3d7222d4so850187a12.3 for ; Tue, 10 Sep 2024 10:40:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725990025; x=1726594825; darn=vger.kernel.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=IlCj2ixhxM/epvOBESU4I3HZLS9l35ap6tDyuxDs4dc=; b=dfSfqdxAku0B+p8GpK2DNFlHKbEgfd0G7htyiDgv3T8t4m1N2slwU3U8S3H06fTG+Q NmjhlRGRwuJv7DyvOK9l26tAwYpC/UhvqRDfzSTYKUL6DDFf8ATWV+iuneopeWlj0c4B hMTBFXO8Zt3HTnI3ZyLkL85m+Bl+WZm9DqwaPjRQOiyXA/kbS+m+GeZRO+gRfVcXG63i KerM5Ft5B5rQGXYTJTbHn9ZfIzeiqa49Dn+c7D/bUC3F+CLQ+oAO+4NVaTjL/yG7m+dU IhYyZjQJ9xIxU0CRGRgYQAlGZpa0VedF3uCx3ilQQ5LbLlOfMWi109E0RN8uRgbLQaAE McTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725990025; x=1726594825; 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=IlCj2ixhxM/epvOBESU4I3HZLS9l35ap6tDyuxDs4dc=; b=b5peYdr1xvMo5W3bWJhDhbdo2JIpD9AsjlPyZG9uy2o2yMMppob9hzXZRt8Ao57mge tc3umbp4Re7zaQEpSH/uCiiJ34ZxG8bueACx96RSHpIm6pPegFwwMfQ7XmY11p/JZzTB O6ctyO3yUQ/1ZpowdJUDdQArmONr/nju+sDRPtf5lz5CYBRiNePGkfBof0q55ZpJWnXi I5Mx93eMupCjn1BX2WqK53eaISGWYGytvYyuPc2RDVa6Ysg4Wq9fBPGYe/fZaoQBfctF tRpgAAYGDq/OonnbrZncSBRjnJhqIXX+rkfS7k4xmAP06qTe49JPFbOiNe6GH5nwFsNE UcqA== X-Forwarded-Encrypted: i=1; AJvYcCVXppf5Xt+s/zdt17KUdmE+sQWgAZJT4kyNy9t0Ro5foVTV7NGCHnRbK6Dx7dAFaZs3CSw=@vger.kernel.org X-Gm-Message-State: AOJu0YxoDWOkvcIEwGIDE2A+lviWjNHed9MdlK5gM4yGLwjOEjkei28O GiPnGSX9ExxFnld6EK5FBWol+ZUVUqlpGFrZ2Yu2LFwxIOko2ACs8nJPuhFENr4= X-Google-Smtp-Source: AGHT+IEDoWGBv7ts4eAbU+3GWSnN9KnHavnhQ7oMRWijIdyG4R93doDvhi7Ldov7owH5gTg/MhEDzw== X-Received: by 2002:a17:90a:4d81:b0:2d8:5b9f:75ab with SMTP id 98e67ed59e1d1-2db830582dfmr361931a91.29.1725990025406; Tue, 10 Sep 2024 10:40:25 -0700 (PDT) Received: from linaro.vn.shawcable.net ([2604:3d08:9384:1d00::9633]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2db04966d3asm6682751a91.38.2024.09.10.10.40.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 10:40:25 -0700 (PDT) From: Pierrick Bouvier To: qemu-devel@nongnu.org Cc: Wainer dos Santos Moschetta , Richard Henderson , Paolo Bonzini , Ilya Leoshkevich , =?utf-8?q?Alex_Benn=C3=A9e?= , David Hildenbrand , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , kvm@vger.kernel.org, Thomas Huth , Marcelo Tosatti , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , qemu-s390x@nongnu.org, Beraldo Leal , Pierrick Bouvier Subject: [PATCH v3 3/3] docs/devel: update tsan build documentation Date: Tue, 10 Sep 2024 10:40:13 -0700 Message-Id: <20240910174013.1433331-4-pierrick.bouvier@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240910174013.1433331-1-pierrick.bouvier@linaro.org> References: <20240910174013.1433331-1-pierrick.bouvier@linaro.org> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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/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 e9921a4b10a..2e57390d990 100644 --- a/docs/devel/testing/main.rst +++ b/docs/devel/testing/main.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. -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 objects +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: .. code:: - sed -i 's/^const/static const/g' \ - /usr/lib/llvm-10/lib/clang/10.0.0/include/sanitizer/tsan_interface.h + $ git clone --depth=1 --branch=2.81.0 https://github.com/GNOME/glib.git + $ cd glib + $ CFLAGS="-O2 -g -fsanitize=thread" meson build + $ ninja -C build To configure the build for TSan: .. code:: - ../configure --enable-tsan --cc=clang-10 --cxx=clang++-10 \ + ../configure --enable-tsan \ --disable-werror --extra-cflags="-O0" +When executing qemu, don't forget to point to tsan glib: + +.. code:: + + $ glib_dir=/path/to/glib + $ export LD_LIBRARY_PATH=$glib_dir/build/gio:$glib_dir/build/glib:$glib_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.