From patchwork Fri Feb 7 15:30:56 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 862983 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e42:0:b0:385:e875:8a9e with SMTP id r2csp382659wrt; Fri, 7 Feb 2025 07:32:53 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVazlSSwGP8yO8EpBOBmO/8bCGJA8qyEPdeqBJoBpFeNfiQjt4FKJr9sA7MWAl5nBMyQMxDSA==@linaro.org X-Google-Smtp-Source: AGHT+IGp6HiEvoEE7MW+ua38MGKqqHljktd2INvrihtPX7MV2UyGnJKsHL7VLTefVK+8D43BwZfc X-Received: by 2002:a5d:6d8b:0:b0:38a:418e:1171 with SMTP id ffacd0b85a97d-38dc935f80bmr2524973f8f.37.1738942372906; Fri, 07 Feb 2025 07:32:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1738942372; cv=none; d=google.com; s=arc-20240605; b=aOw5sIyBpv84iY4t+8QhQzXzvaI0z5a/tbWIjMl5j9kTbAeeJ82mW0RaBVaSultNLW LRVW3FqxdQrs6nk0/XN5vNd9yHY5V1copfFEA7GYKSxXhyble0RtPL+hv9YhjCQjNDdD D8WTQ2a4HkONdG1F3WLiVmrOQ8uZUc1ZYqcAtIKesw2VOhv9vWoWiYFniaAJEIhBHv6O K9MBjV7HQaSW4Arr6ivLm1IyyQ1gRO+vqVLNurl+hIOAx8NXcVQi6NLgsChm0CVPGUvp ELWzCVUJ3La6ZN3CbEdkCmyQbgucOpn9m59mQzT95QmxcdOMYd6M9uzSfIKtudOlhs0o mXmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=og+RgYrNsp8w4PSolTa+WXjkMXBk+YlMNJEeZ+a/6KM=; fh=wU5jWsflgZeWkD4KPn0erLqYU9C64YFheOYh1YAvMfA=; b=EC1U/rin5y4Rg7XW127xvxu8HHY1Ru0kbyOD9lb8moRX6Kg6nh4OlpubRXhi1DOg4c dcVCJLrHSShf8+X++bZT2AZE+Eh8QBBgsq9nUhtTvNS4PRqqMMzBapZc733GH+pK6CKY 1gEZPd7S+RsnhHbKik0DRHnBTvZmfiAGs/R8nzjiCxa+RKOGkWkAAhui6bnoOF+nhplt 33KEuJ0NsQU01DzbE7ayXrLDRSx7+5z5jHKjkela00c6FYhBozO69dmw/CC47oSOhc2S C5YUg/DNDbvih16plMGpFdCMEDodys72ERLWRia6NOPCkbGMxfTldibhh0rRxod2jHDU ZpVw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LW2owGCp; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ffacd0b85a97d-38dcfd7d12csi378257f8f.367.2025.02.07.07.32.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Feb 2025 07:32:52 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LW2owGCp; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tgQLH-0000Nk-E1; Fri, 07 Feb 2025 10:32:34 -0500 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 1tgQKA-00081y-Hv for qemu-devel@nongnu.org; Fri, 07 Feb 2025 10:31:22 -0500 Received: from mail-ed1-x52d.google.com ([2a00:1450:4864:20::52d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tgQK5-0003xL-Nn for qemu-devel@nongnu.org; Fri, 07 Feb 2025 10:31:22 -0500 Received: by mail-ed1-x52d.google.com with SMTP id 4fb4d7f45d1cf-5de4a8b4f86so1199356a12.2 for ; Fri, 07 Feb 2025 07:31:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1738942276; x=1739547076; 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=og+RgYrNsp8w4PSolTa+WXjkMXBk+YlMNJEeZ+a/6KM=; b=LW2owGCptWB0QHH7Z4jBmqbpVe9Dku+G1eo/tIsqnRNao3/4ZtxbWOH+ZG6/O1W+5e h2JNFpzDcndMgG4pNbWBmTN6+2JgIBzRQ2bYNKzkKY0gqvbZs1MzRJPaBXNwHixvX54/ 5ylpnbBltstsaVNSqEo2FlQ5KFpufas7kxKLaqBSF9c4wylWa+LK0JrZNjtRGDZrFgmE WPvyrgyCD3uAjLBfaG8vBSfGZKIxeem557/mw6O/d1W8sQIihlUzQsFcdo7QX0tImAo8 u6clb2DST5/gTFhbEcjWej/dgf03SrhmjbzyJxbfAXS8qXXCkCJ2eee+5fuR96Ej+Kva zNgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738942276; x=1739547076; 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=og+RgYrNsp8w4PSolTa+WXjkMXBk+YlMNJEeZ+a/6KM=; b=i4+Jff6VJ36WwS483OI7VXtYJYKeYGclHhmwlcZGxhPOSpNRc7yXaHczt6z6WiXTEq rFRKH34+Q0B80yV6RgMdslJmyn5rT90h6Idq7vZyG6QP/CvYyjzisqjwKaXv+1Hw3cJo EjdNadVVsVarnYeM1XbIcQiF7E9Lr5jy3td5MylYYGhbHpHNgrQLpB/FevicLzAxoTRE yh5tNGE3+MVS2sbrPchql/LyG7Ytox80fWdt2zUt79OujdyFDQdJMyAJcYpOV99WnGCZ JAV5UzT8RYafAuayltRaIGOnqnZGIkRuhnGWhIx82KHu4hLKYN7KDhxxwKmIL/3xIOIK DlnA== X-Gm-Message-State: AOJu0YwPei6G4Qczwd3azIIsJk3NcaYVoffv/vzOFttKzxHllr8GSO9y zFDaAkOL4X+fEKyy3WZfawmy4mbT93Mi5Oii65dlyc3l1qGxZ01kLjcnBjdwlMo= X-Gm-Gg: ASbGncu7PAC/+UboyC56Dt7KtOkBmvwltiLaTpmP3R85DnCArniezD+sNrKyHwHMD4O 3dqkQEDoTn44avCmL41mMa85j0XVbfjek9CFdd+LP3iadkrjn3/yXaA2dm6S+CR5sSPL4XyydT/ Adw3uVD5rLNIPHeysfjCP4X0Pesy68Lg1QS5HmAujpn8r8DASZlsMW1cbPVsoWo5isi7b2jSyk1 T1emQEdCwkEilhqeYGJPkTDAukO2VriGuy9S8Qs7fHoaH/1ubQ+OFhDGy3DkyP694r6crLHu5bD NqaDVx0iHrvG4QJWTw== X-Received: by 2002:a05:6402:e8a:b0:5dc:d34f:a315 with SMTP id 4fb4d7f45d1cf-5de450236a2mr4556163a12.15.1738942275728; Fri, 07 Feb 2025 07:31:15 -0800 (PST) Received: from draig.lan ([185.126.160.109]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5de379cedc6sm2044986a12.44.2025.02.07.07.31.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Feb 2025 07:31:14 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 7D6705F92A; Fri, 7 Feb 2025 15:31:12 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Peter Xu , =?utf-8?q?Alex_Benn=C3=A9e?= , Thomas Huth , Weiwei Li , qemu-arm@nongnu.org, Nicholas Piggin , Liu Zhiwei , Bin Meng , Tyrone Ting , Hao Wu , Kyle Evans , Alistair Francis , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Laurent Vivier , Riku Voipio , Harsh Prateek Bora , Fabiano Rosas , Alexandre Iooss , Laurent Vivier , Daniel Henrique Barboza , Warner Losh , Pierrick Bouvier , Palmer Dabbelt , Mahmoud Mandour , qemu-ppc@nongnu.org, Paolo Bonzini , qemu-rust@nongnu.org, qemu-riscv@nongnu.org Subject: [PATCH v2 01/17] tests/docker: replicate the check-rust-tools-nightly CI job Date: Fri, 7 Feb 2025 15:30:56 +0000 Message-Id: <20250207153112.3939799-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250207153112.3939799-1-alex.bennee@linaro.org> References: <20250207153112.3939799-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::52d; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-x52d.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 autolearn=unavailable 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org This allows people to run the test locally: make docker-test-rust@fedora-rust-nightly Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson --- v2 - update MAINTAINERS --- MAINTAINERS | 1 + tests/docker/Makefile.include | 3 +++ tests/docker/test-rust | 21 +++++++++++++++++++++ 3 files changed, 25 insertions(+) create mode 100755 tests/docker/test-rust diff --git a/MAINTAINERS b/MAINTAINERS index 0cf37fce7b..efb7d09dea 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3386,6 +3386,7 @@ F: rust/rustfmt.toml Rust-related patches CC here L: qemu-rust@nongnu.org +F: tests/docker/test-rust F: rust/ SLIRP diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include index fead7d3abe..fa1cbb6726 100644 --- a/tests/docker/Makefile.include +++ b/tests/docker/Makefile.include @@ -236,3 +236,6 @@ docker-image: ${DOCKER_IMAGES:%=docker-image-%} docker-clean: $(call quiet-command, $(DOCKER_SCRIPT) clean) + +# Overrides +docker-test-rust%: NETWORK=1 diff --git a/tests/docker/test-rust b/tests/docker/test-rust new file mode 100755 index 0000000000..e7e3e94a55 --- /dev/null +++ b/tests/docker/test-rust @@ -0,0 +1,21 @@ +#!/bin/bash -e +# +# Run the rust code checks (a.k.a. check-rust-tools-nightly) +# +# Copyright (c) 2025 Linaro Ltd +# +# Authors: +# Alex Bennée +# +# This work is licensed under the terms of the GNU GPL, version 2 +# or (at your option) any later version. See the COPYING file in +# the top-level directory. + +. common.rc + +cd "$BUILD_DIR" + +configure_qemu --disable-user --disable-docs --enable-rust +pyvenv/bin/meson devenv -w $QEMU_SRC/rust ${CARGO-cargo} fmt --check +make clippy +make rustdoc From patchwork Fri Feb 7 15:30:57 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 862980 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e42:0:b0:385:e875:8a9e with SMTP id r2csp382503wrt; Fri, 7 Feb 2025 07:32:39 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUZWSGOxxgyBHAJlMskhRIMKmFXEkdozyyzfyDDArx3mP36dzyNEYI3irsVsBK+se7FOIsLRA==@linaro.org X-Google-Smtp-Source: AGHT+IFrAQO2cVH7XTVABXcEyyazh60YYThWiUKgyVuVRNjZCnuCM21LCibknMUoHB3MmkAC5I2S X-Received: by 2002:a05:6122:18a8:b0:51f:306f:f360 with SMTP id 71dfb90a1353d-51f306ff9famr1622774e0c.9.1738942358718; Fri, 07 Feb 2025 07:32:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1738942358; cv=none; d=google.com; s=arc-20240605; b=J2r8JamZPlcdAZVxSKk4oKYlXovZVCaVlJeGux9MNfQg1ze5aT/KKAvOSQaUSS9fRg ZgbHfRbONA7HQMxMsJZwVyb33KnRjFgM8mcKajZ+hA7ReMrrVb/57rRx813s4qhj3rHB q01GTaSUDutsCJO+RQIz9xN0GrxVI9ABklmUb6B/2IOsF+u9CXtrQGrRlaT47LhEKtVm weNIRP+oWR91OVPUKvMHGa3wuS9321lC4m2VOAD8aQWegWvgdALF6s1GcQVz/mltSuwn D9Uwtv9dTrZOD0SjUdtzHDp1mYPDPZCJiOJsTUInD9bcNqhGYfZ2rSxorFVqcrMDzXqH Ey6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3UFLMzp9qGvO/TMJfobXhH747ty7fBk8K8S5c0aFteA=; fh=wU5jWsflgZeWkD4KPn0erLqYU9C64YFheOYh1YAvMfA=; b=Sw2UJGeQ0N4+Wy+pNet8VRNDTanT3zD6aHFzmMiXYKj2TKLpnwfpfO7czKT2R+Mnml ZEE9T1Y+TOYDBXb5M7OXS6LTjED/qj5t13ixK3Pnwa9CJt6xY8w+y6wRNp28gY/wSsSg CZ3r/M3SJOi6km4We7FR24t7SU5M44KtFAQNUJyFgntbCpIvbYiztxRpNpo86JcBgEa0 z5kxwvVGQjsRiBjH45k8mW6+lGLvpNsivgX/0X4iKjVi+33YUdG+lMOsnNMgNQ4cQ7f2 LJRONmRoA97Gh86vj0zCb2SK+Qp+SYAXXC+MorJwgLsVogLjgze/TiEYzSKA+HjCfZOQ vlmw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kOljxhz4; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 71dfb90a1353d-51f22787a54si656507e0c.91.2025.02.07.07.32.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Feb 2025 07:32:38 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kOljxhz4; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tgQL3-0008Uh-MX; Fri, 07 Feb 2025 10:32:19 -0500 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 1tgQKE-000848-5k for qemu-devel@nongnu.org; Fri, 07 Feb 2025 10:31:27 -0500 Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tgQK6-0003xs-JU for qemu-devel@nongnu.org; Fri, 07 Feb 2025 10:31:25 -0500 Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-5de4c7720bcso1090651a12.0 for ; Fri, 07 Feb 2025 07:31:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1738942277; x=1739547077; 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=3UFLMzp9qGvO/TMJfobXhH747ty7fBk8K8S5c0aFteA=; b=kOljxhz4VbNtfTFeYvbgwiMvzXMLiNtH7LM/Z2jQ14plEOuRY6r56EMcP7x94Opf7Z 3kJLTkaFcddZBZ+KJ+ZYY6WTZ4y3AAnHyUO5tSUyi/c89VfTdlnoJy8EOfHMRPuRjZhz 1JOKaoK5fcDPW9+jMtbbvCeiBVs2oMiiKIfQhfUaWSt0Gl8sLKSLmBwJhPcZqpg58unX w3g0YFRa1HS641Sk/bE9y/5nRTfD2bkjJSFc504R4CZ5Ach+MmAw5S0+FxxNLcISwCqd 9es6bEe31v/qRyJM6Jcx+2GzLtQGLthTLaiYVnTL2Q5ejGOSrOAJgJwgYo5WDRRceeCe TqWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738942277; x=1739547077; 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=3UFLMzp9qGvO/TMJfobXhH747ty7fBk8K8S5c0aFteA=; b=ifVa0h0kX2rXkygCs69fj+wBTG5wqe2yQQubFt7qVTn1v924b06iYia/bp6ApF2yAB Maw84vmxPucy7erB3wq6SqyOnNFxBeCxmAv3wIVEfNR/x5A8eV+qXXY9qp5mH0WA5P9x NkenWQStaYejFzJlfefluH02J3iKMUJecsG8NkNZ8KIyDywC96VLzDFlnSO2oQBShqIy StQMjI1HofwLTvww9AlD/OvL9p6Q0lZsLrglEMMEHRhNh8Y+2N7cdXLjRugYSEGCjy9Y 5vdCKPQhOtdWVcZ7j9qqxsKj/50RnpKNkLJbeovUpnnkApo96hvmAYf5IM2+57Cmg9ND B7cA== X-Gm-Message-State: AOJu0YyBMpvuFuu5PNa/Kqinb4SV7q9eHhXpppYd4e2/EIU96as86/yp ynDXwCf1DjF7nyl2/eAa+mAjl6nV3vz6ir0rG1Teu0MhNLJ6m5zHA8VDVz99UO8= X-Gm-Gg: ASbGncvtmUMJzZvqoxaSLhLDpgTunZyH70muTgXkQOuV1pJx8fCKO8IRWbyDWJzJhvI L31oFnX2n/Tk8XRJk+Zm2JSvmq47cUEpTwVy5He9p798pWBqqkvXmhm4w/n4D7RCPC1nihf0xPO /SRLq6HxX5njJS9PnZ0B/20+2budSj5M8lCorXgNoweC8I880f1mR1qpDMhsdoZklj0Sgk/3vk+ EjvZst5zv4GEDsH5EovysARDHI89k3KQ3W5argCj4EewVnWPrCVwXfjk9kVGTJy4Do07OXo81ey bW9Z0CCHimghlmUn/A== X-Received: by 2002:a05:6402:51cf:b0:5dc:57a5:c414 with SMTP id 4fb4d7f45d1cf-5de45088202mr4207907a12.30.1738942276558; Fri, 07 Feb 2025 07:31:16 -0800 (PST) Received: from draig.lan ([185.126.160.109]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5de52712538sm325379a12.49.2025.02.07.07.31.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Feb 2025 07:31:15 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 924C95FA60; Fri, 7 Feb 2025 15:31:12 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Peter Xu , =?utf-8?q?Alex_Benn=C3=A9e?= , Thomas Huth , Weiwei Li , qemu-arm@nongnu.org, Nicholas Piggin , Liu Zhiwei , Bin Meng , Tyrone Ting , Hao Wu , Kyle Evans , Alistair Francis , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Laurent Vivier , Riku Voipio , Harsh Prateek Bora , Fabiano Rosas , Alexandre Iooss , Laurent Vivier , Daniel Henrique Barboza , Warner Losh , Pierrick Bouvier , Palmer Dabbelt , Mahmoud Mandour , qemu-ppc@nongnu.org, Paolo Bonzini , qemu-rust@nongnu.org, qemu-riscv@nongnu.org Subject: [PATCH v2 02/17] tests/qtest: don't attempt to clock_step while waiting for virtio ISR Date: Fri, 7 Feb 2025 15:30:57 +0000 Message-Id: <20250207153112.3939799-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250207153112.3939799-1-alex.bennee@linaro.org> References: <20250207153112.3939799-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::534; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-x534.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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org This replicates the changes from 92cb8f8bf6 (tests/qtest: remove clock_steps from virtio tests) as there are no timers in the virtio code. We still busy wait and timeout though. Signed-off-by: Alex Bennée Reviewed-by: Thomas Huth --- v2 - fix trailing space --- tests/qtest/libqos/virtio-pci-modern.c | 6 ++---- tests/qtest/libqos/virtio-pci.c | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/tests/qtest/libqos/virtio-pci-modern.c b/tests/qtest/libqos/virtio-pci-modern.c index 18d118866f..4e67fcbd5d 100644 --- a/tests/qtest/libqos/virtio-pci-modern.c +++ b/tests/qtest/libqos/virtio-pci-modern.c @@ -173,13 +173,11 @@ static bool get_config_isr_status(QVirtioDevice *d) static void wait_config_isr_status(QVirtioDevice *d, gint64 timeout_us) { - QVirtioPCIDevice *dev = container_of(d, QVirtioPCIDevice, vdev); gint64 start_time = g_get_monotonic_time(); - do { + while (!get_config_isr_status(d)) { g_assert(g_get_monotonic_time() - start_time <= timeout_us); - qtest_clock_step(dev->pdev->bus->qts, 100); - } while (!get_config_isr_status(d)); + } } static void queue_select(QVirtioDevice *d, uint16_t index) diff --git a/tests/qtest/libqos/virtio-pci.c b/tests/qtest/libqos/virtio-pci.c index 485b8f6b7e..002bf8b8c2 100644 --- a/tests/qtest/libqos/virtio-pci.c +++ b/tests/qtest/libqos/virtio-pci.c @@ -171,13 +171,11 @@ static bool qvirtio_pci_get_config_isr_status(QVirtioDevice *d) static void qvirtio_pci_wait_config_isr_status(QVirtioDevice *d, gint64 timeout_us) { - QVirtioPCIDevice *dev = container_of(d, QVirtioPCIDevice, vdev); gint64 start_time = g_get_monotonic_time(); - do { + while (!qvirtio_pci_get_config_isr_status(d)) { g_assert(g_get_monotonic_time() - start_time <= timeout_us); - qtest_clock_step(dev->pdev->bus->qts, 100); - } while (!qvirtio_pci_get_config_isr_status(d)); + } } static void qvirtio_pci_queue_select(QVirtioDevice *d, uint16_t index) From patchwork Fri Feb 7 15:30:58 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 862987 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e42:0:b0:385:e875:8a9e with SMTP id r2csp384263wrt; Fri, 7 Feb 2025 07:35:45 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUtkLnSBYbuYxdxUm8p7ecSgbE5ilv6s7jl/1bHy/Z+BUu0G0885t/pTdT8A8rSXq6YcGXXtQ==@linaro.org X-Google-Smtp-Source: AGHT+IGVJ07IsUwhX2uPRL9JXPdQOYSkrbTJh1g4QNPQsxBYT0WCibHanWtiVARk5LZCfVFdfhw5 X-Received: by 2002:a05:620a:258c:b0:7b6:7970:6506 with SMTP id af79cd13be357-7c047c74e60mr520092685a.38.1738942545508; Fri, 07 Feb 2025 07:35:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1738942545; cv=none; d=google.com; s=arc-20240605; b=Zsmw5UiqbjATe+oBUO2+4jX7iSnh+wwo4g5Cgo2iKUvwd2352V0UXMmlSloHAx3WrL /d1Fa8lKDmkFsAmviD3oKcnYYdlfGJv5BMzd0hKXbsmLqKOJEprjvmnLPNo7o526YL4C GrpD0tPAby62w3NlfyKad2ovik/sdS0vWOeAbQhvf8F2sw0+tOUz2CRe/3oRdm4fLeB7 aJo4AT+EkLoaLvBVbyMaiIBWeFTQtiM+Rch2OAEixW4TJuU1B/yrz2mtkc7tf6VTZ3C4 JsquL7mXBfF+Uja7wPgI6bJn9dnMvbKDKiIc++fObb1E1KCrzFcHpxjcz65AWgWZXrPA QA4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=TgN34HFjNsDM8vD8ylx4YNq6temrMo6Bfwlmv/QI6BI=; fh=wU5jWsflgZeWkD4KPn0erLqYU9C64YFheOYh1YAvMfA=; b=e8ChoJGvXVX+Cj/YwZ9kcMD3979Non1AhJZYnde0UNIkiOFkIXjzYx13oebHKy3qwk uPjBi1qEAwrZ52SPma1D3cYCyjoBCRNjMQR5p9VB2XTqrhXeI1FCRRuLikV9Sm37dwCH A4kSOopsDYMwacqD9n5ccUvm4YNhFzPA0iQIz0TttSTo+uWb4JLWxzquLQLz1GEUywrq CJJ3eIvxYskBWnFlfrDCrSK9GR1meFzE753TQCN3BMheNHdZjutvG9hM2V3yl/ql8FUk 0T5INqJdpUgotYMMtx6Qqq2DwhPnbaGlPO9N7LnHS0PwCYlkrNlxxyAyLClcjDnQg3aC AyxQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Hhts110r; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-47153b6f40csi33262871cf.335.2025.02.07.07.35.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Feb 2025 07:35:45 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Hhts110r; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tgQLU-000122-Qr; Fri, 07 Feb 2025 10:32:44 -0500 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 1tgQKD-000842-QU for qemu-devel@nongnu.org; Fri, 07 Feb 2025 10:31:27 -0500 Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tgQK6-0003xZ-JI for qemu-devel@nongnu.org; Fri, 07 Feb 2025 10:31:24 -0500 Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-5dcd8d6f130so4399235a12.1 for ; Fri, 07 Feb 2025 07:31:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1738942276; x=1739547076; 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=TgN34HFjNsDM8vD8ylx4YNq6temrMo6Bfwlmv/QI6BI=; b=Hhts110rpdfD53pM2x8aBxsMRrtvw3A95Nt+5TOnjx1I6erYUU/6yjkq4uTPQKrPgz j7YUI5thE/4n2qSIQZHPUme6Iyw4E3qabnHKBqN8q8hI/OYB9bZE4CVbUKy6vGPtHRmN xrSOj0GEccvhTPwGOWUOVn4S/gqo20XxJzjTvkDAZ7zEFs0uvYyPW3aAFLaCUP0YCmfE mN/H9Kk2nI38P0FByFe8wrkMpbEiW5sU+YNtL0v5MD2Jil6dJUrJcdLt3VUlj9/WMwn0 /f8jAMwFrbiCMvFNRSBXH5LAcyWolJAHIFwRceM2wYfiuulxUcRL56zFA8SqQ2j6bvrL GZ/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738942276; x=1739547076; 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=TgN34HFjNsDM8vD8ylx4YNq6temrMo6Bfwlmv/QI6BI=; b=LBP6Lqqo45G8v7tHCZIFhDRcbuqhqCCVK2eG/Io+sWzq95gBeFom/GdGlSd4OgklxE rHxgLlzUZ+gVZ8Uamzrfw+jTqk4TTYE1aonBcr55xjRGGbJv7idL3Wh8uJfOCnAgNf6t YMOURAly++WvqRhG0ip2pMqdxWNXn1H+3tVU97iyniOG/ZxX3P7q66XWlI3LfFnhU4IX cAmQkbaYMLU3nGLrYZgkIKgvtr0jccUs8yGrBUZaYjPgjVZ95uaFFwdqEa5y9IGQXD2I 9tpBAIx++Oe9f0hnP2NSVhQlPUrM6cvVx+BtJzLzZfbNpwV+Ln8H7tnVuhZ9v170KVmP SpSA== X-Gm-Message-State: AOJu0YyiMv+yrrT1+Gd7pqCo+YDlugyshWjdACZsFt/KC2pxcqOKWU0j Azv1Aa+nBIFtRWeVmsu6Njm0qZHU+bn0KrPaNq7qlhNjjAXeg5oNJKeL5Ti3h2k= X-Gm-Gg: ASbGncuK3/8bGaZekYjRVIRC2H621veu4GaJ7wB/mJhX6h8Exw/4sM54RAfXYRSDKwM uz9DSrhtI/MEcKmM/rmrS0jyF+8vAt3MNRk+21QU8zJax+wLdI/gxHFnTMKaRrP7/looTxPPGKv XKkVovJ4hMe/uyXrldqnRytnki3W9RBWGunWd7imj+Q4tgP+RtoCqvnc2CAFIPVxGuvwPyAp5CN yQ5o66OxcTNfSoQwe8b2RG/GEutTxTXWyCXIf7aUukIwiAdmioRRVKOjF7HueJmTFVrGo/J03em KFubd5ze4mWWyQg3Cg== X-Received: by 2002:a05:6402:3903:b0:5dc:74f1:8a32 with SMTP id 4fb4d7f45d1cf-5de458c49d5mr4466459a12.28.1738942274649; Fri, 07 Feb 2025 07:31:14 -0800 (PST) Received: from draig.lan ([185.126.160.109]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5de46b7b480sm1366479a12.36.2025.02.07.07.31.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Feb 2025 07:31:13 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id A48D95FA80; Fri, 7 Feb 2025 15:31:12 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Peter Xu , =?utf-8?q?Alex_Benn=C3=A9e?= , Thomas Huth , Weiwei Li , qemu-arm@nongnu.org, Nicholas Piggin , Liu Zhiwei , Bin Meng , Tyrone Ting , Hao Wu , Kyle Evans , Alistair Francis , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Laurent Vivier , Riku Voipio , Harsh Prateek Bora , Fabiano Rosas , Alexandre Iooss , Laurent Vivier , Daniel Henrique Barboza , Warner Losh , Pierrick Bouvier , Palmer Dabbelt , Mahmoud Mandour , qemu-ppc@nongnu.org, Paolo Bonzini , qemu-rust@nongnu.org, qemu-riscv@nongnu.org Subject: [PATCH v2 03/17] tests/qtest: don't step clock at start of npcm7xx periodic IRQ test Date: Fri, 7 Feb 2025 15:30:58 +0000 Message-Id: <20250207153112.3939799-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250207153112.3939799-1-alex.bennee@linaro.org> References: <20250207153112.3939799-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::535; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-x535.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 autolearn=unavailable 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Until there are timers enabled the semantics of clock_step_next() will fail. Since d524441a36 (system/qtest: properly feedback results of clock_[step|set]) we will signal a FAIL if time doesn't advance. Signed-off-by: Alex Bennée Reviewed-by: Hao Wu --- tests/qtest/npcm7xx_timer-test.c | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/qtest/npcm7xx_timer-test.c b/tests/qtest/npcm7xx_timer-test.c index 58f58c2f71..43711049ca 100644 --- a/tests/qtest/npcm7xx_timer-test.c +++ b/tests/qtest/npcm7xx_timer-test.c @@ -465,7 +465,6 @@ static void test_periodic_interrupt(gconstpointer test_data) int i; tim_reset(td); - clock_step_next(); tim_write_ticr(td, count); tim_write_tcsr(td, CEN | IE | MODE_PERIODIC | PRESCALE(ps)); From patchwork Fri Feb 7 15:30:59 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 862979 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e42:0:b0:385:e875:8a9e with SMTP id r2csp382185wrt; Fri, 7 Feb 2025 07:32:08 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUzJUwmA2kFiRfDSN3I4I8b46NMAmyOHnHW81R2DKk91ULig8OGB1SQy7BRIttnCBJVdhgxrw==@linaro.org X-Google-Smtp-Source: AGHT+IGLpJwprAYUEjvJQPCED7myiB2UFDPgH+wkFUhJBw/ZEkytnbsMbPw3CidEbAfwdvA7PlMX X-Received: by 2002:a05:6214:2467:b0:6e2:4911:cd8a with SMTP id 6a1803df08f44-6e44568175dmr42561096d6.26.1738942328371; Fri, 07 Feb 2025 07:32:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1738942328; cv=none; d=google.com; s=arc-20240605; b=iP2Nno7awg6vXYdu6WhZ2C0ArNPntmk5zWFe92kisaBpo1pBoP0ZHSiBdG4N411gQe 8P43YvE3Ti5c9SJsYhkts5Rt3rmvPnZcFgUlKNLrFUF3+ydaJHEo8xOxWA5CyDd2hfkf I+XNAXpBlWbGqBu3XJMqrrqg+i69nacwq2Pt28zzfz3fyBq5D9//RioSaypJOwpIzHih 7LyWLuhj4/hWrc7dr/6yJyxplJwRJI9o5UjM/nxOVyPHJS1kn5ineWOc7+MdbAzITFMY yjL0ZS8hf8NT24+r1n+q8IXukDNqgaAlIQ/6tIMRHYhDXoNTEWRw2UdPv370valfSEYH +Tiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Um1CwtmhdsQHyRWJ4xWo6y2AlcWR+j1kN7yWOVUF0WM=; fh=09uoDjVTf/D2GxrqAPr7OHKGZ21Li2v1uxYs7VLD4AY=; b=c5IZcsHzkKEdKsF2Y0sdp+4vEjes6NDw8oEeH0ybkanUmO6KZVXznhLRJZlfuEe62Q GyCApUtDguaFCtsCVLOxc6sgHoA5a3J0ktr7+UW5Xy4IrkC2OS/i1daRhf8etLG7zXwu ar46HkhGMGYdGrWu3N7VbCcLbliwoThGcNIM8rJqmd849/Kf5P22nKpBMcPhWPwMWu/j ygFhscNfVT7sedyTljnjDY3tdkoNX08RP9FScsCtEaodXFhIZHZVKrsvGK6TnBCV7OBM 3gpn8xmwu8elijQf2XgTGjsN3XUnkAAIMF5l35m1WdOQk+ctdhN4beSCO8e/xXOG2HXP UQoA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LfD4fPp0; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 71dfb90a1353d-51f2279d2b9si703614e0c.105.2025.02.07.07.32.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Feb 2025 07:32:08 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LfD4fPp0; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tgQKP-00086j-De; Fri, 07 Feb 2025 10:31:38 -0500 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 1tgQK7-0007zb-Sk for qemu-devel@nongnu.org; Fri, 07 Feb 2025 10:31:19 -0500 Received: from mail-ed1-x52f.google.com ([2a00:1450:4864:20::52f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tgQK5-0003ww-Fr for qemu-devel@nongnu.org; Fri, 07 Feb 2025 10:31:19 -0500 Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-5dcf0de81ebso4306037a12.1 for ; Fri, 07 Feb 2025 07:31:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1738942274; x=1739547074; 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=Um1CwtmhdsQHyRWJ4xWo6y2AlcWR+j1kN7yWOVUF0WM=; b=LfD4fPp0TZbBGnBQ0dM6TTBLxRPNHtZOFOf5A8B5oqp8yXlj01MtfW7mXSe91PlpM6 u6W7s5aiY69tIaAgkneDz7QDHskuxOiieTU4ajNLXPPWpAtcQq4XOg9kEfMVTF4v3IVv iiWQEKD4OkyrNZsEmB5w0bquGDjleNaCL5a/CwnADK/+NQ9N7SZCTkRDMvXPmuTrB2pG QKH5N4KoLBIKoBdxO9pMhmlk4tOu6UccAjDgGq3yM6PAkjhim6wDHiQ9+cc2/dYqKYPe KEyCJB58dB5ZSa23KRyvQJ9eApF4aAKtjvAy/+9/vC3C9iYuSxV6FPqRF4CZNZ5/7a6B 7udg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738942274; x=1739547074; 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=Um1CwtmhdsQHyRWJ4xWo6y2AlcWR+j1kN7yWOVUF0WM=; b=utcJe5GNVVftKU3YfgOfY+83p/FqvVeyT11QbP85dbQsVPEufAqrtMmHHHqgfxqGPa qzTL7VUPTfgPSlB3mXdAy0Ohj1dFxp4dAjZcwSTUwItzH4nmfRHsVA40AbZzw2IigFF9 KQKsyj0Tx27/CY2/FUPR2rzxHMrTAbzKzX6F7wqxdUSEokPBrMJk4c9zXOyMpXToCVvh 3/wrA6X0TvSV2zzlnOprXnpLrC0kYeKbZIADh6RS4lCHfx5PennGTkc5r029vfpvFD94 jS+hHZIjMxJH5BA6PsHqeUqEYapxQXOlyVV185wzjzibzR70rmBZaShxElGe1SLoMGvx AymQ== X-Gm-Message-State: AOJu0YwtvII3DymOxtQzDb4S0t0ZUKzmJtjYJ2qEbvepNrRXOMyOo27v H3t3dFjKknDzrR/fwvvEYtiH1Il3MKSEWRLPb9MiBk17q7vtBErHprkZCvQUhYk= X-Gm-Gg: ASbGncuxN3SzAGyJwMJTWXwUVDmrjKdV8eom4tEhzt50EQaf4GrfILQzS6PxLF/i3Zp GoPw1laNKcSajsIjVAY/0XEQDLVbVJiLzrOHBZl3rFmRaHSwfoFlIOU+uMg835QjOeit5MHHus7 sFvPYL7oEjD9hPvJIDHvE7A/zdqQCvLqQlO60nrdlSae4NOjIMhwJfkpSgKPyvbdOvHNi74VK90 bJS4qXQn+fB+kj+oKxc42qVlbiMNFYqI4N4cNJbuga5sjxbaEtK+GapebEjgh0IKLXDKkKjLVyV rfU0F52GjauXrqbqOA== X-Received: by 2002:a17:907:7b06:b0:ab6:eec6:7cab with SMTP id a640c23a62f3a-ab789c3ac8amr448973266b.38.1738942273971; Fri, 07 Feb 2025 07:31:13 -0800 (PST) Received: from draig.lan ([185.126.160.109]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ab781453f04sm205306266b.161.2025.02.07.07.31.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Feb 2025 07:31:13 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id B6FC05FAD2; Fri, 7 Feb 2025 15:31:12 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Peter Xu , =?utf-8?q?Alex_Benn=C3=A9e?= , Thomas Huth , Weiwei Li , qemu-arm@nongnu.org, Nicholas Piggin , Liu Zhiwei , Bin Meng , Tyrone Ting , Hao Wu , Kyle Evans , Alistair Francis , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Laurent Vivier , Riku Voipio , Harsh Prateek Bora , Fabiano Rosas , Alexandre Iooss , Laurent Vivier , Daniel Henrique Barboza , Warner Losh , Pierrick Bouvier , Palmer Dabbelt , Mahmoud Mandour , qemu-ppc@nongnu.org, Paolo Bonzini , qemu-rust@nongnu.org, qemu-riscv@nongnu.org, Peter Maydell Subject: [PATCH v2 04/17] tests/qtest: simplify qtest_process_inbuf Date: Fri, 7 Feb 2025 15:30:59 +0000 Message-Id: <20250207153112.3939799-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250207153112.3939799-1-alex.bennee@linaro.org> References: <20250207153112.3939799-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::52f; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-x52f.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 autolearn=unavailable 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Don't both creating a GString to temporarily hold our qtest command. Instead do a simpler g_strndup and use autofree to clean up afterwards. Signed-off-by: Alex Bennée Reviewed-by: Peter Maydell --- system/qtest.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/system/qtest.c b/system/qtest.c index e68ed0f2a8..bb1efba9fd 100644 --- a/system/qtest.c +++ b/system/qtest.c @@ -763,25 +763,21 @@ static void qtest_process_command(CharBackend *chr, gchar **words) } } +/* + * Process as much of @inbuf as we can in newline terminated chunks. + * Remove the processed commands from @inbuf as we go. + */ static void qtest_process_inbuf(CharBackend *chr, GString *inbuf) { char *end; while ((end = strchr(inbuf->str, '\n')) != NULL) { - size_t offset; - GString *cmd; - gchar **words; - - offset = end - inbuf->str; + size_t len = end - inbuf->str; + g_autofree char *cmd = g_strndup(inbuf->str, len); + g_auto(GStrv) words = g_strsplit(cmd, " ", 0); - cmd = g_string_new_len(inbuf->str, offset); - g_string_erase(inbuf, 0, offset + 1); - - words = g_strsplit(cmd->str, " ", 0); + g_string_erase(inbuf, 0, len + 1); qtest_process_command(chr, words); - g_strfreev(words); - - g_string_free(cmd, TRUE); } } From patchwork Fri Feb 7 15:31:00 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 862981 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e42:0:b0:385:e875:8a9e with SMTP id r2csp382640wrt; Fri, 7 Feb 2025 07:32:51 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWF0JnJdDzz+N6L1T9woZYqd9+0HWtngVEeQZ/AJFG+1Mb98B8+RlyE++HAreFFHDcB6FsC6A==@linaro.org X-Google-Smtp-Source: AGHT+IFJhl4ni1iCHHTG3pA48NJ+D3KZSWxsaCOYKao4VrheE4kjJy41uxCxjc9yiqhWTqdrOvWX X-Received: by 2002:a05:600c:1c07:b0:434:ff9d:a3a1 with SMTP id 5b1f17b1804b1-4392497d81bmr32253085e9.2.1738942371201; Fri, 07 Feb 2025 07:32:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1738942371; cv=none; d=google.com; s=arc-20240605; b=IbopVrdJN6lgOkpT+a0o/X4oO6Yqauvqv8C2uLF1dFJLDNreKEhx3FfvKdLGhOYjKz N6dJ30PKGUy7z2ey9c+IZg+g1HXv1cd5Q45kRa38bb1pdSt2IlIiwcSqWQmA0brt7snw 0n3IakVM++AWBds4BIaGNc8dupxfduj0h3L5ZJrNhDPhxcFm5oNdxmQA8Xr1xIQuh8KX 49bB9ofdCgOs8Uljb8/keexc5e1rCwe4+lGU619s64mfQUG0tqEgvIeqRmmD5vUu9ad7 VENmZ1L/RiM9hw9KVkiMxsOp0cE0t47qRvhIqVi6a7jX125UoRrt+Q93YmvoGzcFG5NE 5pdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5lDr+EsB9w5MfJH5NPFFSWodYWU+B9nCbgauMyudXbU=; fh=wU5jWsflgZeWkD4KPn0erLqYU9C64YFheOYh1YAvMfA=; b=BpTiTJJEMmkwRGNOtGlbrVyoskbGEA39r4LzOeCDuBJfI8hVgpw10qFKjdW7eSoNZ3 8eTmlFZDHxMf/x8PGDUZ8WvlEmBPrZQQ+HlFz9tr3xCWr4JWOsjrh2BUSZXdX5cM0z4p uOqB2ZUDY9ajasYcOa1gxjltafn6QqYzohnWo30vLV+08u2KUY8Kd3SfhjWUM8KtGNCL xMpxsCaeMlUdbpewxj6HdABOVUsMyHNyPtpjn21RJ1h7NYVULGUnYR5VFKs36sNj2nF+ fmztS0gG6FhkOK/TCVDKxSQTLOQiIl/B86JYMfnxgjnVtSHYywmZBol6cWil+WQlNdvo KK+g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=P4X9tpfG; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 5b1f17b1804b1-4391daabe0fsi23726075e9.26.2025.02.07.07.32.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Feb 2025 07:32:51 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=P4X9tpfG; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tgQLU-00012M-Sr; Fri, 07 Feb 2025 10:32:45 -0500 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 1tgQKF-00085B-C4 for qemu-devel@nongnu.org; Fri, 07 Feb 2025 10:31:30 -0500 Received: from mail-ej1-x62c.google.com ([2a00:1450:4864:20::62c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tgQK7-0003yl-BX for qemu-devel@nongnu.org; Fri, 07 Feb 2025 10:31:26 -0500 Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-aaec61d0f65so487864966b.1 for ; Fri, 07 Feb 2025 07:31:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1738942277; x=1739547077; 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=5lDr+EsB9w5MfJH5NPFFSWodYWU+B9nCbgauMyudXbU=; b=P4X9tpfGGZlzbK7ymhNUbk3UfHthspQPQLyErWWEwB73Z0MfVGS15v6bvBk5QGeP9X xctUifOLrc3p78AJ+1L/bCb/lAUkk/7EItNuwOW3tgZwwW/Lv7+w7e2nRPSlXOrg/osz JBPmWcMNdGCqz7lPZEqCGuSLOyQWXwSv17C/WWFDtSsJStzf8tbQ4rvuZkkFUJUM+HNw PxWg3xHLVTxEPg5zXdFo1+z1Z6nUpmh13cDU3cw4FGup5CMrTzdNqpXaNp3PwnlMkd+X f7vDTCjPsfMUdbTritTS91ZY5Jpq7xc/3vCsAnro02Q+yzhU68s/iM+p6KMObkR6Ud7H 5bdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738942277; x=1739547077; 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=5lDr+EsB9w5MfJH5NPFFSWodYWU+B9nCbgauMyudXbU=; b=Qa0goGYQmFyqvf0jksyXaagTwPl0jmD65f8J5pLI0lZB+mh7KGw5Grl2i9KD4HaWjg Tgl8PEzbBk2Cuesvz6aUSmcQC0IOuvWGz9lUlwGhZZf7+zNjcOSFq3SLUisF2wMYNO+k NEjI1ojVjEoUWEib7FPOhWWZX3uwvmFMvFSJfH0gZfkA7rDSuQPS4Hc/4K2UoHRQC9B7 SdDQPqo9osG/o+FgK/wI21s/NfaD13gl1LlRK6t3i/Ri/zJJTiOeGftP8yw9CE1eXrF8 tiNOTVM04mXvdTtVDBnYK05HZi1KlxwmSfvcCZugc/boG93u3TSkRmAX1o5iZ8Rg/EGn jZ1Q== X-Gm-Message-State: AOJu0Yw0jz+xXHgrJ9It9hBfN5ceJ2LZDuEqXGH+Ojabe9Vs0jTbdhlP Wn0Hb+E2qfBvxDT4UYHxp1cE1mLnHKplyXbWdA9g/i94yr3+iX5gaitWxz447T8= X-Gm-Gg: ASbGncsk6+LDoCRQPFcufScVayCfk8ygDIyidoeSyAuqCA3pigWvRf49VkOlpPeWNdm NZmJfDl5pXJqHXBDV27C7bejiltdpVxYCpg/Wj7hlyhwH3r+MJW8hnQ76PrPqxri+57Vi9bqh// ZELefaUedz25WmMoguiFiX6v18/zxU3jMo95uxO2vWrTI4YWjhiXN3d2Vn2Fijnu+rf3wDM3Pqa mkhhP1DT3Mg0DbNHSxuCe6xuddLOffJdPIeHInszauVzBQ1fX8bZoYop9/akyiaBH/vVte2EZKg UzIiUFL3bknngw5nOg== X-Received: by 2002:a17:907:3e8d:b0:ab7:63fa:e49c with SMTP id a640c23a62f3a-ab789cbe110mr419239766b.36.1738942277438; Fri, 07 Feb 2025 07:31:17 -0800 (PST) Received: from draig.lan ([185.126.160.109]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ab772f84417sm286389666b.53.2025.02.07.07.31.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Feb 2025 07:31:15 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id CFA4B5FB14; Fri, 7 Feb 2025 15:31:12 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Peter Xu , =?utf-8?q?Alex_Benn=C3=A9e?= , Thomas Huth , Weiwei Li , qemu-arm@nongnu.org, Nicholas Piggin , Liu Zhiwei , Bin Meng , Tyrone Ting , Hao Wu , Kyle Evans , Alistair Francis , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Laurent Vivier , Riku Voipio , Harsh Prateek Bora , Fabiano Rosas , Alexandre Iooss , Laurent Vivier , Daniel Henrique Barboza , Warner Losh , Pierrick Bouvier , Palmer Dabbelt , Mahmoud Mandour , qemu-ppc@nongnu.org, Paolo Bonzini , qemu-rust@nongnu.org, qemu-riscv@nongnu.org Subject: [PATCH v2 05/17] tests/qtest: rename qtest_send_prefix and roll-up into qtest_send Date: Fri, 7 Feb 2025 15:31:00 +0000 Message-Id: <20250207153112.3939799-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250207153112.3939799-1-alex.bennee@linaro.org> References: <20250207153112.3939799-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62c; envelope-from=alex.bennee@linaro.org; helo=mail-ej1-x62c.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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org qtest_send_prefix never actually sent something over the chardev, all it does is print the timestamp to the QTEST_LOG when enabled. So rename the function, make it static, remove the unused CharDev and simplify all the call sites by handling that directly with qtest_send (and qtest_log_send). Signed-off-by: Alex Bennée Reviewed-by: Thomas Huth --- include/system/qtest.h | 1 - hw/ppc/spapr_rtas.c | 1 - hw/riscv/riscv_hart.c | 1 - system/qtest.c | 26 +++----------------------- 4 files changed, 3 insertions(+), 26 deletions(-) diff --git a/include/system/qtest.h b/include/system/qtest.h index c161d75165..6ddddc501b 100644 --- a/include/system/qtest.h +++ b/include/system/qtest.h @@ -24,7 +24,6 @@ static inline bool qtest_enabled(void) } #ifndef CONFIG_USER_ONLY -void qtest_send_prefix(CharBackend *chr); void G_GNUC_PRINTF(2, 3) qtest_sendf(CharBackend *chr, const char *fmt, ...); void qtest_set_command_cb(bool (*pc_cb)(CharBackend *chr, gchar **words)); bool qtest_driver(void); diff --git a/hw/ppc/spapr_rtas.c b/hw/ppc/spapr_rtas.c index df2e837632..503d441b48 100644 --- a/hw/ppc/spapr_rtas.c +++ b/hw/ppc/spapr_rtas.c @@ -565,7 +565,6 @@ static bool spapr_qtest_callback(CharBackend *chr, gchar **words) g_assert(rc == 0); res = qtest_rtas_call(words[1], nargs, args, nret, ret); - qtest_send_prefix(chr); qtest_sendf(chr, "OK %"PRIu64"\n", res); return true; diff --git a/hw/riscv/riscv_hart.c b/hw/riscv/riscv_hart.c index ad67cd7645..a55d156668 100644 --- a/hw/riscv/riscv_hart.c +++ b/hw/riscv/riscv_hart.c @@ -94,7 +94,6 @@ static bool csr_qtest_callback(CharBackend *chr, gchar **words) g_assert(rc == 0); csr_call(words[1], cpu, csr, &val); - qtest_send_prefix(chr); qtest_sendf(chr, "OK 0 "TARGET_FMT_lx"\n", (target_ulong)val); return true; diff --git a/system/qtest.c b/system/qtest.c index bb1efba9fd..28b6fac37c 100644 --- a/system/qtest.c +++ b/system/qtest.c @@ -265,7 +265,7 @@ static int hex2nib(char ch) } } -void qtest_send_prefix(CharBackend *chr) +static void qtest_log_timestamp(void) { if (!qtest_log_fp || !qtest_opened) { return; @@ -282,7 +282,7 @@ static void G_GNUC_PRINTF(1, 2) qtest_log_send(const char *fmt, ...) return; } - qtest_send_prefix(NULL); + qtest_log_timestamp(); va_start(ap, fmt); vfprintf(qtest_log_fp, fmt, ap); @@ -301,6 +301,7 @@ static void qtest_server_char_be_send(void *opaque, const char *str) static void qtest_send(CharBackend *chr, const char *str) { + qtest_log_timestamp(); qtest_server_send(qtest_server_send_opaque, str); } @@ -324,7 +325,6 @@ static void qtest_irq_handler(void *opaque, int n, int level) if (irq_levels[n] != level) { CharBackend *chr = &qtest->qtest_chr; irq_levels[n] = level; - qtest_send_prefix(chr); qtest_sendf(chr, "IRQ %s %d\n", level ? "raise" : "lower", n); } @@ -380,19 +380,16 @@ static void qtest_process_command(CharBackend *chr, gchar **words) is_outbound = words[0][14] == 'o'; dev = DEVICE(object_resolve_path(words[1], NULL)); if (!dev) { - qtest_send_prefix(chr); qtest_send(chr, "FAIL Unknown device\n"); return; } if (is_named && !is_outbound) { - qtest_send_prefix(chr); qtest_send(chr, "FAIL Interception of named in-GPIOs not yet supported\n"); return; } if (irq_intercept_dev) { - qtest_send_prefix(chr); if (irq_intercept_dev != dev) { qtest_send(chr, "FAIL IRQ intercept already enabled\n"); } else { @@ -419,7 +416,6 @@ static void qtest_process_command(CharBackend *chr, gchar **words) } } - qtest_send_prefix(chr); if (interception_succeeded) { irq_intercept_dev = dev; qtest_send(chr, "OK\n"); @@ -438,7 +434,6 @@ static void qtest_process_command(CharBackend *chr, gchar **words) dev = DEVICE(object_resolve_path(words[1], NULL)); if (!dev) { - qtest_send_prefix(chr); qtest_send(chr, "FAIL Unknown device\n"); return; } @@ -457,7 +452,6 @@ static void qtest_process_command(CharBackend *chr, gchar **words) irq = qdev_get_gpio_in_named(dev, name, num); qemu_set_irq(irq, level); - qtest_send_prefix(chr); qtest_send(chr, "OK\n"); } else if (strcmp(words[0], "outb") == 0 || strcmp(words[0], "outw") == 0 || @@ -480,7 +474,6 @@ static void qtest_process_command(CharBackend *chr, gchar **words) } else if (words[0][3] == 'l') { cpu_outl(addr, value); } - qtest_send_prefix(chr); qtest_send(chr, "OK\n"); } else if (strcmp(words[0], "inb") == 0 || strcmp(words[0], "inw") == 0 || @@ -501,7 +494,6 @@ static void qtest_process_command(CharBackend *chr, gchar **words) } else if (words[0][2] == 'l') { value = cpu_inl(addr); } - qtest_send_prefix(chr); qtest_sendf(chr, "OK 0x%04x\n", value); } else if (strcmp(words[0], "writeb") == 0 || strcmp(words[0], "writew") == 0 || @@ -537,7 +529,6 @@ static void qtest_process_command(CharBackend *chr, gchar **words) address_space_write(first_cpu->as, addr, MEMTXATTRS_UNSPECIFIED, &data, 8); } - qtest_send_prefix(chr); qtest_send(chr, "OK\n"); } else if (strcmp(words[0], "readb") == 0 || strcmp(words[0], "readw") == 0 || @@ -571,7 +562,6 @@ static void qtest_process_command(CharBackend *chr, gchar **words) &value, 8); tswap64s(&value); } - qtest_send_prefix(chr); qtest_sendf(chr, "OK 0x%016" PRIx64 "\n", value); } else if (strcmp(words[0], "read") == 0) { g_autoptr(GString) enc = NULL; @@ -593,7 +583,6 @@ static void qtest_process_command(CharBackend *chr, gchar **words) enc = qemu_hexdump_line(NULL, data, len, 0, 0); - qtest_send_prefix(chr); qtest_sendf(chr, "OK 0x%s\n", enc->str); g_free(data); @@ -613,7 +602,6 @@ static void qtest_process_command(CharBackend *chr, gchar **words) address_space_read(first_cpu->as, addr, MEMTXATTRS_UNSPECIFIED, data, len); b64_data = g_base64_encode(data, len); - qtest_send_prefix(chr); qtest_sendf(chr, "OK %s\n", b64_data); g_free(data); @@ -649,7 +637,6 @@ static void qtest_process_command(CharBackend *chr, gchar **words) len); g_free(data); - qtest_send_prefix(chr); qtest_send(chr, "OK\n"); } else if (strcmp(words[0], "memset") == 0) { uint64_t addr, len; @@ -673,7 +660,6 @@ static void qtest_process_command(CharBackend *chr, gchar **words) g_free(data); } - qtest_send_prefix(chr); qtest_send(chr, "OK\n"); } else if (strcmp(words[0], "b64write") == 0) { uint64_t addr, len; @@ -705,10 +691,8 @@ static void qtest_process_command(CharBackend *chr, gchar **words) address_space_write(first_cpu->as, addr, MEMTXATTRS_UNSPECIFIED, data, len); - qtest_send_prefix(chr); qtest_send(chr, "OK\n"); } else if (strcmp(words[0], "endianness") == 0) { - qtest_send_prefix(chr); if (target_words_bigendian()) { qtest_sendf(chr, "OK big\n"); } else { @@ -726,7 +710,6 @@ static void qtest_process_command(CharBackend *chr, gchar **words) QEMU_TIMER_ATTR_ALL); } new_ns = qemu_clock_advance_virtual_time(old_ns + ns); - qtest_send_prefix(chr); qtest_sendf(chr, "%s %"PRIi64"\n", new_ns > old_ns ? "OK" : "FAIL", new_ns); } else if (strcmp(words[0], "module_load") == 0) { @@ -734,7 +717,6 @@ static void qtest_process_command(CharBackend *chr, gchar **words) int rv; g_assert(words[1] && words[2]); - qtest_send_prefix(chr); rv = module_load(words[1], words[2], &local_err); if (rv > 0) { qtest_sendf(chr, "OK\n"); @@ -752,13 +734,11 @@ static void qtest_process_command(CharBackend *chr, gchar **words) ret = qemu_strtoi64(words[1], NULL, 0, &ns); g_assert(ret == 0); new_ns = qemu_clock_advance_virtual_time(ns); - qtest_send_prefix(chr); qtest_sendf(chr, "%s %"PRIi64"\n", new_ns == ns ? "OK" : "FAIL", new_ns); } else if (process_command_cb && process_command_cb(chr, words)) { /* Command got consumed by the callback handler */ } else { - qtest_send_prefix(chr); qtest_sendf(chr, "FAIL Unknown command '%s'\n", words[0]); } } From patchwork Fri Feb 7 15:31:01 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 862986 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e42:0:b0:385:e875:8a9e with SMTP id r2csp383542wrt; Fri, 7 Feb 2025 07:34:27 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCW+eo7yrkHsPJuCO3DHr952eiASD+XU22rUR8Y72cDLLEpTxtB3Y2bJj7pJuplaPAhnKF4Y/Q==@linaro.org X-Google-Smtp-Source: AGHT+IF9W/FbaF7u2CBkaa0sgi90tpfPvxlLjw3zm7OhppfR/vTntRpUrH1/+VlgdOEGj7ke5g4/ X-Received: by 2002:a05:620a:1925:b0:7b6:d089:274c with SMTP id af79cd13be357-7c047c5833bmr587779685a.34.1738942467231; Fri, 07 Feb 2025 07:34:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1738942467; cv=none; d=google.com; s=arc-20240605; b=WI/YisZBVY5YmSqUQE41EyCk6AAYdFeoT7Of4vygj+V6krw13c3zufefKPY+baQIjZ cyHhwmJChorduzcSTwgl53ZEap0SmDkrbU+rYRUlkxwYCZ4re7u08BmMhoLeP5VU1ljC P5TZTXwSwIYOFakyh4GLSQdiUK48Owo9WFqMMZN9hgau/Kik22ZMHs6IZDqvhAcB9qYw zwQlDqteQ4QqG1j3PwrJ43WO/M5QcpI0orZuImbxiM3zZL3Kq4ZeT1bYhFDuOcxSQB1F /ByXQhUMk9nJuaFwGOPE6MtS8bnA+7kAwQSvecfPvXvP8uAwUVCg9Md/UPVcWwmeF6iG EOyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=XyHIrLgGLhzWXn2IY26JotGt/snZhuH8wc9tGSgEE4k=; fh=09uoDjVTf/D2GxrqAPr7OHKGZ21Li2v1uxYs7VLD4AY=; b=e80/+q+0nwoSTFpS38+CUbizezXru+D9U70uINirY4Gk8bcUNvsEZ2Mua4cXwilvvt 1o/WzgBBQe+GMTkoFN2czi0EVatj4V0s8OIlvAEkbGikA1b98mexd6lYT51ZhOGVcDPW Pv3uHCMi2wCi4VojmBCpiIjRvOQB1sfZC/V3G8HgvdG5mrgak8S+lRXz6VTcCHDbK09T Lt2lQAoG9lA0BC7SrwRFCu7p1ID8SrG/98kdOvSaDes2W0aD2/Zcls5wcPtWV7ePH/ot Ig1YtRxaHNJLxJnDi1lpf7wgg3eTSYYP9t7QV6joNlhvj3OMk0zFvBDiq1u4o7Rx0Ers weBA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=X1b0NquH; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7c041df4dc3si356299685a.131.2025.02.07.07.34.27 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Feb 2025 07:34:27 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=X1b0NquH; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tgQLQ-0000o3-Ek; Fri, 07 Feb 2025 10:32:40 -0500 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 1tgQKL-00089W-Bq for qemu-devel@nongnu.org; Fri, 07 Feb 2025 10:31:37 -0500 Received: from mail-ed1-x52a.google.com ([2a00:1450:4864:20::52a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tgQKA-000405-1d for qemu-devel@nongnu.org; Fri, 07 Feb 2025 10:31:31 -0500 Received: by mail-ed1-x52a.google.com with SMTP id 4fb4d7f45d1cf-5de47cf9329so1454686a12.3 for ; Fri, 07 Feb 2025 07:31:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1738942280; x=1739547080; 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=XyHIrLgGLhzWXn2IY26JotGt/snZhuH8wc9tGSgEE4k=; b=X1b0NquHt1rIGSgOTDLIwVmnCFmHAru0dQynHnPA9OXEeFUvzxH/8MN1q/kcbfu6Rd vq+WHDNwZ6tma0BAAXb8/wMxh63e2d7jUWKa/CUhZFiV3M3SuZS9bGIuerbpv+NF0/cm NSoXVO1Rfsq/pBCuoTDi64lfncVsCxjFfuF9rjeBD1XzLaGB0SSVPoczjUg/QwRtOKqF JmQDeUClCDC4p5OYYY1rkFmb6Wg8ZSLNFWv/0zSikCjRPmFgokyZN18gqbqV1C1YfdUy VEI//fq99O8Q65RNCqrlTqbwbfZvtlwHcC/35Ww21cTW4HGIvZMsi14UkyPUI4tbMy7F EbFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738942280; x=1739547080; 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=XyHIrLgGLhzWXn2IY26JotGt/snZhuH8wc9tGSgEE4k=; b=EkwVGNWvfPC0Ci1TMVJ/OHE12TyNzZzkFSwpfAaW9d9/WfIadEZkGhkYDMj1vUXaLd pyNT69MIXDaFkdB/Hig+ZnilCk0D6YpfE8s1R8HM02pemgStHENdsTLattTdjyzor0yR 16a16fvKn/ciL8omuZUtnaU90gGhBb5PWtZMrXDWNjSfNkRYmuz2QhReD+yK2251Kboa ExR6VJKrou17KV2lq04irJKVE5aBc+yEjerKp7NFhl3r3tztdiM2eL9eM4AX76nqMDLm Uml/uoGk5TwGdVPG+5LH96KKlpyt0m16W7meB5cq6vIef3fEJq6axnwi1SiPNAB4GzX8 J37Q== X-Gm-Message-State: AOJu0Yw1W8Ou7VVlog5i8s5IbRhbBCiosrtmygeMjTwjRJIuEsVjInxy 3+S47iPkbghtATHxHMyZaDtUIYRB+JK/ZgLSfIRvn4lmLGHrIwtoNfduF+UwIvE= X-Gm-Gg: ASbGncuZrqa1/ixHzTZY8jp2Ba9lgj4ItEkXE6SAQiC5uOSg2E10TUmwlbOQ+dAGXik 52eCTHrEu8xxx1refU9t9un/zN5nzXyCz2r9IcEkozJugnkWyAYJ0MrR5D7iIJS98sqROE2Vfce QluMGTq9Z04JXz9+Z3i1mLgftEfU1jhD+tT29T0tu1fXygVUYflWCPYjPMDYG9zNIUgtff2+kOt KoV2kee/2D5jHqtJmGMcSwO4EdCXx9mEJtGkUw065I3O8scOx7aYPxmLKdio48LYhW3qroWVTDG dwyuiKIAZK9mhIzbww== X-Received: by 2002:a05:6402:4588:b0:5db:731d:4456 with SMTP id 4fb4d7f45d1cf-5de45085cc7mr4289105a12.28.1738942280178; Fri, 07 Feb 2025 07:31:20 -0800 (PST) Received: from draig.lan ([185.126.160.109]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5dcf1b81608sm2621482a12.35.2025.02.07.07.31.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Feb 2025 07:31:17 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id E35E65FB2E; Fri, 7 Feb 2025 15:31:12 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Peter Xu , =?utf-8?q?Alex_Benn=C3=A9e?= , Thomas Huth , Weiwei Li , qemu-arm@nongnu.org, Nicholas Piggin , Liu Zhiwei , Bin Meng , Tyrone Ting , Hao Wu , Kyle Evans , Alistair Francis , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Laurent Vivier , Riku Voipio , Harsh Prateek Bora , Fabiano Rosas , Alexandre Iooss , Laurent Vivier , Daniel Henrique Barboza , Warner Losh , Pierrick Bouvier , Palmer Dabbelt , Mahmoud Mandour , qemu-ppc@nongnu.org, Paolo Bonzini , qemu-rust@nongnu.org, qemu-riscv@nongnu.org, Peter Maydell Subject: [PATCH v2 06/17] tests/qtest: tighten up the checks on clock_step Date: Fri, 7 Feb 2025 15:31:01 +0000 Message-Id: <20250207153112.3939799-7-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250207153112.3939799-1-alex.bennee@linaro.org> References: <20250207153112.3939799-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::52a; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-x52a.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 autolearn=unavailable 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org It is invalid to call clock_step with an implied time to step forward as if no timers are running we won't be able to advance. Signed-off-by: Alex Bennée Reviewed-by: Peter Maydell --- v3 - used Peter's suggested wording - used plain old if over ternary operator --- system/qtest.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/system/qtest.c b/system/qtest.c index 28b6fac37c..12152efbcd 100644 --- a/system/qtest.c +++ b/system/qtest.c @@ -708,10 +708,19 @@ static void qtest_process_command(CharBackend *chr, gchar **words) } else { ns = qemu_clock_deadline_ns_all(QEMU_CLOCK_VIRTUAL, QEMU_TIMER_ATTR_ALL); + if (ns < 0) { + qtest_send(chr, "FAIL " + "cannot advance clock to the next deadline " + "because there is no pending deadline\n"); + return; + } } new_ns = qemu_clock_advance_virtual_time(old_ns + ns); - qtest_sendf(chr, "%s %"PRIi64"\n", - new_ns > old_ns ? "OK" : "FAIL", new_ns); + if (new_ns > old_ns) { + qtest_sendf(chr, "OK %"PRIi64"\n", new_ns); + } else { + qtest_sendf(chr, "FAIL could not advance time\n"); + } } else if (strcmp(words[0], "module_load") == 0) { Error *local_err = NULL; int rv; From patchwork Fri Feb 7 15:31:02 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 862988 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e42:0:b0:385:e875:8a9e with SMTP id r2csp384265wrt; Fri, 7 Feb 2025 07:35:45 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVQSniysdKtCOjMbxO6IB8go8+8EPdIznKDzKOL0oQibaMeCYEq2h3K1jJLFn8qMjiYzFGiKQ==@linaro.org X-Google-Smtp-Source: AGHT+IF4gqfqlvyk1KrnDTgX5QOmBl+hqFVxFsB+gkRPuHqb/XvDD6629AJryfC1Q51A5aal9aji X-Received: by 2002:a05:690c:6d09:b0:6f9:7ce7:b107 with SMTP id 00721157ae682-6f9b29e4ea4mr33502177b3.29.1738942545676; Fri, 07 Feb 2025 07:35:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1738942545; cv=none; d=google.com; s=arc-20240605; b=fd4BRGAYdlYALoED5DqhaDGW2xXlPxHVIrCS8uRFiM84ZpTciCGIzOLrmbqfoJBw4m iYc2xSD6FrEWOfzpMfVqhENVtgOCm/VBS//exsjOooAw/1guwmxYlx/EL5JCq9Xnf+9W sJS/yNep3DIEy+ovxyuveKzROyd9QAnYpxnwSU5WjujeppN0md4pXUsfMgBid7G+emDN u84gtxvNJi9jcTXLzMNwFcbSOnuZ5CiJvC2kyghlj7nYZxj6sCBogXBLD9h5OZLpZP/4 VhITFLvBWNywAsSweBjuJ5KZzOwyk/9ictPVPdFCYRCD4UJ8kfXY9WWI9PHEV9Tx6zWj QJDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3ShDl4eTjpRUeb9COlaeWxryj/oOTu67dB6IU90OsGA=; fh=09uoDjVTf/D2GxrqAPr7OHKGZ21Li2v1uxYs7VLD4AY=; b=Q6ZkCalxnRp5RNGVejAXatvo6QPNLxPFESCfZLhbu5Ba8V4Et9kmqLIwzzm27TryQH XozHJAFaTf9gjASt/q6WU0QLg9XhN2H7H2uivJyuMkJpx7PYFFbyTshCMVEAp0ShKtMI kaXNmhGzqphBXuNyZJvco8hOnZ+Z9S47ZDtm97PbyKrd/4zJLUbbImabX5k8AxM7Y4gU yO4c6UhofAKTNN3dJZAEpQc2QBDN0C7TGK9onoxP31KjFfD1TXl5CUaa/qv/npLrFgMq kJBKpjjX/9v21B6BJnM2zTn8jzBvf6rWMA5n/M8OeAKhzJiQFRmf34ZGs8t6byPr5+il WLgA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qN+TLRrM; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 00721157ae682-6f9a0004580si30969707b3.452.2025.02.07.07.35.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Feb 2025 07:35:45 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qN+TLRrM; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tgQLZ-0001J3-Iw; Fri, 07 Feb 2025 10:32:49 -0500 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 1tgQKM-00089p-Gm for qemu-devel@nongnu.org; Fri, 07 Feb 2025 10:31:37 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tgQKA-00040G-BR for qemu-devel@nongnu.org; Fri, 07 Feb 2025 10:31:33 -0500 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-4361f796586so26526735e9.3 for ; Fri, 07 Feb 2025 07:31:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1738942280; x=1739547080; 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=3ShDl4eTjpRUeb9COlaeWxryj/oOTu67dB6IU90OsGA=; b=qN+TLRrM+CQ6pbf/o4nNo7t+48evrOK0IR5AIgeH1HehlFaIRMS+lx+9bfIn+hQQUk ONgvmBFV2hsCwsQJKfMZrIJQ9NqR4oaox4muXtl0UJ8XOXDys7n54IS/ddq//tOIC36l 0mVvpq8mVkT4Ki8aOBFGI9UnbIOxUhYB8B530Y2+U6mmmNhiwhIOaxFuWjLQoA+a19Ya /UXRCvk+OvODgGb935bzBhw8js61ETWMuT5acIJLDLjVgx1sPSyxso28kz0kcCssQAgi nM/9mnr7ei7bUfFF/XZI0V5EDkLOn1Kuw0/LZnZxLWIzArberku0eexc5WOvcZUmd5+A JIVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738942280; x=1739547080; 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=3ShDl4eTjpRUeb9COlaeWxryj/oOTu67dB6IU90OsGA=; b=kxcLHhesNPxs+f8O7PLz5Z0sxII/rVTDT2kf8hcEDGpaOgimah8xS2b1bPqsyO56Gh R1OsN87uzJgH84ebZaynNvE52U5/qjrMXXv6PlqL7i7Reg+gUhco82uj5q2Ua8cxc+Jp C4YmVutN2ogv/tkhzUBjwqcb5RTS8aCuPX8uCj5O3wynSLQYMGhu/UaZrhIM6mgypcnO Vatwb5VQ9xkHnZkUjirx/9/eAB/23+nKYlaW/qLpXV4zURJefR5w8VAwRPqAaPiMgGg6 FD2gYFZyUz86gUBSDYcOCkuVJO9V/WiWEclCoAAeWBO2LIk5rXfHalFEsIN0aPob5A4X 4tYQ== X-Gm-Message-State: AOJu0Yy8HhO56gjfpvvh3tD11OxmchvzE1eslvSXpMD6LelANPQTb8s9 tcxG3yXjNfWhTixksD6SR4NQk7Oj00U2C4qs9VTmR3u+zhops08oOYv10aphpn8= X-Gm-Gg: ASbGncvMEgP3A7a8Su7SeWKBKY5TU9lLZvAnbsagoxoWod3wnLDkVm6CIRccKXCrFeb mmOey5nevkIzdgZWyNjqQRR2395sBPcPEVZYoEAPQEV/d+/gCzgubKng4ArbhbhXorkZ8r5EqQk dh2Q077ItuG6NCUuVyzmVCCCs/E+SHXlZFIvET3hx14v5xKC0w+5Da4WBjj5IxF8urKsBplWl35 Gm1FbOkWUpJ1oTEiSPtYf7jpdaiyVs+vPg92OXWLekLOkpYZz/paIdT5nGErNuP0/miGrVAVyf8 hcGiU1gxShCfjnWT5Q== X-Received: by 2002:a05:600c:1e23:b0:434:a04d:1670 with SMTP id 5b1f17b1804b1-439248c2c07mr44057015e9.0.1738942278829; Fri, 07 Feb 2025 07:31:18 -0800 (PST) Received: from draig.lan ([185.126.160.109]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ab79378ee30sm54936666b.160.2025.02.07.07.31.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Feb 2025 07:31:15 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 016CE5FB89; Fri, 7 Feb 2025 15:31:13 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Peter Xu , =?utf-8?q?Alex_Benn=C3=A9e?= , Thomas Huth , Weiwei Li , qemu-arm@nongnu.org, Nicholas Piggin , Liu Zhiwei , Bin Meng , Tyrone Ting , Hao Wu , Kyle Evans , Alistair Francis , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Laurent Vivier , Riku Voipio , Harsh Prateek Bora , Fabiano Rosas , Alexandre Iooss , Laurent Vivier , Daniel Henrique Barboza , Warner Losh , Pierrick Bouvier , Palmer Dabbelt , Mahmoud Mandour , qemu-ppc@nongnu.org, Paolo Bonzini , qemu-rust@nongnu.org, qemu-riscv@nongnu.org, Peter Maydell Subject: [PATCH v2 07/17] Revert "util/timer: avoid deadlock when shutting down" Date: Fri, 7 Feb 2025 15:31:02 +0000 Message-Id: <20250207153112.3939799-8-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250207153112.3939799-1-alex.bennee@linaro.org> References: <20250207153112.3939799-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x331.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 autolearn=unavailable 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org This reverts commit bc02be4508d8753d1f6071b77d10f4661587df6f. Now we catch attempts to clock_step to the next timer when none are enabled we can revert the previous attempt to prevent deadlock. As long as a new target time is given we will move time forward even if no timers will fire. This is desirable for tests which are checking that nothing changes when things are disabled. Previously most tests got away with it because --enable-slirp always has a timer running while the test is active. Signed-off-by: Alex Bennée Reviewed-by: Peter Maydell --- util/qemu-timer.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/util/qemu-timer.c b/util/qemu-timer.c index 0e8a453eaa..3243d2c515 100644 --- a/util/qemu-timer.c +++ b/util/qemu-timer.c @@ -675,17 +675,10 @@ int64_t qemu_clock_advance_virtual_time(int64_t dest) { int64_t clock = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); AioContext *aio_context; - int64_t deadline; - aio_context = qemu_get_aio_context(); - - deadline = qemu_clock_deadline_ns_all(QEMU_CLOCK_VIRTUAL, - QEMU_TIMER_ATTR_ALL); - /* - * A deadline of < 0 indicates this timer is not enabled, so we - * won't get far trying to run it forward. - */ - while (deadline >= 0 && clock < dest) { + while (clock < dest) { + int64_t deadline = qemu_clock_deadline_ns_all(QEMU_CLOCK_VIRTUAL, + QEMU_TIMER_ATTR_ALL); int64_t warp = qemu_soonest_timeout(dest - clock, deadline); qemu_virtual_clock_set_ns(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + warp); @@ -693,9 +686,6 @@ int64_t qemu_clock_advance_virtual_time(int64_t dest) qemu_clock_run_timers(QEMU_CLOCK_VIRTUAL); timerlist_run_timers(aio_context->tlg.tl[QEMU_CLOCK_VIRTUAL]); clock = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); - - deadline = qemu_clock_deadline_ns_all(QEMU_CLOCK_VIRTUAL, - QEMU_TIMER_ATTR_ALL); } qemu_clock_notify(QEMU_CLOCK_VIRTUAL); From patchwork Fri Feb 7 15:31:03 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 862992 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e42:0:b0:385:e875:8a9e with SMTP id r2csp385357wrt; Fri, 7 Feb 2025 07:37:53 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCV6GzLp9FiDWdslevHdToiLkz2B4Fp9+iYbZrPrqIV1dxud7m0MCNb2lx8ixchfC/XBEb14Ow==@linaro.org X-Google-Smtp-Source: AGHT+IFezTsTo4Rx4awFKh1Sp9MMQWy8zYdk7vtnaZzQTeCcfLEGU2q3HNAsRHgfzgiHaHgv9ZnI X-Received: by 2002:a05:6102:3125:b0:4ba:9689:8703 with SMTP id ada2fe7eead31-4ba9689886bmr493217137.10.1738942673065; Fri, 07 Feb 2025 07:37:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1738942673; cv=none; d=google.com; s=arc-20240605; b=ORnJbMjqmEheXhW04sBkhymdXdj6usKpv6RNJy2ALD7QXW43L/jtBeCDSwjj+r5BM+ phLECenFx1VPCDl5PNGSLwoBFVM7Nj5g1IQpSxEu29LUkgyWENLnIpaSqbFz34qSjUXa SOhTeMLkYnhu3HXPkcKtmopFUGK/KSaH6l75G/XGSy2DCF4gaN1Z34cDsroFF+x2UWuC 35JtSFJlZvy48QTxSGfbky+9kjHXZshEZjnvAjpWjlWCfinDjYHzIL9epR1SmRr0U2mn HxNAARjTwwitUgI6VJ7Ou+bbjhqK8deZmjJu8SFzfXVfLz4TVVbnpOPFATf7Zhy7FZt3 71uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/x9zyKNP0wyMOO0OkiqcKDY+CZg3kixX2J65CnFDQGk=; fh=wU5jWsflgZeWkD4KPn0erLqYU9C64YFheOYh1YAvMfA=; b=L668wpIcljRZZMxqgpXQkaQYKvqgbuwHR6eN5K3kBDO+0UFf0W+RB9/QN1ID7/hAsr gjH16+hMVIvnWB5OB0QjB6WsRgScalaUpPVTIqWvemHHj4VYZhIiML4ccp8pUG1wbm8E krhOtPmOGh6Ng1rKdIfDAa6KVxgZ+SNpTkPy2rIjBBUgqUItC1/wipA1s3I2C7KB7/UM K+My3ETJONyajb7+wXlBZhmCV976Cjb1rtLomtfPBHN20ZBldiAY61ZPU3HBIngSrtFa dXD5Klcw7aEm0d3Uc+ovHuMk35cLe4QbT7vQD52ecowO2dQOEgQhqWM6vAkCcJ5XCzDo gBjA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fFzn8Azy; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ada2fe7eead31-4ba778c432dsi810173137.457.2025.02.07.07.37.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Feb 2025 07:37:53 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fFzn8Azy; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tgQLX-0001AP-6Z; Fri, 07 Feb 2025 10:32:47 -0500 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 1tgQKJ-00087K-6g for qemu-devel@nongnu.org; Fri, 07 Feb 2025 10:31:33 -0500 Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tgQK7-0003z1-QY for qemu-devel@nongnu.org; Fri, 07 Feb 2025 10:31:30 -0500 Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-5dccc90a4f1so4648741a12.2 for ; Fri, 07 Feb 2025 07:31:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1738942278; x=1739547078; 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=/x9zyKNP0wyMOO0OkiqcKDY+CZg3kixX2J65CnFDQGk=; b=fFzn8Azyi/tOvnjtCSr/pHbD33c854QJmQJFUGkIwNNwT4rMasfRuXV4Y94YdPOSCP INsKNDneRyi+W85DVOh+HdyaqbMUs0GDyC7OFboa5y6Q0nODorRpk+XJtC6F3eLXX8Q+ Xa5dDLKyXNDIV8g35TqbOwU+dyiCfJj0KSDu/d/Rb0s1SyQ6Dj3iXTZiyn/2ppqx7EAY GEvWh09nfnZaKlza1BpCkaxHQLNGFJ9yPdmDyyR97W5nTYpZfX3FGryjch4WlJyYOtsA u6OCUlLogTMRjbDIahlR6pQ/g2oxxcJGLCnCKK7KsVPyMW9Rmn/jgZfyuGz3FWFijL4c t02w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738942278; x=1739547078; 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=/x9zyKNP0wyMOO0OkiqcKDY+CZg3kixX2J65CnFDQGk=; b=WZ01V5MhMOHkg+exzf09mpzzxDaSzmzjDOTOVFQzs44otuhf9BiPMMCl5ndvYt6KR6 vAY160u5PMPxoVXZTTh4dse0yF+zEZCd9k8Y1nrMvUP1JyExnGjYU9pHcObRsQuxH3Ux /hBZW5rsE40f1lmcF+e8rSl2FmWoIfJp8F/VEkvSpemtmPFoJ9Oe9sFSF/pIpns/U1v2 t2HFpOZ/NzLlOjSNXGNnT00V3jSN/hzk6i/ZocstGDUPElHMRkTR3ItbEEd/aCuSV0eB oZ+B297xrArwns39spfgNA2Bd8htD0YwMwSp+8xAxeNCXSAl9zyG4u3pCHH9zC7bR4pc RmNg== X-Gm-Message-State: AOJu0YzmXmFynN4rUELtre5NHU0CqIe/+Ndfo9Jzt2dPbjtSiXJNiDew JZpCJqxod0CBrezQfsg5l+nPmyrwRXPK4MUDqubrYQmNUcx1hc+s5QnIMeBoCZk= X-Gm-Gg: ASbGncuSPDmPDZFUbOdlkfvAyF3xUUmA/1eR80x2rjoto5tvGOa71nDsMlFcKF2aF6I Vj0lEwZm/xsb6/f40vozgZUPayJfvvGDhd/N+XYTifPK085FLJBkxF3A079Yuxh8Q3epAsJitSz 3/n1Y+cLlzF9XMbeMzpnIhFOKNFuGt7ZV/IxUc7BKLm66sEZ4ZX5ur+qvfOSE/HX7+7LyXm9uX9 ezM08bm76lAOUBdSTjbqU0jAhGs/L7deMJSJmb5ZLOBRkyhz7KGjsCoHjWltgYcjsXJ+I9OyINV Gx7snN6nY9StPWcbwQ== X-Received: by 2002:a17:907:7f08:b0:aae:fd36:f511 with SMTP id a640c23a62f3a-ab789d3431bmr417074066b.47.1738942278075; Fri, 07 Feb 2025 07:31:18 -0800 (PST) Received: from draig.lan ([185.126.160.109]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ab772fd67c2sm283222166b.77.2025.02.07.07.31.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Feb 2025 07:31:15 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 203625FB91; Fri, 7 Feb 2025 15:31:13 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Peter Xu , =?utf-8?q?Alex_Benn=C3=A9e?= , Thomas Huth , Weiwei Li , qemu-arm@nongnu.org, Nicholas Piggin , Liu Zhiwei , Bin Meng , Tyrone Ting , Hao Wu , Kyle Evans , Alistair Francis , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Laurent Vivier , Riku Voipio , Harsh Prateek Bora , Fabiano Rosas , Alexandre Iooss , Laurent Vivier , Daniel Henrique Barboza , Warner Losh , Pierrick Bouvier , Palmer Dabbelt , Mahmoud Mandour , qemu-ppc@nongnu.org, Paolo Bonzini , qemu-rust@nongnu.org, qemu-riscv@nongnu.org Subject: [PATCH v2 08/17] tests/qtest/migration: Add --full option Date: Fri, 7 Feb 2025 15:31:03 +0000 Message-Id: <20250207153112.3939799-9-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250207153112.3939799-1-alex.bennee@linaro.org> References: <20250207153112.3939799-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::534; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-x534.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 autolearn=unavailable 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Fabiano Rosas Add a new command line option to allow selecting between running the full set of tests or a smaller set of tests. The default will be to run the small set (i.e. no comand line option provided) so we can reduce the amount of tests run by default. Only hosts which support KVM for the target architecture being tested will run the complete set of tests. Adjust the meson.build file to pass in the --full option when appropriate. (for now, set the option unconditionally until the next patch actually creates the small set) Use cases: configure --target-list=aarch64-softmmu,ppc64-softmmu,s390x-softmmu,x86_64-softmmu | before - 615s/244 tests | after - 244s/100 tests ------------------------+--------------------------+----------------------------- make check | full set for all archs | full set for the KVM arch, make check-qtest | | small set for the rest | | qemu-system-$ARCH | full set for $ARCH | small set for $ARCH, KVM or ./migration-test | | TCG automatically chosen | | qemu-system-$ARCH | N/A | full set for $ARCH, KVM or ./migration-test --full | | TCG automatically chosen | | migration-compat-x86_64 | full set for x86_64 | small set for x86_64 CI job | | ------------------------+--------------------------+----------------------------- Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu Message-Id: <20250130184012.5711-2-farosas@suse.de> Signed-off-by: Alex Bennée --- tests/qtest/migration/framework.h | 1 + tests/qtest/migration-test.c | 26 +++++++++++++++++++++++ tests/qtest/migration/compression-tests.c | 4 ++++ tests/qtest/migration/cpr-tests.c | 4 ++++ tests/qtest/migration/file-tests.c | 4 ++++ tests/qtest/migration/misc-tests.c | 4 ++++ tests/qtest/migration/postcopy-tests.c | 4 ++++ tests/qtest/migration/precopy-tests.c | 4 ++++ tests/qtest/migration/tls-tests.c | 4 ++++ tests/qtest/meson.build | 11 +++++++++- 10 files changed, 65 insertions(+), 1 deletion(-) diff --git a/tests/qtest/migration/framework.h b/tests/qtest/migration/framework.h index cb4a984700..e4a11870f6 100644 --- a/tests/qtest/migration/framework.h +++ b/tests/qtest/migration/framework.h @@ -24,6 +24,7 @@ typedef struct MigrationTestEnv { bool uffd_feature_thread_id; bool has_dirty_ring; bool is_x86; + bool full_set; const char *arch; const char *qemu_src; const char *qemu_dst; diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 5cad5060b3..61180fcbd5 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -14,13 +14,39 @@ #include "migration/framework.h" #include "qemu/module.h" +static void parse_args(int *argc_p, char ***argv_p, bool *full_set) +{ + int argc = *argc_p; + char **argv = *argv_p; + int i, j; + + j = 1; + for (i = 1; i < argc; i++) { + if (g_str_equal(argv[i], "--full")) { + *full_set = true; + continue; + } + argv[j++] = argv[i]; + if (i >= j) { + argv[i] = NULL; + } + } + *argc_p = j; +} + int main(int argc, char **argv) { MigrationTestEnv *env; int ret; + bool full_set = false; + + /* strip the --full option if it's present */ + parse_args(&argc, &argv, &full_set); g_test_init(&argc, &argv, NULL); env = migration_get_env(); + env->full_set = full_set; + env->full_set = true; /* temporary */ module_call_init(MODULE_INIT_QOM); migration_test_add_tls(env); diff --git a/tests/qtest/migration/compression-tests.c b/tests/qtest/migration/compression-tests.c index d78f1f11f1..9d0a258d51 100644 --- a/tests/qtest/migration/compression-tests.c +++ b/tests/qtest/migration/compression-tests.c @@ -155,6 +155,10 @@ void migration_test_add_compression(MigrationTestEnv *env) { tmpfs = env->tmpfs; + if (!env->full_set) { + return; + } + #ifdef CONFIG_ZSTD migration_test_add("/migration/multifd/tcp/plain/zstd", test_multifd_tcp_zstd); diff --git a/tests/qtest/migration/cpr-tests.c b/tests/qtest/migration/cpr-tests.c index 215b0df8c0..b1651fe48c 100644 --- a/tests/qtest/migration/cpr-tests.c +++ b/tests/qtest/migration/cpr-tests.c @@ -104,6 +104,10 @@ void migration_test_add_cpr(MigrationTestEnv *env) { tmpfs = env->tmpfs; + if (!env->full_set) { + return; + } + /* * Our CI system has problems with shared memory. * Don't run this test until we find a workaround. diff --git a/tests/qtest/migration/file-tests.c b/tests/qtest/migration/file-tests.c index 84225c8c33..5b190853a5 100644 --- a/tests/qtest/migration/file-tests.c +++ b/tests/qtest/migration/file-tests.c @@ -304,6 +304,10 @@ void migration_test_add_file(MigrationTestEnv *env) { tmpfs = env->tmpfs; + if (!env->full_set) { + return; + } + migration_test_add("/migration/precopy/file", test_precopy_file); diff --git a/tests/qtest/migration/misc-tests.c b/tests/qtest/migration/misc-tests.c index dda3707cf3..996256ef87 100644 --- a/tests/qtest/migration/misc-tests.c +++ b/tests/qtest/migration/misc-tests.c @@ -262,6 +262,10 @@ void migration_test_add_misc(MigrationTestEnv *env) { tmpfs = env->tmpfs; + if (!env->full_set) { + return; + } + migration_test_add("/migration/bad_dest", test_baddest); #ifndef _WIN32 migration_test_add("/migration/analyze-script", test_analyze_script); diff --git a/tests/qtest/migration/postcopy-tests.c b/tests/qtest/migration/postcopy-tests.c index daf7449f2c..b08cde3270 100644 --- a/tests/qtest/migration/postcopy-tests.c +++ b/tests/qtest/migration/postcopy-tests.c @@ -81,6 +81,10 @@ static void test_postcopy_preempt_recovery(void) void migration_test_add_postcopy(MigrationTestEnv *env) { + if (!env->full_set) { + return; + } + if (env->has_uffd) { migration_test_add("/migration/postcopy/plain", test_postcopy); migration_test_add("/migration/postcopy/recovery/plain", diff --git a/tests/qtest/migration/precopy-tests.c b/tests/qtest/migration/precopy-tests.c index 436dbd98e8..c99a487bf1 100644 --- a/tests/qtest/migration/precopy-tests.c +++ b/tests/qtest/migration/precopy-tests.c @@ -955,6 +955,10 @@ void migration_test_add_precopy(MigrationTestEnv *env) { tmpfs = env->tmpfs; + if (!env->full_set) { + return; + } + if (env->is_x86) { migration_test_add("/migration/precopy/unix/suspend/live", test_precopy_unix_suspend_live); diff --git a/tests/qtest/migration/tls-tests.c b/tests/qtest/migration/tls-tests.c index 5704a1f992..aee56930ac 100644 --- a/tests/qtest/migration/tls-tests.c +++ b/tests/qtest/migration/tls-tests.c @@ -726,6 +726,10 @@ void migration_test_add_tls(MigrationTestEnv *env) { tmpfs = env->tmpfs; + if (!env->full_set) { + return; + } + migration_test_add("/migration/precopy/unix/tls/psk", test_precopy_unix_tls_psk); diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build index 5e062c752a..68316dbdc1 100644 --- a/tests/qtest/meson.build +++ b/tests/qtest/meson.build @@ -405,6 +405,8 @@ foreach dir : target_dirs target_base = dir.split('-')[0] qtest_emulator = emulators['qemu-system-' + target_base] target_qtests = get_variable('qtests_' + target_base, []) + qtests_generic + has_kvm = ('CONFIG_KVM' in config_all_accel and host_os == 'linux' + and cpu == target_base and fs.exists('/dev/kvm')) test_deps = roms qtest_env = environment() @@ -438,11 +440,18 @@ foreach dir : target_dirs test: executable(test, src, dependencies: deps) } endif + + test_args = ['--tap', '-k'] + + if test == 'migration-test' and has_kvm + test_args += ['--full'] + endif + test('qtest-@0@/@1@'.format(target_base, test), qtest_executables[test], depends: [test_deps, qtest_emulator, emulator_modules], env: qtest_env, - args: ['--tap', '-k'], + args: test_args, protocol: 'tap', timeout: slow_qtests.get(test, 60), priority: slow_qtests.get(test, 60), From patchwork Fri Feb 7 15:31:04 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 862996 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e42:0:b0:385:e875:8a9e with SMTP id r2csp386914wrt; Fri, 7 Feb 2025 07:40:53 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCURvc/YdwzM/ZWmrjdLPZozpBxTco8Qe+83HeKTXgS/1QdwqzM4IHJ2durXiYoqtRNghySNaQ==@linaro.org X-Google-Smtp-Source: AGHT+IENoC9JctUOG2IRFNL9pXH+9YhSiQhZM4aoUuZTMMWDfJj9qXojqsrC/EzSDDaarmr5nn8M X-Received: by 2002:a05:6102:1591:b0:4b2:5ccb:1596 with SMTP id ada2fe7eead31-4ba85fa2a61mr3593858137.24.1738942852760; Fri, 07 Feb 2025 07:40:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1738942852; cv=none; d=google.com; s=arc-20240605; b=YtSqMqruAJYkMrshzkPZoq6akrRWc6mlASjU5m77lx8IkndsflSMXZBMA8w2q70TBt f1+mWWUTv0Qd6uXMYScvQK0wLI0luwOEa3dTfoRQAuNIs4kBKrPLtLj7tXCiIEZvZHXx arLhN+tLmHpx7VFLaHz7Pgf12OEuCU9rBRSfXSMOkd5+VIWDzflfMoCt3ck259W7FjzT UpFYd63blOqTH44tCD07IuA9iudDtBmf99I6Ys6uQhtrtJ2qOschnMIALQchCDmk1vRN R1q3ws/3Nt/WxQS6q07ORMfQPC48DFWKGLG+E9h8KeDYVLKA8ezJQI8ufeEcoARjsyEy Fw3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=pPUDkSmMPYbLWvU17ZzS5yeDzam6zW4TjOrPUFAUhlo=; fh=wU5jWsflgZeWkD4KPn0erLqYU9C64YFheOYh1YAvMfA=; b=ezQmYwVK9kd9FYua8YJ9req+uloAEse576fQGJRInippY7LdTPsXX1d10Epylrj1JO kPtZ8LGQOQxlLvQdw8vhX0P6k9VjKcvSH/NX2YTFn9KmVK4PPwCFVmpVhCdajH0qSBDc t2Be9cyBRe8mQ0+isj6BwYhMmK4peywUrBgE76A0mv/ooZLLqOyAOVa+UUBkhUiUvyVg yAxVLvIBbIP0Hjviive5fLu7xKgu1NMsS9qXpEX/n5zuzjfNskuaSD5Gjq5jMDYmn4cK f98nbHLtalvdZqRPcUh58F8B8Nn/vCGjXfH6K3636f0ajvydhpkp0bRkhvpMGW2DhlRS WR8Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=i95wKV0y; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ada2fe7eead31-4ba778b215asi808678137.388.2025.02.07.07.40.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Feb 2025 07:40:52 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=i95wKV0y; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tgQON-0007DR-2X; Fri, 07 Feb 2025 10:35:43 -0500 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 1tgQKY-0008GD-JO for qemu-devel@nongnu.org; Fri, 07 Feb 2025 10:31:52 -0500 Received: from mail-ej1-x62d.google.com ([2a00:1450: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 1tgQKG-00045G-Fz for qemu-devel@nongnu.org; Fri, 07 Feb 2025 10:31:42 -0500 Received: by mail-ej1-x62d.google.com with SMTP id a640c23a62f3a-aaedd529ba1so282909066b.1 for ; Fri, 07 Feb 2025 07:31:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1738942287; x=1739547087; 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=pPUDkSmMPYbLWvU17ZzS5yeDzam6zW4TjOrPUFAUhlo=; b=i95wKV0yKkOuGuXzhdZ6NcGa+2DzitY2IiNp/iy9LiY2JQitDB0gDNLihzZjATyRIm y+qKPzNUwzOni/awGpw91PofQ+/+HlSELx3aS7EYXNrQ+bJRGAKlZ4rnO7NNhvBonqki J8+kHA7b3PAN6NoYlWu24oR+Wi7lEDaZjmONitSPTCQYwwmbHVjRv0NGwPzKsPqvlh6y T5eqyDMVjT+8+FUt4Hoxi5+uSLZQm1SvLfn3tcnqjaSHqsSc/JuG9Hr3GA5Ok5ArWI4+ ptzwsp4ioYslv4j0+hriqKP/5cz0dARR/S+Hu+5+51AksyKdSs++1ujor6D2nRvdu083 K9PQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738942287; x=1739547087; 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=pPUDkSmMPYbLWvU17ZzS5yeDzam6zW4TjOrPUFAUhlo=; b=Bbvq6zF3+yaK1xcnRCkgXt7S41h8oMrSuEmYp0F9ovgPGMpTQs4dgQrzW5xc+M0RcO IYu+OhwhQSG1uMzdCIP6tfsg6L9kfoG5XsDfg38bez0x6dePoVJB5ceNKlTezrUH4OvM upGpsdv8yboOQkoALgwJTWrGBvhNNXYhNsbF1k83XjRMysU3/AohQQU2fZ6G7FS57zNN lDnOeI5gZt+djo+rK5b0Ftq9/pWEHJuHLrxq73KqPTG/dV0Ep7E2iuhS65uFaEcqzfN4 nTvI9I86Dsfe/TK6xr2XR+PSZ5wrE0AqDd7xHGQlvzWuYuVxo9nGR08uEQFy/eeEz6u4 MGNQ== X-Gm-Message-State: AOJu0YyKTbw+BAxGOfWzim7J0QgBbDMgs+cFl/58NglB+c6lud5usIgV Glt8J6/d+CZSDhHUbk6lK4l8jR7nc1DJ9p2lXwTv7WjGWx0uOmvDboIQE9C6scM= X-Gm-Gg: ASbGncvwdxcsqWs2mps7bUChFMh2tfSFA0tTfkvmrJ3O6viIXocKI2jKl8lWPqyYGeW WUxpuGgtBKiVzVk4g+B9XtOf7QQrRW9VGP05dU4VCtX0HW5QqDhyCfIGq+pHljaLUO582bTKshm ra5vm+FgMovt6YzAiwDzKj/8yLwLNAsnOArd4pwnpL/31xU0Un3xNrvGMINbsu3Z9goZMdWXIHS mMdccaJdNWE53oy/ICu46Ov+f+8rC9qMSEB/DmBrjfB4kUj1K+3N9wq4JPNUQxGrHTk/c8QkXXG UD9HbdjCPb7wPElZgg== X-Received: by 2002:a05:6402:42cb:b0:5dc:cf9b:b04a with SMTP id 4fb4d7f45d1cf-5de44fe9443mr9335607a12.1.1738942284912; Fri, 07 Feb 2025 07:31:24 -0800 (PST) Received: from draig.lan ([185.126.160.109]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5de4c8a3966sm995512a12.46.2025.02.07.07.31.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Feb 2025 07:31:20 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 3CACA60870; Fri, 7 Feb 2025 15:31:13 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Peter Xu , =?utf-8?q?Alex_Benn=C3=A9e?= , Thomas Huth , Weiwei Li , qemu-arm@nongnu.org, Nicholas Piggin , Liu Zhiwei , Bin Meng , Tyrone Ting , Hao Wu , Kyle Evans , Alistair Francis , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Laurent Vivier , Riku Voipio , Harsh Prateek Bora , Fabiano Rosas , Alexandre Iooss , Laurent Vivier , Daniel Henrique Barboza , Warner Losh , Pierrick Bouvier , Palmer Dabbelt , Mahmoud Mandour , qemu-ppc@nongnu.org, Paolo Bonzini , qemu-rust@nongnu.org, qemu-riscv@nongnu.org Subject: [PATCH v2 09/17] tests/qtest/migration: Pick smoke tests Date: Fri, 7 Feb 2025 15:31:04 +0000 Message-Id: <20250207153112.3939799-10-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250207153112.3939799-1-alex.bennee@linaro.org> References: <20250207153112.3939799-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62d; envelope-from=alex.bennee@linaro.org; helo=mail-ej1-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 autolearn=unavailable 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Fabiano Rosas Choose a few tests per group and move them from the full set to the smoke set. Signed-off-by: Fabiano Rosas Reviewed-by: Peter Xu Message-Id: <20250130184012.5711-3-farosas@suse.de> Signed-off-by: Alex Bennée --- tests/qtest/migration-test.c | 1 - tests/qtest/migration/compression-tests.c | 11 ++++++--- tests/qtest/migration/cpr-tests.c | 2 ++ tests/qtest/migration/file-tests.c | 17 +++++++++----- tests/qtest/migration/misc-tests.c | 12 +++++++--- tests/qtest/migration/postcopy-tests.c | 18 ++++++++++----- tests/qtest/migration/precopy-tests.c | 27 ++++++++++++++--------- tests/qtest/migration/tls-tests.c | 10 +++++++-- 8 files changed, 67 insertions(+), 31 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 61180fcbd5..0893687174 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -46,7 +46,6 @@ int main(int argc, char **argv) g_test_init(&argc, &argv, NULL); env = migration_get_env(); env->full_set = full_set; - env->full_set = true; /* temporary */ module_call_init(MODULE_INIT_QOM); migration_test_add_tls(env); diff --git a/tests/qtest/migration/compression-tests.c b/tests/qtest/migration/compression-tests.c index 9d0a258d51..8b58401b84 100644 --- a/tests/qtest/migration/compression-tests.c +++ b/tests/qtest/migration/compression-tests.c @@ -151,10 +151,18 @@ static void test_multifd_tcp_zlib(void) test_precopy_common(&args); } +static void migration_test_add_compression_smoke(MigrationTestEnv *env) +{ + migration_test_add("/migration/multifd/tcp/plain/zlib", + test_multifd_tcp_zlib); +} + void migration_test_add_compression(MigrationTestEnv *env) { tmpfs = env->tmpfs; + migration_test_add_compression_smoke(env); + if (!env->full_set) { return; } @@ -183,7 +191,4 @@ void migration_test_add_compression(MigrationTestEnv *env) migration_test_add("/migration/precopy/unix/xbzrle", test_precopy_unix_xbzrle); } - - migration_test_add("/migration/multifd/tcp/plain/zlib", - test_multifd_tcp_zlib); } diff --git a/tests/qtest/migration/cpr-tests.c b/tests/qtest/migration/cpr-tests.c index b1651fe48c..4758841824 100644 --- a/tests/qtest/migration/cpr-tests.c +++ b/tests/qtest/migration/cpr-tests.c @@ -104,6 +104,8 @@ void migration_test_add_cpr(MigrationTestEnv *env) { tmpfs = env->tmpfs; + /* no tests in the smoke set for now */ + if (!env->full_set) { return; } diff --git a/tests/qtest/migration/file-tests.c b/tests/qtest/migration/file-tests.c index 5b190853a5..f474b3590a 100644 --- a/tests/qtest/migration/file-tests.c +++ b/tests/qtest/migration/file-tests.c @@ -300,17 +300,25 @@ static void test_multifd_file_mapped_ram_fdset_dio(void) } #endif /* !_WIN32 */ +static void migration_test_add_file_smoke(MigrationTestEnv *env) +{ + migration_test_add("/migration/precopy/file", + test_precopy_file); + + migration_test_add("/migration/multifd/file/mapped-ram/dio", + test_multifd_file_mapped_ram_dio); +} + void migration_test_add_file(MigrationTestEnv *env) { tmpfs = env->tmpfs; + migration_test_add_file_smoke(env); + if (!env->full_set) { return; } - migration_test_add("/migration/precopy/file", - test_precopy_file); - migration_test_add("/migration/precopy/file/offset", test_precopy_file_offset); #ifndef _WIN32 @@ -330,9 +338,6 @@ void migration_test_add_file(MigrationTestEnv *env) migration_test_add("/migration/multifd/file/mapped-ram/live", test_multifd_file_mapped_ram_live); - migration_test_add("/migration/multifd/file/mapped-ram/dio", - test_multifd_file_mapped_ram_dio); - #ifndef _WIN32 migration_test_add("/migration/multifd/file/mapped-ram/fdset", test_multifd_file_mapped_ram_fdset); diff --git a/tests/qtest/migration/misc-tests.c b/tests/qtest/migration/misc-tests.c index 996256ef87..d03199f3c5 100644 --- a/tests/qtest/migration/misc-tests.c +++ b/tests/qtest/migration/misc-tests.c @@ -258,18 +258,24 @@ static void test_validate_uri_channels_none_set(void) do_test_validate_uri_channel(&args); } +static void migration_test_add_misc_smoke(MigrationTestEnv *env) +{ +#ifndef _WIN32 + migration_test_add("/migration/analyze-script", test_analyze_script); +#endif +} + void migration_test_add_misc(MigrationTestEnv *env) { tmpfs = env->tmpfs; + migration_test_add_misc_smoke(env); + if (!env->full_set) { return; } migration_test_add("/migration/bad_dest", test_baddest); -#ifndef _WIN32 - migration_test_add("/migration/analyze-script", test_analyze_script); -#endif /* * Our CI system has problems with shared memory. diff --git a/tests/qtest/migration/postcopy-tests.c b/tests/qtest/migration/postcopy-tests.c index b08cde3270..7e84e60fea 100644 --- a/tests/qtest/migration/postcopy-tests.c +++ b/tests/qtest/migration/postcopy-tests.c @@ -79,18 +79,26 @@ static void test_postcopy_preempt_recovery(void) test_postcopy_recovery_common(&args); } -void migration_test_add_postcopy(MigrationTestEnv *env) +static void migration_test_add_postcopy_smoke(MigrationTestEnv *env) { - if (!env->full_set) { - return; - } - if (env->has_uffd) { migration_test_add("/migration/postcopy/plain", test_postcopy); migration_test_add("/migration/postcopy/recovery/plain", test_postcopy_recovery); migration_test_add("/migration/postcopy/preempt/plain", test_postcopy_preempt); + } +} + +void migration_test_add_postcopy(MigrationTestEnv *env) +{ + migration_test_add_postcopy_smoke(env); + + if (!env->full_set) { + return; + } + + if (env->has_uffd) { migration_test_add("/migration/postcopy/preempt/recovery/plain", test_postcopy_preempt_recovery); diff --git a/tests/qtest/migration/precopy-tests.c b/tests/qtest/migration/precopy-tests.c index c99a487bf1..b16f10e908 100644 --- a/tests/qtest/migration/precopy-tests.c +++ b/tests/qtest/migration/precopy-tests.c @@ -951,14 +951,8 @@ static void test_dirty_limit(void) migrate_end(from, to, true); } -void migration_test_add_precopy(MigrationTestEnv *env) +static void migration_test_add_precopy_smoke(MigrationTestEnv *env) { - tmpfs = env->tmpfs; - - if (!env->full_set) { - return; - } - if (env->is_x86) { migration_test_add("/migration/precopy/unix/suspend/live", test_precopy_unix_suspend_live); @@ -970,6 +964,21 @@ void migration_test_add_precopy(MigrationTestEnv *env) test_precopy_unix_plain); migration_test_add("/migration/precopy/tcp/plain", test_precopy_tcp_plain); + migration_test_add("/migration/multifd/tcp/uri/plain/none", + test_multifd_tcp_uri_none); + migration_test_add("/migration/multifd/tcp/plain/cancel", + test_multifd_tcp_cancel); +} + +void migration_test_add_precopy(MigrationTestEnv *env) +{ + tmpfs = env->tmpfs; + + migration_test_add_precopy_smoke(env); + + if (!env->full_set) { + return; + } migration_test_add("/migration/precopy/tcp/plain/switchover-ack", test_precopy_tcp_switchover_ack); @@ -993,16 +1002,12 @@ void migration_test_add_precopy(MigrationTestEnv *env) test_dirty_limit); } } - migration_test_add("/migration/multifd/tcp/uri/plain/none", - test_multifd_tcp_uri_none); migration_test_add("/migration/multifd/tcp/channels/plain/none", test_multifd_tcp_channels_none); migration_test_add("/migration/multifd/tcp/plain/zero-page/legacy", test_multifd_tcp_zero_page_legacy); migration_test_add("/migration/multifd/tcp/plain/zero-page/none", test_multifd_tcp_no_zero_page); - migration_test_add("/migration/multifd/tcp/plain/cancel", - test_multifd_tcp_cancel); if (g_str_equal(env->arch, "x86_64") && env->has_kvm && env->has_dirty_ring) { diff --git a/tests/qtest/migration/tls-tests.c b/tests/qtest/migration/tls-tests.c index aee56930ac..2cb4a44bcd 100644 --- a/tests/qtest/migration/tls-tests.c +++ b/tests/qtest/migration/tls-tests.c @@ -722,10 +722,18 @@ static void test_multifd_tcp_tls_x509_reject_anon_client(void) } #endif /* CONFIG_TASN1 */ +static void migration_test_add_tls_smoke(MigrationTestEnv *env) +{ + migration_test_add("/migration/precopy/tcp/tls/psk/match", + test_precopy_tcp_tls_psk_match); +} + void migration_test_add_tls(MigrationTestEnv *env) { tmpfs = env->tmpfs; + migration_test_add_tls_smoke(env); + if (!env->full_set) { return; } @@ -755,8 +763,6 @@ void migration_test_add_tls(MigrationTestEnv *env) test_precopy_unix_tls_x509_override_host); #endif /* CONFIG_TASN1 */ - migration_test_add("/migration/precopy/tcp/tls/psk/match", - test_precopy_tcp_tls_psk_match); migration_test_add("/migration/precopy/tcp/tls/psk/mismatch", test_precopy_tcp_tls_psk_mismatch); #ifdef CONFIG_TASN1 From patchwork Fri Feb 7 15:31:05 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 862990 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e42:0:b0:385:e875:8a9e with SMTP id r2csp385218wrt; Fri, 7 Feb 2025 07:37:37 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUFJFzy6Qmr42L5XtnNuUTeVnJ0Uhi2ei5CW0I5fzp0si1/X6ZnKMw0MrKLUUt5GIQDvlSA3A==@linaro.org X-Google-Smtp-Source: AGHT+IFXDcGcI74G26pHjm9GXQi5bd3ThWobYSjndHgq3e/HfX72jqOLHUFelr7UDE0UVE4S1IEt X-Received: by 2002:a05:6102:4414:b0:4ba:76e4:638c with SMTP id ada2fe7eead31-4ba85de0aeamr2868254137.9.1738942657731; Fri, 07 Feb 2025 07:37:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1738942657; cv=none; d=google.com; s=arc-20240605; b=LQ66J2fstf7JM67pkTkpkSy96TFaTCOubgSDH2U5FjQNA27VO+Covd5/NL1DfGs2s3 uO0N2jBz8H373ysJp28vXWAYMZ4O0k1STY8cbTuGvOnSGKoGrGpG1rVS2SDuWzI92wWI GQFuuQQJUxaM3HCBD7ZrZy45REvx9G1X7/3Ya+yYNfOk3H0LG9EMangC5DdRDwX+1IYl Bshnp2P3hyjmKJgvYzIs/VjrNxX5IwKFtGi8l2CRT/aqVEBMYdNMgILHHQ1/aCmPSpTt tu+MvD4KzFANowIW6zpUSpXucMzS4PxyLg+hzZROf0IH6SmpvMLGWA2J+zVChUSY/rcD WOBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/577CdB1eWedE91Z4d0PM1VMtk8hOH9rwbGlAE6K9w8=; fh=Jdg4fLQw/+vV+BD6NiVJYsZoanjBKb4fl4V8sUUe9bg=; b=PzEWHwNk+aTB89uQBx/68KHrJV9UaP2EakyiP0kLjAyemcJIYr51YTzAp/Vaudd3Tg E+RAfB+370bkgEdCi958XI7+ebRlGQ6ym9JnVjtkDRmDl0e29fVjQThDJPOmv2wiVtk/ JlFo+daXVUX87uBvY/IEmh0APjw3K4h+3dzLHXuK8x7p/HWbx8pKpiJ1dvrOLrS15PLF 4WJEAab1hBlb6FUncSiUrC37q6PPsSYodtuZCMqDKjN6ZYYKkSHU29PAtBfyzOe6Je3+ AM3OVbVdQK0h86pqihuARX4Ew2ovDkzVVj/gN+V8/trMptEs26BYpm4wMKT9uwVhDPJL ypAQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=T6UsfFjK; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ada2fe7eead31-4ba77920e61si830910137.634.2025.02.07.07.37.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Feb 2025 07:37:37 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=T6UsfFjK; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tgQLY-0001Fd-Uu; Fri, 07 Feb 2025 10:32:48 -0500 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 1tgQKO-0008A8-1T for qemu-devel@nongnu.org; Fri, 07 Feb 2025 10:31:38 -0500 Received: from mail-ej1-x62e.google.com ([2a00:1450:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tgQKB-00040x-0d for qemu-devel@nongnu.org; Fri, 07 Feb 2025 10:31:35 -0500 Received: by mail-ej1-x62e.google.com with SMTP id a640c23a62f3a-ab7157cf352so640858366b.0 for ; Fri, 07 Feb 2025 07:31:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1738942281; x=1739547081; 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=/577CdB1eWedE91Z4d0PM1VMtk8hOH9rwbGlAE6K9w8=; b=T6UsfFjKKjJFChLvwUX2GPsQIuOe3s53L2+jyXysPHsKas9TR8sf5YtKQxRZnn9Eo9 BU7X6E8T75jU1Uv0LiJN/TbdyI2UiqSz0KcLTdid2QD2b+ttFUoZ/IVNZ57lpr+7+n4I LwKn7VS40/lK7kmcZUR8bIgq58j2dP2Y1Z9pCwIl6Utr3dRK8d/ns7KmkzF3wtg2PkVZ tYvAoXM+7D3mcYt5u37c4F9BhgfJf2cqFkdP8asIGphQHuYbjSON2HVuKe7wsW2f8ohL Jxe9Pqvkbhe+oyUCeYrh5ocaB4NM0W3/15qO3LmD2Vr3qEmXSLkMfKFtlfYIWRkYnoLF meJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738942281; x=1739547081; 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=/577CdB1eWedE91Z4d0PM1VMtk8hOH9rwbGlAE6K9w8=; b=iU0cWE8BH5UKqepxlI8vqBfWMjrHBc1MAOKg2GEEZ/viGO25MEiGzxtvxWRivR2dZ6 94OoRam6pPoPu8zHiiqvXL6hnm8KQLUTVT8X+26nnE2bWnu8P8uNZVM4YAR59XpwPQtZ xHMN3vv+X2Qn+VvlVdNbPyRGzPtUYnk8dcGPq/22D1FyfgAS38RfFN/8mD5dyvrkJuJt +DH3dQ1eQrsJAWLHEBYdUSaL4lWILApKAqpxJQ4ZX0lulb/rcHIGBKn60COzjkxROVUR qWYPNM28YLfVDxMwYq2sh4o3BoyoC+NfnUk5eP0x4Isum2qfY0MS3ZypUESjqRAr1Wkj mXHg== X-Gm-Message-State: AOJu0Yww/iFl8zZEqkyymutM1uyIEyymI+R0TB+n3j+dVXT54w6jP5v/ z8e2vw7TY72SVFsjIy2k8CbOW4M9HF4s/ohe8e53jQOO8V/YUql1M2V6//eypt8= X-Gm-Gg: ASbGncsvbDuVfbPczIyIfn56SaIYqUW8Vn3EIQFNgIv+szXgEvQn2jH9Tdj2f7L4SnC 9Ieb0SQaQ8VdZsqg5VpO3dkfCSjMHknN1oxRT7Hhsv/11Ow9K1Y9M7A++0L3NCNZT4UsabPlKpo pDzpfJbn4ZcGNsOAm/2jn/pzRa9HJpUek7rQzM57mkhwa9azi4bBzerMoYXlkbWA0CPKtKsYvoN JFRxa/hn9I92BY88VW3vqN0fvh22aMltceqCwHc/RrkhlP24ByiLZWqSJnMUoNCHeV5WUW/Mf9S vdtl0i8uJG9tQhmxgA== X-Received: by 2002:a17:907:d8a:b0:ab3:4d1e:4606 with SMTP id a640c23a62f3a-ab789a9a340mr333621766b.3.1738942280827; Fri, 07 Feb 2025 07:31:20 -0800 (PST) Received: from draig.lan ([185.126.160.109]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ab772f4870bsm286370366b.32.2025.02.07.07.31.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Feb 2025 07:31:18 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 4FB7C608B4; Fri, 7 Feb 2025 15:31:13 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Peter Xu , =?utf-8?q?Alex_Benn=C3=A9e?= , Thomas Huth , Weiwei Li , qemu-arm@nongnu.org, Nicholas Piggin , Liu Zhiwei , Bin Meng , Tyrone Ting , Hao Wu , Kyle Evans , Alistair Francis , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Laurent Vivier , Riku Voipio , Harsh Prateek Bora , Fabiano Rosas , Alexandre Iooss , Laurent Vivier , Daniel Henrique Barboza , Warner Losh , Pierrick Bouvier , Palmer Dabbelt , Mahmoud Mandour , qemu-ppc@nongnu.org, Paolo Bonzini , qemu-rust@nongnu.org, qemu-riscv@nongnu.org, Ilya Leoshkevich , Richard Henderson Subject: [PATCH v2 10/17] gdbstub: Allow the %d placeholder in the socket path Date: Fri, 7 Feb 2025 15:31:05 +0000 Message-Id: <20250207153112.3939799-11-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250207153112.3939799-1-alex.bennee@linaro.org> References: <20250207153112.3939799-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62e; envelope-from=alex.bennee@linaro.org; helo=mail-ej1-x62e.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 autolearn=unavailable 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Ilya Leoshkevich Just like for QEMU_LOG_FILENAME, replace %d with PID in the GDB socket path. This allows running multi-process applications with, e.g., export QEMU_GDB=/tmp/qemu-%d.sock. Currently this is not possible, since the first process will cause the subsequent ones to fail due to not being able to bind() the GDB socket. Reviewed-by: Richard Henderson Reviewed-by: Warner Losh Signed-off-by: Ilya Leoshkevich Message-Id: <20250117001542.8290-2-iii@linux.ibm.com> Signed-off-by: Alex Bennée --- gdbstub/user.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gdbstub/user.c b/gdbstub/user.c index c2bdfc3d49..fd29d595f4 100644 --- a/gdbstub/user.c +++ b/gdbstub/user.c @@ -317,9 +317,19 @@ static bool gdb_accept_socket(int gdb_fd) static int gdbserver_open_socket(const char *path) { + g_autoptr(GString) buf = g_string_new(""); struct sockaddr_un sockaddr = {}; + char *pid_placeholder; int fd, ret; + pid_placeholder = strstr(path, "%d"); + if (pid_placeholder != NULL) { + g_string_append_len(buf, path, pid_placeholder - path); + g_string_append_printf(buf, "%d", qemu_get_thread_id()); + g_string_append(buf, pid_placeholder + 2); + path = buf->str; + } + fd = socket(AF_UNIX, SOCK_STREAM, 0); if (fd < 0) { perror("create socket"); From patchwork Fri Feb 7 15:31:06 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 862989 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e42:0:b0:385:e875:8a9e with SMTP id r2csp385202wrt; Fri, 7 Feb 2025 07:37:36 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVIgpz4x6ehAtxP/q6XZovbwBoDk25p94tSRO3fs0wOP1oSHzJ1FyH80YJjiE64zEe9MP5I/w==@linaro.org X-Google-Smtp-Source: AGHT+IHKkmk+PyIspKA0asOfWWpwJ3poihmGu3qCRNGaHSWi38GYIoUmgR3RuK+uKkYQRnk5N94v X-Received: by 2002:a05:6122:c9d:b0:517:4d53:4272 with SMTP id 71dfb90a1353d-51f2e224c3bmr2769320e0c.7.1738942656494; Fri, 07 Feb 2025 07:37:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1738942656; cv=none; d=google.com; s=arc-20240605; b=X4/ENN6zZs6sWeMpJnxVsDUDjc/66lxMBlrCyLCghlUaieAEgJEdHnp1KDTzFIruLS OaMVmyHMqsY1LOwkQZbTnRLhpj6XHCFG5Kx7jqJSvN8H/oAVCvN3rKZCtTvNJI3lgZJb Pgg08lOgS0k9nFlGx3E4fq4d5aH6Z/sYI0uK1YjjrDOpAPnMtF4qPgkPX5FyacSLbTUb bTQkASqi4Ef2XkEApq7jgeSSj4uDbt4x5QcQSlr9+AbvdNP9KPOkJ5frTn/WzZSL8jOa c+A9XwnWlqaSFoX185wZD8YdE2FhF67PT5cyAnZw/6UvGyLgs/Gg3sv5iKdpoHZWh842 FzQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+6N9ryvNx2tTT6HdSFLFKVlKftlNVXYRqQdp7SLQm3o=; fh=htMF8hQWTZiOGUJHuB6bq90yox4j6xv33yHiWqKjtG8=; b=YaDQCk1vjcHZ8zH2DLjDbjtdI8vZwkH2F09IzXwb2xAddd+6aMGACSlnl2+mJnF6Kk 9PXCztw0WIYX93Th8Xkm8PK8AQDzSyIKgWz5CIFtSf9OKtenwXaLnzG7Wdk8cPAtZ5+3 bpASpWTAJu/WNRSBPPnVBb0b4yLsVWAbW1sEfJfQsAX6Z/+b2jqSg1bJiu22iMu8wqtx HXx1iZu021Fh31UwWTKDMIt3Z4YC2OI55GvtXZ2lIU15b2LhL/k7Yu/956B7RoZkO1/v kOp64MHcrkCnwTFK5NGGz2Tg9bc9Nwo5CwTG8focz0iQjYkvEqUDxFqwI220L8bGj9Bj bvEg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QDOCmzDn; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 71dfb90a1353d-51f2292eda1si734945e0c.142.2025.02.07.07.37.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Feb 2025 07:37:36 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QDOCmzDn; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tgQLa-0001LX-Ci; Fri, 07 Feb 2025 10:32:50 -0500 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 1tgQKQ-0008BS-KW for qemu-devel@nongnu.org; Fri, 07 Feb 2025 10:31:39 -0500 Received: from mail-ej1-x632.google.com ([2a00:1450:4864:20::632]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tgQKD-00042b-IA for qemu-devel@nongnu.org; Fri, 07 Feb 2025 10:31:38 -0500 Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-aa67ac42819so350971566b.0 for ; Fri, 07 Feb 2025 07:31:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1738942283; x=1739547083; 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=+6N9ryvNx2tTT6HdSFLFKVlKftlNVXYRqQdp7SLQm3o=; b=QDOCmzDnR6lDCWbGxrpptVcpOr+EZC3ASYjZSPsGMtmu61FBUAaT/GhsYOwEeYknZq hFNizwhIbcB2Aif3N5VdHMZ/0wGOFoHO+IJBDPbOFjbVOjb+ly2YIlDSYyok6g7M4nzS LYs0x+DFNwI6vxj/HM22CIIumO54jXzTXclnPHyhKXspmtM32zOm22+ZBYNrT5XK50Km Vho4sauydB4Xn8o6As7aK3mKEp7xXGoTZXmI01TM8ZY6vbEcLJakSRoeZhbWBb+LlKkD hG8QKseSfQkO7ValAELFl3UuVo2O+jL+So9apNTC9JGcRGXt+ldUv47iEa7V4vZvVZps pefg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738942283; x=1739547083; 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=+6N9ryvNx2tTT6HdSFLFKVlKftlNVXYRqQdp7SLQm3o=; b=LJv0bvgBF3Q7EvCSZZDK6ZeqSkDNP/RIOmo+Vn/E+MzbcljW19J82M9GX1y64B/cV8 0Qy5p5QZsbSZzm9ooJSgxxqzscU6qoylZjA/8VjvY3uHt4nIP8yMUk/7fjj5fjVimJMF EEdLRWDTCp1OoNYBd8q38bCaovI512cm/Iv3uyookwtSeeDUYTKExhXYfwVmvsmp//i1 cKPa+Efm2MxsNrZfdr/dZYTc/2xUd5YQBp6NGCdGskPp0w0LFubAqR7hXAuR2t4WjXeh fv74k4JkrP/1Iwdqfj7YujUiozOkJkxB8onJCWd815ZHLUiULjmB/29ylLXqAEAFBE4+ 9sNQ== X-Gm-Message-State: AOJu0Yz59SQ8LPoz73NEVDXpe+VKHcpfRRJGbd5eKu2kR+C4GyxYT+PG mK0GZKJTIvvcZzEfZj9i5VYYj9V0MklyWL6bY5ZxktudrXku9WZI7o22iUlr13g= X-Gm-Gg: ASbGnctqQeBDkwyPdi5MTxfhd/2NrjYBsrhVt0Ni3RAqA3VL3ylXExZSC6bisa79eYp pibu5qB6cYEMNhGWNCi+FEjakEzwFuxu7MWAkcbi99ATUyk6m+Bu7DW04zh5cK1FQcrV2ySf4Vz EB0yfAokXN6X2sH1q2OGXiskPhYWEchc2cMRZxQkq7ZlJQHDYgXLcBnQh2wR7zYcKvPjAZvxiDu SzNe+LQv0Rd8weBigiZk6zZNakE+L6fXpOnr5TNM0PQ4TM7LaqGYVOHIPDILXuc3xpWNVOE6yYm N2AdX4O4JJxS6k9JnQ== X-Received: by 2002:a17:906:f6c4:b0:ab7:9285:3442 with SMTP id a640c23a62f3a-ab7928534f3mr176977466b.3.1738942283134; Fri, 07 Feb 2025 07:31:23 -0800 (PST) Received: from draig.lan ([185.126.160.109]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ab78e82cc0csm105485566b.12.2025.02.07.07.31.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Feb 2025 07:31:18 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 665686099F; Fri, 7 Feb 2025 15:31:13 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Peter Xu , =?utf-8?q?Alex_Benn=C3=A9e?= , Thomas Huth , Weiwei Li , qemu-arm@nongnu.org, Nicholas Piggin , Liu Zhiwei , Bin Meng , Tyrone Ting , Hao Wu , Kyle Evans , Alistair Francis , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Laurent Vivier , Riku Voipio , Harsh Prateek Bora , Fabiano Rosas , Alexandre Iooss , Laurent Vivier , Daniel Henrique Barboza , Warner Losh , Pierrick Bouvier , Palmer Dabbelt , Mahmoud Mandour , qemu-ppc@nongnu.org, Paolo Bonzini , qemu-rust@nongnu.org, qemu-riscv@nongnu.org, Ilya Leoshkevich Subject: [PATCH v2 11/17] gdbstub: Try unlinking the unix socket before binding Date: Fri, 7 Feb 2025 15:31:06 +0000 Message-Id: <20250207153112.3939799-12-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250207153112.3939799-1-alex.bennee@linaro.org> References: <20250207153112.3939799-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::632; envelope-from=alex.bennee@linaro.org; helo=mail-ej1-x632.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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Ilya Leoshkevich In case an emulated process execve()s another emulated process, bind() will fail, because the socket already exists. So try deleting it. Use the existing unix_listen() function which does this. Link qemu-user with qemu-sockets.c and add the monitor_get_fd() stub. Note that it is not possible to handle this in do_execv(): deleting gdbserver_user_state.socket_path before safe_execve() is not correct, because the latter may fail, and afterwards we may lose control. Signed-off-by: Ilya Leoshkevich Reviewed-by: Alex Bennée Message-Id: <20250117001542.8290-3-iii@linux.ibm.com> Signed-off-by: Alex Bennée --- gdbstub/user.c | 29 +++-------------------------- stubs/monitor-fd.c | 9 +++++++++ stubs/meson.build | 2 ++ util/meson.build | 2 ++ 4 files changed, 16 insertions(+), 26 deletions(-) create mode 100644 stubs/monitor-fd.c diff --git a/gdbstub/user.c b/gdbstub/user.c index fd29d595f4..8225b70280 100644 --- a/gdbstub/user.c +++ b/gdbstub/user.c @@ -315,12 +315,10 @@ static bool gdb_accept_socket(int gdb_fd) return true; } -static int gdbserver_open_socket(const char *path) +static int gdbserver_open_socket(const char *path, Error **errp) { g_autoptr(GString) buf = g_string_new(""); - struct sockaddr_un sockaddr = {}; char *pid_placeholder; - int fd, ret; pid_placeholder = strstr(path, "%d"); if (pid_placeholder != NULL) { @@ -330,28 +328,7 @@ static int gdbserver_open_socket(const char *path) path = buf->str; } - fd = socket(AF_UNIX, SOCK_STREAM, 0); - if (fd < 0) { - perror("create socket"); - return -1; - } - - sockaddr.sun_family = AF_UNIX; - pstrcpy(sockaddr.sun_path, sizeof(sockaddr.sun_path) - 1, path); - ret = bind(fd, (struct sockaddr *)&sockaddr, sizeof(sockaddr)); - if (ret < 0) { - perror("bind socket"); - close(fd); - return -1; - } - ret = listen(fd, 1); - if (ret < 0) { - perror("listen socket"); - close(fd); - return -1; - } - - return fd; + return unix_listen(path, errp); } static bool gdb_accept_tcp(int gdb_fd) @@ -424,7 +401,7 @@ bool gdbserver_start(const char *port_or_path, Error **errp) if (port > 0) { gdb_fd = gdbserver_open_port(port, errp); } else { - gdb_fd = gdbserver_open_socket(port_or_path); + gdb_fd = gdbserver_open_socket(port_or_path, errp); } if (gdb_fd < 0) { diff --git a/stubs/monitor-fd.c b/stubs/monitor-fd.c new file mode 100644 index 0000000000..9bb6749885 --- /dev/null +++ b/stubs/monitor-fd.c @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include "qemu/osdep.h" +#include "monitor/monitor.h" + +int monitor_get_fd(Monitor *mon, const char *fdname, Error **errp) +{ + abort(); +} diff --git a/stubs/meson.build b/stubs/meson.build index a8b3aeb564..b0fee37e05 100644 --- a/stubs/meson.build +++ b/stubs/meson.build @@ -61,6 +61,8 @@ if have_user if not have_system stub_ss.add(files('qdev.c')) endif + + stub_ss.add(files('monitor-fd.c')) endif if have_system diff --git a/util/meson.build b/util/meson.build index 5d8bef9891..780b5977a8 100644 --- a/util/meson.build +++ b/util/meson.build @@ -84,6 +84,8 @@ if have_block or have_ga util_ss.add(files('qemu-coroutine.c', 'qemu-coroutine-lock.c', 'qemu-coroutine-io.c')) util_ss.add(files(f'coroutine-@coroutine_backend@.c')) util_ss.add(files('thread-pool.c', 'qemu-timer.c')) +endif +if have_block or have_ga or have_user util_ss.add(files('qemu-sockets.c')) endif if have_block From patchwork Fri Feb 7 15:31:07 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 862994 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e42:0:b0:385:e875:8a9e with SMTP id r2csp385848wrt; Fri, 7 Feb 2025 07:38:48 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVYVRvK3u4osc7hsZzAcai1lsxzxSr5vnAn2Fkx6MZBGXdbud3ddjSrrui0wOTyEWUqRevMsg==@linaro.org X-Google-Smtp-Source: AGHT+IHst61yYHfmgLFWroxuvrvES9DMnL/jATxUgYY5YjYIimlkzmHsbM9bOdb/6e9At19geikA X-Received: by 2002:a05:620a:800e:b0:7b7:5d6:3976 with SMTP id af79cd13be357-7c047caf1b4mr626793985a.58.1738942727932; Fri, 07 Feb 2025 07:38:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1738942727; cv=none; d=google.com; s=arc-20240605; b=T+M9YOTx0KJ56nKs5Lm0QQFao4L3e8dUCZ3IE8YO2MTtJASSpnSX/wiBSoVEeQ93pc eyGKJ3p+uhNcRuhrDbL8rA3SWAJDUhUYw4HhB8tQH7kIzzRnTQNhvE98GTYMSCaplO3U i/aJuZyf7nfu8zqZ7MDzigLy38xnaAhspW+SX9bLYP1/LB6Ffi+QQoPSOstwVh0CswgH O6fAAxElO3JhbXxd3u9moZyDZFjtLHL1uEJwNGyyt/vPI7ltBzJkS3x+pFvoJCAPNWsj jc3Oz0W124kgH/MkwkAjdj6kyErBya0y7KVycIurXxnFysTHvbS6rpZHEcm2tsbeBdiZ UHjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ss1s/z8UDnfCDTK92VTNTdO4MGHnAPeMCWUHdvvh61s=; fh=Jdg4fLQw/+vV+BD6NiVJYsZoanjBKb4fl4V8sUUe9bg=; b=LGJNYyBvKiSN2nIV2uUeBh+UzpU0/C6SIwnVnDAkts68Iv2txxVir3fzssKalF7pma hZPzP7lVRXxvSFezd52HOcXMbQ1DvYZ37s2TaM93lQ46sVouPqKga5d61+whvcXuIOlb woUZJB+tJJH96fXQ3jBfq+owUkPcTSNRiqVKpyzku0pyrfgcPx1DPs1Y+e4oA1dLTeIn S6C37l2MI40tO2b7IKj6iptTTsJBjq4wPmjlk8sHZbpu+GsMCYw0eqBCspe3jFi26m57 O+/SpOiAK9tSOcNSsB1Oybf+BluxMkmFsVSkWhQsLjCB+HDBo9TJgDb7801marBMBf5l VqMA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nNMZDgnh; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7c041ee6210si359759385a.611.2025.02.07.07.38.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Feb 2025 07:38:47 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nNMZDgnh; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tgQOJ-0006xq-Ps; Fri, 07 Feb 2025 10:35:39 -0500 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 1tgQKY-0008GI-Kf for qemu-devel@nongnu.org; Fri, 07 Feb 2025 10:31:52 -0500 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tgQKH-00042v-Ns for qemu-devel@nongnu.org; Fri, 07 Feb 2025 10:31:44 -0500 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-38dc660b56cso1323101f8f.0 for ; Fri, 07 Feb 2025 07:31:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1738942283; x=1739547083; 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=ss1s/z8UDnfCDTK92VTNTdO4MGHnAPeMCWUHdvvh61s=; b=nNMZDgnhuQajNYVVq558zMpeT6wnXeS/yqwKxgtG3MYBrNDn/sG1+zozdI/ayyzUFZ EuEq7Qh7stYMgyk2KcVByC1KGPQjadhB1QGzSSt1bxtDZynBJ6Kj8gLdjS+9pNdynlhh yXEL6t84aWrRmdo9bqUk3FDvO4/oB4kURd7Ub4iB0Yv8uONtp4fqzhZT/p2mu76epJPV EPyKGmRhTmeKMs58iVLx79nUZy/U746UIRSTnwwOvOOWy6W0AdJ4Wk2G2i6H5en0fjqG +pwj58/5H/sUFieGkcGTk8VqsqB344Ivai4FYGxYTpzQ39wg6CYQnK/ucLrhDAmsqaXq 9dqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738942283; x=1739547083; 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=ss1s/z8UDnfCDTK92VTNTdO4MGHnAPeMCWUHdvvh61s=; b=pAc3X3xfj4OdYACegLvv/zaSyyPJ2++G5iCNYwWFhGeHnlveOzwOnqqyxTjvZm8jit Dmm5d5Cq8acIHeyHj9KEn61DGMqdLOU3zP5c0KPE+y1sE1DK9RrEr2vIAHjQeMdPWXx1 SYYTEK8d7BPbKFX1RGRu9StFUMMu8EPtvv7HzO37l9U5yOfMfAB/e8WGK1G374gsnPK4 WULos21230hsPd6wpO8FElyWzKgvwhp8hYx4lv9r28L4/M60QBcCixDMp1Kc82C7fqWt PcyUECOvjwDjVjcavqG/oe0icj+N7haptkAoVaAp7T6OC8L7FGiPvM1oh07DMVsdNg7d KBMw== X-Gm-Message-State: AOJu0Yw10FV1rSBAYh0M+Wp6f/gcGqZ2ng2Fg0g73EkRlsg6FGJPD7Ul 19oLjVAqBw7sYZO+ZSi4o5b3iKIhlNspmY3UdGU2NDrqQm0VaSn9dt/EkRX7EjI= X-Gm-Gg: ASbGncun5ClBfbmVdyoZ/zQd2WP/pOc5Eo21yPNxA48PrPFgkv/YGi6MOqBKcym9sjp wC9VfCCVNqKIIY8qmFpNDLdqmQ7XQre3utZaPV/IQzt9PFg5QOn9kWDXAebQjnYrGzcQXJkL5Pa Y2jQwZdkfEeU3j49ZcF3/vHC1hambPscb8F2cj03uCQn3Op+NQWrFbx96py8Vymbpwrsy2ih69q qGTQYN0hmn84yWG6kc1ruRsKu3aQ164MxV0wdyPVsAb7dGpXfqTi7UZ1UF9fEBOQnTgV9AHyEoW B7U/5ndtCoQPAMFrqQ== X-Received: by 2002:a5d:584b:0:b0:38b:e32a:109f with SMTP id ffacd0b85a97d-38dc8dbfc57mr2993423f8f.12.1738942283500; Fri, 07 Feb 2025 07:31:23 -0800 (PST) Received: from draig.lan ([185.126.160.109]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ab779832909sm246283066b.49.2025.02.07.07.31.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Feb 2025 07:31:18 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 7F319609FC; Fri, 7 Feb 2025 15:31:13 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Peter Xu , =?utf-8?q?Alex_Benn=C3=A9e?= , Thomas Huth , Weiwei Li , qemu-arm@nongnu.org, Nicholas Piggin , Liu Zhiwei , Bin Meng , Tyrone Ting , Hao Wu , Kyle Evans , Alistair Francis , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Laurent Vivier , Riku Voipio , Harsh Prateek Bora , Fabiano Rosas , Alexandre Iooss , Laurent Vivier , Daniel Henrique Barboza , Warner Losh , Pierrick Bouvier , Palmer Dabbelt , Mahmoud Mandour , qemu-ppc@nongnu.org, Paolo Bonzini , qemu-rust@nongnu.org, qemu-riscv@nongnu.org, Ilya Leoshkevich , Richard Henderson Subject: [PATCH v2 12/17] user: Introduce user/signal.h Date: Fri, 7 Feb 2025 15:31:07 +0000 Message-Id: <20250207153112.3939799-13-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250207153112.3939799-1-alex.bennee@linaro.org> References: <20250207153112.3939799-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42c.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 autolearn=unavailable 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Ilya Leoshkevich gdbstub needs target_to_host_signal(), so move its declaration to a public header. Reviewed-by: Richard Henderson Reviewed-by: Warner Losh Signed-off-by: Ilya Leoshkevich Message-Id: <20250117001542.8290-4-iii@linux.ibm.com> Signed-off-by: Alex Bennée --- bsd-user/signal-common.h | 1 - include/user/signal.h | 23 +++++++++++++++++++++++ linux-user/signal-common.h | 1 - bsd-user/signal.c | 1 + linux-user/signal.c | 1 + linux-user/syscall.c | 1 + 6 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 include/user/signal.h diff --git a/bsd-user/signal-common.h b/bsd-user/signal-common.h index 77d7c7a78b..4e634e04a3 100644 --- a/bsd-user/signal-common.h +++ b/bsd-user/signal-common.h @@ -42,7 +42,6 @@ void process_pending_signals(CPUArchState *env); void queue_signal(CPUArchState *env, int sig, int si_type, target_siginfo_t *info); void signal_init(void); -int target_to_host_signal(int sig); void target_to_host_sigset(sigset_t *d, const target_sigset_t *s); /* diff --git a/include/user/signal.h b/include/user/signal.h new file mode 100644 index 0000000000..19b6b9e5dd --- /dev/null +++ b/include/user/signal.h @@ -0,0 +1,23 @@ +/* + * Signal-related declarations. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ +#ifndef USER_SIGNAL_H +#define USER_SIGNAL_H + +#ifndef CONFIG_USER_ONLY +#error Cannot include this header from system emulation +#endif + +/** + * target_to_host_signal: + * @sig: target signal. + * + * On success, return the host signal between 0 (inclusive) and NSIG + * (exclusive) corresponding to the target signal @sig. Return any other value + * on failure. + */ +int target_to_host_signal(int sig); + +#endif diff --git a/linux-user/signal-common.h b/linux-user/signal-common.h index 8584d9ecc2..196d2406f8 100644 --- a/linux-user/signal-common.h +++ b/linux-user/signal-common.h @@ -61,7 +61,6 @@ void queue_signal(CPUArchState *env, int sig, int si_type, target_siginfo_t *info); void host_to_target_siginfo(target_siginfo_t *tinfo, const siginfo_t *info); void target_to_host_siginfo(siginfo_t *info, const target_siginfo_t *tinfo); -int target_to_host_signal(int sig); int host_to_target_signal(int sig); long do_sigreturn(CPUArchState *env); long do_rt_sigreturn(CPUArchState *env); diff --git a/bsd-user/signal.c b/bsd-user/signal.c index b4e1458237..8c51f6ce65 100644 --- a/bsd-user/signal.c +++ b/bsd-user/signal.c @@ -24,6 +24,7 @@ #include "user/cpu_loop.h" #include "exec/page-protection.h" #include "user/page-protection.h" +#include "user/signal.h" #include "user/tswap-target.h" #include "gdbstub/user.h" #include "signal-common.h" diff --git a/linux-user/signal.c b/linux-user/signal.c index 087c4d270e..bffbef235c 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -36,6 +36,7 @@ #include "user/cpu_loop.h" #include "user/page-protection.h" #include "user/safe-syscall.h" +#include "user/signal.h" #include "tcg/tcg.h" /* target_siginfo_t must fit in gdbstub's siginfo save area. */ diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 6ee02383da..90afaa4426 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -138,6 +138,7 @@ #include "user-mmap.h" #include "user/page-protection.h" #include "user/safe-syscall.h" +#include "user/signal.h" #include "qemu/guest-random.h" #include "qemu/selfmap.h" #include "user/syscall-trace.h" From patchwork Fri Feb 7 15:31:08 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 862993 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e42:0:b0:385:e875:8a9e with SMTP id r2csp385737wrt; Fri, 7 Feb 2025 07:38:34 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCW9s5k9xKbkb98VTJyGMnNIw/QbitMKfABrUJP3LY9DX+uWsjzWOxn94Ioc8dtsE/42nvMp9Q==@linaro.org X-Google-Smtp-Source: AGHT+IEbRgf3buTePmwxfRTaC9xGf6prVHYWYG0IUz16saoOQhhUPBYgHET+9qMwEKppIsdgSw0J X-Received: by 2002:a05:6102:1492:b0:4b1:130f:9fd5 with SMTP id ada2fe7eead31-4ba85eedc49mr3331063137.19.1738942713827; Fri, 07 Feb 2025 07:38:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1738942713; cv=none; d=google.com; s=arc-20240605; b=kJgx7sdPGKpz2nUSde1kJqesQSMu6sWyTU1nvKvOp/xPe2DJ4RrIv5LnrqcSoqJuMG c8Q02bx09moCqR640WV91+TOQcpX48wzllvMbhloMH0vQOyvs5tSXdGCo5W6BkwZJUT8 LgEhHMQtah0hzgFvZUk/xq8mJyhPSQ1j3KwQjADmlRHpl+Bsh3rW5xnfG+XRKdLOr5Ii PqfxSCr+mVLCR4hdcreu5q8VJOsPCddDP6wlLqL8IinuJqnET/2uqkw1M1DScxcAtn+6 +k5OqCDNVcV6I3bUratSzhPY8RttLiRlnWnjCHbhKgm7GE8VK88qaHHJfwioDy5JxUtp YfEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Vu9pOked5UqOucuAkIMsH1wV3NsjfZIqorCbgdhJbNs=; fh=htMF8hQWTZiOGUJHuB6bq90yox4j6xv33yHiWqKjtG8=; b=i8Y1cxk3MiOk4vbCiH5kCiTuWRAoI7TI9LoXa50TSx0S6PnV47kwe5y0wPuKFwo1b7 quUOB4wYPoVyGSHYKGdbPkooRbTUd1etzzcfuwSCI69SJ9mVdGrjiUoa1S8WTi6HzZTE m1tIADoUQT/RbvqYmU27Oa3KENGcyspfQCMQw6TAp/2US9FvOsMqKD6yR71cQBFp+RI1 nT8BzkLsRs5LU2++IGIp+HH0pp/4TifW4ZLbaVqtkQ7JV7vuYcNhlt7kF7KGLaZbJ/z9 vh0aOBB0KQTJJREhdgd0vziqDQ/F+Ahg9aphYjkwKXKFZ3kcjdNDnVMg3TOTeglu9Z8j Jj0g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sO2Ojvfq; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ada2fe7eead31-4ba77656bbbsi803446137.56.2025.02.07.07.38.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Feb 2025 07:38:33 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sO2Ojvfq; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tgQMD-00021Y-NL; Fri, 07 Feb 2025 10:33:33 -0500 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 1tgQKO-0008AC-JP for qemu-devel@nongnu.org; Fri, 07 Feb 2025 10:31:38 -0500 Received: from mail-ej1-x62b.google.com ([2a00:1450:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tgQKB-00041Z-Vw for qemu-devel@nongnu.org; Fri, 07 Feb 2025 10:31:36 -0500 Received: by mail-ej1-x62b.google.com with SMTP id a640c23a62f3a-aaeec07b705so381705466b.2 for ; Fri, 07 Feb 2025 07:31:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1738942282; x=1739547082; 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=Vu9pOked5UqOucuAkIMsH1wV3NsjfZIqorCbgdhJbNs=; b=sO2OjvfqiiWe2p8l3aOp1BdGD2+U56p4FUnTUK+u7P0BQ4AjG/1paYX4r0lRjoRthL Eowj6IiQHjyaf8Gi3AYHa2UV62qAHS0Bsy8kY1vqnOm8ehDcMFHZiEnnrf6UAm1/GjLi dSsh3fiU95ejH9DXGGc5ubinfy19SlyQioj7vcoWMCUmTQQEG51ZYHZr3DsV57ioN2TT Sh+LNQO1y3dg9/eqhNUvk5NYdiZny9ArZDQbw+OD03txwIg6EIWgI/yE9tg+p10maZLh I9luOO4Q3NO30wkcZ+dTto/2bEX6reqslVZXy1gQbOwTwVdt3l1s/5R745Gu0EkPrtMp lizg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738942282; x=1739547082; 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=Vu9pOked5UqOucuAkIMsH1wV3NsjfZIqorCbgdhJbNs=; b=nM1uPQ2OMITGMEWhl0ROnzysKojkOHy+l4khuvZ5bRcZQy8GoXsqPq6+VHLFibj+P0 bnQfQ7IDxlPY7K+bV00nXclZDaVj5S2ktcTCh3KFTwV4BPt8jDpTJ/c1RQt3CSNxgSyx 7UUPAqJ2Lrz7Q1qzSw2Y0swlJPtIOyv/VlFeFrEWObz+Y1KZ2spcrbZe1f//3+ZErGRu RKWMwZkAY+T+nD5DzCoujgygDiqpC/iM9VJZY4i3E7G/dJWORcdOb8h7rm6Z5fZOLBEb cES8MIASf+ECFZ2laQHyJIlEDItF8hdjYBOAorDVK9wmSrzyw4E62V+RMAVq0/elh6Q8 F/eg== X-Gm-Message-State: AOJu0Ywh1rqeQNJgEGtL7g/PGMvvDWLcukyCqo8nJ58tcxEttHB62Dxb EOP5J7MFK+e99iZpZBpUR0nJcde1kVaWeeLLyiKU9xhDUCFTZTqO5zXvkuKbqGM= X-Gm-Gg: ASbGnctCDNJitykS3WzGZvW00myrsqPDlRgqjT81uyzWZ+hQJZ19QfV06QRT5tFo/7u fZ1xJG0k2zb0IRmBOb7z/YbQcA4n2vEGQptAo6tK8wEDoF37pyrJXyJAgPV+oZCXW+mdVtCI7bf Q+9Xcf2AxztOH5mWqIP0s0aGf8kuRfZ7eBeiBv2hKBuxLV811yaXlp4lPx31+ahQDLo0DpJrwrH 0Uno5P52U9/bCWQ9FKDWiq0AmhUiH8SAvJwcBuX9EbDMIdOje7RpsCNidFG0IZ7bR9lTYM4IAYS HTmGZyg7pOvJHPGqyA== X-Received: by 2002:a17:907:9719:b0:ab6:e10e:2f5 with SMTP id a640c23a62f3a-ab789bf6ae5mr405155466b.37.1738942281797; Fri, 07 Feb 2025 07:31:21 -0800 (PST) Received: from draig.lan ([185.126.160.109]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ab7885e032fsm155043666b.115.2025.02.07.07.31.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Feb 2025 07:31:18 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 9520C60BD2; Fri, 7 Feb 2025 15:31:13 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Peter Xu , =?utf-8?q?Alex_Benn=C3=A9e?= , Thomas Huth , Weiwei Li , qemu-arm@nongnu.org, Nicholas Piggin , Liu Zhiwei , Bin Meng , Tyrone Ting , Hao Wu , Kyle Evans , Alistair Francis , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Laurent Vivier , Riku Voipio , Harsh Prateek Bora , Fabiano Rosas , Alexandre Iooss , Laurent Vivier , Daniel Henrique Barboza , Warner Losh , Pierrick Bouvier , Palmer Dabbelt , Mahmoud Mandour , qemu-ppc@nongnu.org, Paolo Bonzini , qemu-rust@nongnu.org, qemu-riscv@nongnu.org, Ilya Leoshkevich Subject: [PATCH v2 13/17] user: Introduce host_interrupt_signal Date: Fri, 7 Feb 2025 15:31:08 +0000 Message-Id: <20250207153112.3939799-14-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250207153112.3939799-1-alex.bennee@linaro.org> References: <20250207153112.3939799-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62b; envelope-from=alex.bennee@linaro.org; helo=mail-ej1-x62b.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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Ilya Leoshkevich Attaching to the gdbstub of a running process requires stopping its threads. For threads that run on a CPU, cpu_exit() is enough, but the only way to grab attention of a thread that is stuck in a long-running syscall is to interrupt it with a signal. Reserve a host realtime signal for this, just like it's already done for TARGET_SIGABRT on Linux. This may reduce the number of available guest realtime signals by one, but this is acceptable, since there are quite a lot of them, and it's unlikely that there are apps that need them all. Set signal_pending for the safe_sycall machinery to prevent invoking the syscall. This is a lie, since we don't queue a guest signal, but process_pending_signals() can handle the absence of pending signals. The syscall returns with QEMU_ERESTARTSYS errno, which arranges for the automatic restart. This is important, because it helps avoiding disturbing poorly written guests. Reviewed-by: Warner Losh Signed-off-by: Ilya Leoshkevich Message-Id: <20250117001542.8290-5-iii@linux.ibm.com> Signed-off-by: Alex Bennée --- include/user/signal.h | 2 ++ bsd-user/signal.c | 12 ++++++++++++ linux-user/signal.c | 25 ++++++++++++++++++++----- 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/include/user/signal.h b/include/user/signal.h index 19b6b9e5dd..7fa33b05d9 100644 --- a/include/user/signal.h +++ b/include/user/signal.h @@ -20,4 +20,6 @@ */ int target_to_host_signal(int sig); +extern int host_interrupt_signal; + #endif diff --git a/bsd-user/signal.c b/bsd-user/signal.c index 8c51f6ce65..ff2ccbbf60 100644 --- a/bsd-user/signal.c +++ b/bsd-user/signal.c @@ -51,6 +51,8 @@ static inline int sas_ss_flags(TaskState *ts, unsigned long sp) on_sig_stack(ts, sp) ? SS_ONSTACK : 0; } +int host_interrupt_signal = SIGRTMAX; + /* * The BSD ABIs use the same signal numbers across all the CPU architectures, so * (unlike Linux) these functions are just the identity mapping. This might not @@ -491,6 +493,12 @@ static void host_signal_handler(int host_sig, siginfo_t *info, void *puc) uintptr_t pc = 0; bool sync_sig = false; + if (host_sig == host_interrupt_signal) { + ts->signal_pending = 1; + cpu_exit(thread_cpu); + return; + } + /* * Non-spoofed SIGSEGV and SIGBUS are synchronous, and need special * handling wrt signal blocking and unwinding. @@ -854,6 +862,9 @@ void signal_init(void) for (i = 1; i <= TARGET_NSIG; i++) { host_sig = target_to_host_signal(i); + if (host_sig == host_interrupt_signal) { + continue; + } sigaction(host_sig, NULL, &oact); if (oact.sa_sigaction == (void *)SIG_IGN) { sigact_table[i - 1]._sa_handler = TARGET_SIG_IGN; @@ -872,6 +883,7 @@ void signal_init(void) sigaction(host_sig, &act, NULL); } } + sigaction(host_interrupt_signal, &act, NULL); } static void handle_pending_signal(CPUArchState *env, int sig, diff --git a/linux-user/signal.c b/linux-user/signal.c index bffbef235c..81a98c6d02 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -517,6 +517,8 @@ static int core_dump_signal(int sig) } } +int host_interrupt_signal; + static void signal_table_init(const char *rtsig_map) { int hsig, tsig, count; @@ -580,10 +582,10 @@ static void signal_table_init(const char *rtsig_map) * Attempts for configure "missing" signals via sigaction will be * silently ignored. * - * Reserve one signal for internal usage (see below). + * Reserve two signals for internal usage (see below). */ - hsig = SIGRTMIN + 1; + hsig = SIGRTMIN + 2; for (tsig = TARGET_SIGRTMIN; hsig <= SIGRTMAX && tsig <= TARGET_NSIG; hsig++, tsig++) { @@ -604,12 +606,17 @@ static void signal_table_init(const char *rtsig_map) host_to_target_signal_table[SIGABRT] = 0; for (hsig = SIGRTMIN; hsig <= SIGRTMAX; hsig++) { if (!host_to_target_signal_table[hsig]) { - host_to_target_signal_table[hsig] = TARGET_SIGABRT; - break; + if (host_interrupt_signal) { + host_to_target_signal_table[hsig] = TARGET_SIGABRT; + break; + } else { + host_interrupt_signal = hsig; + } } } if (hsig > SIGRTMAX) { - fprintf(stderr, "No rt signals left for SIGABRT mapping\n"); + fprintf(stderr, + "No rt signals left for interrupt and SIGABRT mapping\n"); exit(EXIT_FAILURE); } @@ -689,6 +696,8 @@ void signal_init(const char *rtsig_map) } sigact_table[tsig - 1]._sa_handler = thand; } + + sigaction(host_interrupt_signal, &act, NULL); } /* Force a synchronously taken signal. The kernel force_sig() function @@ -1036,6 +1045,12 @@ static void host_signal_handler(int host_sig, siginfo_t *info, void *puc) bool sync_sig = false; void *sigmask; + if (host_sig == host_interrupt_signal) { + ts->signal_pending = 1; + cpu_exit(thread_cpu); + return; + } + /* * Non-spoofed SIGSEGV and SIGBUS are synchronous, and need special * handling wrt signal blocking and unwinding. Non-spoofed SIGILL, From patchwork Fri Feb 7 15:31:09 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 862991 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e42:0:b0:385:e875:8a9e with SMTP id r2csp385257wrt; Fri, 7 Feb 2025 07:37:41 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVIDFS2xUrd+ZOrPcqeF+4NHtqfjm6vHIxX5XQcHVB3rLqPDoyBOBmctll6Yx9A5YgF7uWv1A==@linaro.org X-Google-Smtp-Source: AGHT+IF7+83vK4xGC6A5Cf9G5t/5+qp33kAZRi99bf7Y35EGRIPm4+bTYjuAC5TF52/9IFT2mjtE X-Received: by 2002:ad4:5d6c:0:b0:6d8:d79c:1cbd with SMTP id 6a1803df08f44-6e4455fa8bdmr48529856d6.15.1738942661614; Fri, 07 Feb 2025 07:37:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1738942661; cv=none; d=google.com; s=arc-20240605; b=cr1s9vp63VfA6cYepHxsXG0ThX+07YAiGpg71I6HTW7IWtdBdQn6Dl+gSds+BaCEwD 333QJNnErkOWjQnARq24XuXA671/2uib1PODwlDghfUugz41xWAYvtdFuHSgd5RTRVEN H5FY1CCytGu350p7jKXRK2B9ulgUeEfpGulEKZxuP+RU296xrJZRm3UuPEHHtiV6Lvz9 sTAYQqFkFurwf25yOPAVxKfTTDevOIsY44inpZQzOq479XDKceLIEViRUxVynP5s9SxE ziWMaJlTqtXo+MRU78b6EKCqXSrECiD6iUffg5XIx/Mcnu12UNVS17jMWyEhnLxhQr0n d3dA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=M1O482OJIh050UUseeR+bYA6QoGKKDZRGYOAk/RFThQ=; fh=Jdg4fLQw/+vV+BD6NiVJYsZoanjBKb4fl4V8sUUe9bg=; b=iVhKMGww8RlkMIblfjSvd+DaTypmavbNwO3IVAeczx/5ADLFkAiCpglDnweqkzB7le NFc/g7xrBo/46GgqBAd+rnUH5jTsl2p7luEHCtSlOuEKjIBGlCHXM4gToqbRyzE/Wp0B buK6v81tpePbkAnuoZ3XuIClgoZcG0fE9eqjzji0PC4fYtBEKq4VifUJA9gluOcybl1o X0sP+Wtq312QwZ2bGBhNLB4qzL/tmkeCHqRBIdwHL3t3ck3FBvjC08SvIBaiSt4QxrAJ hgxWfTyPhWfk7QRtMc2zfn3J/+DttmJ8DEIxaetihMhSjEJV2u0wgJdAcgJBUVt6r3QN n1Kg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Zp2VrnY9; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id a1e0cc1a2514c-866f940e75fsi768046241.1.2025.02.07.07.37.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Feb 2025 07:37:41 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Zp2VrnY9; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tgQMq-0002ge-Lv; Fri, 07 Feb 2025 10:34:09 -0500 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 1tgQKP-0008AT-VO for qemu-devel@nongnu.org; Fri, 07 Feb 2025 10:31:39 -0500 Received: from mail-ej1-x634.google.com ([2a00:1450:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tgQKD-00042H-1Q for qemu-devel@nongnu.org; Fri, 07 Feb 2025 10:31:37 -0500 Received: by mail-ej1-x634.google.com with SMTP id a640c23a62f3a-ab78d9c5542so134427766b.1 for ; Fri, 07 Feb 2025 07:31:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1738942283; x=1739547083; 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=M1O482OJIh050UUseeR+bYA6QoGKKDZRGYOAk/RFThQ=; b=Zp2VrnY9aJlvuuaDsu5xChFdmkAhqli7chpu33/UN+XNB85ibKm2YMIME//qQtiPoo fukKEJTJqDvMF4Xz46bsjdap4h8jm8I7bYrfVTB8N8W7AYPEpDd2SjyDetKgYw7nz1WP oIRPkfNip1nFIgsOslx6/eCW/2vj6voSRDJlPIU2oRXeL8cjwDo8plUwv0cY3IOv4q4j 4Z6CAG+xMsgeqD3TIcG3rVn1MW1JkXZPOmGn/3afL+y8+bqgq8W/+jWzHZi9aVRxEzoZ X7U2ADlcs1SppXGuKi+8PTZRkb+TALAnFgZfXQKOu/VH+9TRM96ssaFhIlWufRBdKiUo Wi1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738942283; x=1739547083; 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=M1O482OJIh050UUseeR+bYA6QoGKKDZRGYOAk/RFThQ=; b=FbSLVgu88mdUNs3qg4hRVmrcwgQRC8CI9WjftK0M1KX6SiMp5JFtjV66Koqrc5UK3M VGiVYpzZRA8u5emubFSVukueEMNRmi/cQHlk2FidKPrGAthARKCuwP8VUhBb7SGdDLIG BKOz3Scf8S33lHWo0A7zXeYle2PP34CqDmZkefxPtA5JHAM0KL6L4EDXAC7vP+otfmMW bkWiPRbxYepwG9rLCcBSzGY+ECKvEIlh7SfOlTNJcWMbvz5FAcr3hj4xtG4PYmT7pAac Ap5gX540llgQ2zL/Sbg9Rn13ev0LuToUVQCj+LY+gWQJTmN4RpE+luMkgyK8tCEyaNmH eUfA== X-Gm-Message-State: AOJu0YwYYtqLp0a0q4Wdt2FE3O0rlxnCDTrhmlnW6MJESa7KUPLAP4Ae iuZDsqpKymyzV4O8c1k1SdFTan/XEh5Ihnk9kC7+3WOWqYpMMmBS3d0/hgGi1bI= X-Gm-Gg: ASbGncutyTkeR21WPIANDN2uR5IHTF/oiFsYdrpVypP6/knDYW5hxGiGX6+6Gv/jPI8 GjFIrtMdPlqJo2e0NBn5SQ3kqvaf004yTgkduXM0Tvj+ts8M3n0L1vgTBuc/F7qoAM6cSUc0BLa g2ZZgOeQvwScKs4eow4xPVHckAFVj+OA/fhOfRGJE3JRjOzsaglM9jbC5MK3vPZfeeLAwblOI+m /Up/eySZdVBURolmpnKQ9QGJOV6XVAe4WaD8e6wTa998eYKmenIlszP1rIsYz+e9SMKrE7hnLGQ PqpXAjsh7lwJYzkrnA== X-Received: by 2002:a17:906:4fd6:b0:aa6:79fa:b47d with SMTP id a640c23a62f3a-ab789a681a3mr405645966b.1.1738942282560; Fri, 07 Feb 2025 07:31:22 -0800 (PST) Received: from draig.lan ([185.126.160.109]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ab77f5f5a0esm216633666b.155.2025.02.07.07.31.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Feb 2025 07:31:18 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id A88E960C3D; Fri, 7 Feb 2025 15:31:13 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Peter Xu , =?utf-8?q?Alex_Benn=C3=A9e?= , Thomas Huth , Weiwei Li , qemu-arm@nongnu.org, Nicholas Piggin , Liu Zhiwei , Bin Meng , Tyrone Ting , Hao Wu , Kyle Evans , Alistair Francis , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Laurent Vivier , Riku Voipio , Harsh Prateek Bora , Fabiano Rosas , Alexandre Iooss , Laurent Vivier , Daniel Henrique Barboza , Warner Losh , Pierrick Bouvier , Palmer Dabbelt , Mahmoud Mandour , qemu-ppc@nongnu.org, Paolo Bonzini , qemu-rust@nongnu.org, qemu-riscv@nongnu.org, Ilya Leoshkevich , Richard Henderson Subject: [PATCH v2 14/17] osdep: Introduce qemu_kill_thread() Date: Fri, 7 Feb 2025 15:31:09 +0000 Message-Id: <20250207153112.3939799-15-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250207153112.3939799-1-alex.bennee@linaro.org> References: <20250207153112.3939799-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::634; envelope-from=alex.bennee@linaro.org; helo=mail-ej1-x634.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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Ilya Leoshkevich Add a function for sending signals to individual threads. It does not make sense on Windows, so do not provide an implementation, so that if someone uses it by accident, they will get a linker error. Reviewed-by: Richard Henderson Reviewed-by: Warner Losh Signed-off-by: Ilya Leoshkevich Message-Id: <20250117001542.8290-6-iii@linux.ibm.com> Signed-off-by: Alex Bennée --- include/qemu/osdep.h | 9 +++++++++ util/oslib-posix.c | 15 +++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 112ebdff21..4397a90680 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -631,6 +631,15 @@ bool qemu_write_pidfile(const char *pidfile, Error **errp); int qemu_get_thread_id(void); +/** + * qemu_kill_thread: + * @tid: thread id. + * @sig: host signal. + * + * Send @sig to one of QEMU's own threads with identifier @tid. + */ +int qemu_kill_thread(int tid, int sig); + #ifndef CONFIG_IOVEC struct iovec { void *iov_base; diff --git a/util/oslib-posix.c b/util/oslib-posix.c index 2bb34dade3..a697c602c6 100644 --- a/util/oslib-posix.c +++ b/util/oslib-posix.c @@ -111,6 +111,21 @@ int qemu_get_thread_id(void) #endif } +int qemu_kill_thread(int tid, int sig) +{ +#if defined(__linux__) + return syscall(__NR_tgkill, getpid(), tid, sig); +#elif defined(__FreeBSD__) + return thr_kill2(getpid(), tid, sig); +#elif defined(__NetBSD__) + return _lwp_kill(tid, sig); +#elif defined(__OpenBSD__) + return thrkill(tid, sig, NULL); +#else + return kill(tid, sig); +#endif +} + int qemu_daemon(int nochdir, int noclose) { return daemon(nochdir, noclose); From patchwork Fri Feb 7 15:31:10 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 862985 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e42:0:b0:385:e875:8a9e with SMTP id r2csp382932wrt; Fri, 7 Feb 2025 07:33:19 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWtDBVI/DAJmIQFqr9WIUEg/Jag8hJJvjVAu53Tmn/YLUPoBAzfIXkl8eLh8k1blUiLMlZ1uQ==@linaro.org X-Google-Smtp-Source: AGHT+IFzxHa7lS7qbSUr8aR+hTd/0L77eMq8BeM6/7joykvrT57AH/FROkAC1PIIDsK+4LzDCzvu X-Received: by 2002:a05:620a:8b85:b0:7be:73b5:b303 with SMTP id af79cd13be357-7c047bc73acmr411081585a.31.1738942398868; Fri, 07 Feb 2025 07:33:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1738942398; cv=none; d=google.com; s=arc-20240605; b=C7MX9r/RCVy6HQHI7faflZ/FlZLGvf4gaHT7jZIkFubt4+3WEw2CQuYRrhOt8wXgoh qcftFSr+BuI3vmKPIVbm4sYoHdmEZF6CXNTRS8d2v+BfVWQZ50LvSCKMeEle5NE/yGps nlLjUG2yi09/kkIGnpGVwHT8/fZFk2n2kLst1aEMaLcrUkecN9D2FhCc9eTdY1PX1ZLl +qhKTM/GqaSFQ9R6ooJyr2wwBJAW/TFyc7AjAUziSJyP43VTnBpdhK9oJlmJFVYk791S mPJHKL/7Ig8oO2MxVXX4IvgRpleCGlkRCwoU9Fo8NHq//lnPvWd50CZ4lvZVdgcjg3Br 6twg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=DNmUeNVqLMWnKw5VpxIg7HB3Zjmh6ElltpcE7zlO/sI=; fh=htMF8hQWTZiOGUJHuB6bq90yox4j6xv33yHiWqKjtG8=; b=aIsSGgGquZG44AEkRwgkMtaW8Ij2mfl/zaxWrJpxsyUx121dFsBuuU3kd9CWHWB0wb DnGJ5X3egJqkQqtd14n31T27MmN2b3kW7R+vI+pcNYmNMdqB0tOds+83Idi+29XknBi0 U0a929KnfoNZbqRAsz+JO7sEvbKCzGVmav5DLY3hFRsTAknIVUuiET9W0YzRNxg3tw3T 1NIfgVmjEPQgRvGC0yMwdQmkKl5ON09wQDlRAn+3+P9h5CqOCspwQOItkVdcEsMFNq+r uYP3k6yjONeM5NZ7D+5zJTm190h/XeWH6slvFRmd4MAVeU9lCyV955FWfJ7GF908++d9 Cw3g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MiD6eUT3; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id a1e0cc1a2514c-866f940c09dsi657493241.25.2025.02.07.07.33.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Feb 2025 07:33:18 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MiD6eUT3; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tgQLg-0001dK-5W; Fri, 07 Feb 2025 10:32:57 -0500 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 1tgQKT-0008FZ-KZ for qemu-devel@nongnu.org; Fri, 07 Feb 2025 10:31:51 -0500 Received: from mail-ed1-x533.google.com ([2a00:1450:4864:20::533]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tgQKG-00044S-68 for qemu-devel@nongnu.org; Fri, 07 Feb 2025 10:31:40 -0500 Received: by mail-ed1-x533.google.com with SMTP id 4fb4d7f45d1cf-5dca468c5e4so1751945a12.1 for ; Fri, 07 Feb 2025 07:31:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1738942286; x=1739547086; 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=DNmUeNVqLMWnKw5VpxIg7HB3Zjmh6ElltpcE7zlO/sI=; b=MiD6eUT3WnfnkpqKlDG+JXkYJyiDcqOC8tAK8NIbN1apzyqH57+v97qqT92TFHYPMb pVPpMU+RA9Ski6WYGhyV0QcIoADiX7UJrUe8QjztM5T/sxtzdShgmmp0p21QZuxsyzUN NtVOMDzZ6T8Da7VB5rQtnnYX5qKHSqPPoeLUK+wmR1UAf7q2pNu9qEc2iOZr8Ds0bHeA +xw3qX5MTLqIEOtf3HRCO8470VC/OUMYLfypP84Zy7Bni0CjULjPIDveS28HrmLYdQHG 3C0U+Gn5wMxTtUx+fX2RThid42/Un0Lms5xa337XWgDHxmLC5APexvILjEPmNfUUXisI OD6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738942286; x=1739547086; 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=DNmUeNVqLMWnKw5VpxIg7HB3Zjmh6ElltpcE7zlO/sI=; b=gGGcpSlz53pcJ1wjp1uPZwzw4QhTm1rKORwYfcr/FyystsfntPooqZToTh0VNZscED 0m/oX+Qjl+/yirvmWHeG2LarN3G6RYptaDdTHWffx/Fr/sW6x/Qshdu7kjCGiNKl4+AR 7eFyP0exxkoKbU6NMuH5J7W+Se6fhAks4Df+ZuWoLtSnrzEhUD/bR1Y9cyWmkq2DMad5 tekNWZsxb8/OAjg8zcbYbME3Ps9X8faXPqkieLVzT5Njno2vPrjFhlOl6ol2EXG9HpNG 3Xdfj2QUi7bxccOBjDqn71f/9xmcmFPqGgpeTjneAQyLED+kcMdU0lfm7A0cWIHU+Uf2 jJ1A== X-Gm-Message-State: AOJu0YzuznS2nvXFXOII5iXYbOoqHwSKvLPGe817cLFMX6EaV6z3n4ji kca7+f02n6+swVVvAsBNqDsokqnhtRiGGe8FG2yEKkTYcj07POdRmCSXJ6ofOUM= X-Gm-Gg: ASbGncvvqSBeWbsH28fpavAgzRpXAldnEawNzF/wltqVDmRoOLiDVyd9rLDU1o0Hl6x H11qvyALRKyTjRQWdlbwoJhGMNSeFmpPeKIkoyWt1R+qEBljP+Kyra7E7cd2ksa0GlZyYlshZgx 10W618ONnD4oHR3nJmtEJQwQtk4o/A2a4JBp32Erf6545wqErPmCMPYna5w0b4CO33JD6NTX2ZT YAh/tmJyks2cF1Ml1gbXWoacrsHHccxONNc09U2NJLBaZpXaDqVskjpDWudndhIpj8d6SXeWV/W QHLOvtNfXJTerA0xoA== X-Received: by 2002:a50:d6d7:0:b0:5dc:113c:46c3 with SMTP id 4fb4d7f45d1cf-5de4508dcabmr3021579a12.21.1738942285586; Fri, 07 Feb 2025 07:31:25 -0800 (PST) Received: from draig.lan ([185.126.160.109]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5dcf6c9f8besm2702253a12.52.2025.02.07.07.31.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Feb 2025 07:31:23 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id BF95060E67; Fri, 7 Feb 2025 15:31:13 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Peter Xu , =?utf-8?q?Alex_Benn=C3=A9e?= , Thomas Huth , Weiwei Li , qemu-arm@nongnu.org, Nicholas Piggin , Liu Zhiwei , Bin Meng , Tyrone Ting , Hao Wu , Kyle Evans , Alistair Francis , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Laurent Vivier , Riku Voipio , Harsh Prateek Bora , Fabiano Rosas , Alexandre Iooss , Laurent Vivier , Daniel Henrique Barboza , Warner Losh , Pierrick Bouvier , Palmer Dabbelt , Mahmoud Mandour , qemu-ppc@nongnu.org, Paolo Bonzini , qemu-rust@nongnu.org, qemu-riscv@nongnu.org, Ilya Leoshkevich Subject: [PATCH v2 15/17] gdbstub: Allow late attachment Date: Fri, 7 Feb 2025 15:31:10 +0000 Message-Id: <20250207153112.3939799-16-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250207153112.3939799-1-alex.bennee@linaro.org> References: <20250207153112.3939799-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::533; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-x533.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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Ilya Leoshkevich Allow debugging individual processes in multi-process applications by starting them with export QEMU_GDB=/tmp/qemu-%d.sock,suspend=n. Currently one would have to attach to every process to ensure the app makes progress. In case suspend=n is not specified, the flow remains unchanged. If it is specified, then accepting the client connection is delegated to a thread. In the future this machinery may be reused for handling reconnections and interruptions. On accepting a connection, the thread schedules gdb_handlesig() on the first CPU and wakes it up with host_interrupt_signal. Note that the result of this gdb_handlesig() invocation is handled, as opposed to many other existing call sites. These other call sites probably need to be fixed separately. Signed-off-by: Ilya Leoshkevich Message-Id: <20250117001542.8290-7-iii@linux.ibm.com> Signed-off-by: Alex Bennée --- bsd-user/main.c | 1 - gdbstub/user.c | 115 +++++++++++++++++++++++++++++++++++++++++----- linux-user/main.c | 1 - 3 files changed, 103 insertions(+), 14 deletions(-) diff --git a/bsd-user/main.c b/bsd-user/main.c index b2f6a9be2f..fdb160bed0 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -629,7 +629,6 @@ int main(int argc, char **argv) if (gdbstub) { gdbserver_start(gdbstub, &error_fatal); - gdb_handlesig(cpu, 0, NULL, NULL, 0); } cpu_loop(env); /* never exits */ diff --git a/gdbstub/user.c b/gdbstub/user.c index 8225b70280..3730f32c41 100644 --- a/gdbstub/user.c +++ b/gdbstub/user.c @@ -22,6 +22,7 @@ #include "gdbstub/user.h" #include "gdbstub/enums.h" #include "hw/core/cpu.h" +#include "user/signal.h" #include "trace.h" #include "internals.h" @@ -393,32 +394,122 @@ static int gdbserver_open_port(int port, Error **errp) return fd; } -bool gdbserver_start(const char *port_or_path, Error **errp) +static bool gdbserver_accept(int port, int gdb_fd, const char *path) { - int port = g_ascii_strtoull(port_or_path, NULL, 10); + bool ret; + + if (port > 0) { + ret = gdb_accept_tcp(gdb_fd); + } else { + ret = gdb_accept_socket(gdb_fd); + if (ret) { + gdbserver_user_state.socket_path = g_strdup(path); + } + } + + if (!ret) { + close(gdb_fd); + } + + return ret; +} + +struct { + int port; int gdb_fd; + char *path; +} gdbserver_args; + +static void do_gdb_handlesig(CPUState *cs, run_on_cpu_data arg) +{ + int sig; + + sig = target_to_host_signal(gdb_handlesig(cs, 0, NULL, NULL, 0)); + if (sig >= 1 && sig < NSIG) { + qemu_kill_thread(gdb_get_cpu_index(cs), sig); + } +} + +static void *gdbserver_accept_thread(void *arg) +{ + if (gdbserver_accept(gdbserver_args.port, gdbserver_args.gdb_fd, + gdbserver_args.path)) { + CPUState *cs = first_cpu; + + async_safe_run_on_cpu(cs, do_gdb_handlesig, RUN_ON_CPU_NULL); + qemu_kill_thread(gdb_get_cpu_index(cs), host_interrupt_signal); + } + + g_free(gdbserver_args.path); + gdbserver_args.path = NULL; + + return NULL; +} +#define USAGE "\nUsage: -g {port|path}[,suspend={y|n}]" + +bool gdbserver_start(const char *args, Error **errp) +{ + g_auto(GStrv) argv = g_strsplit(args, ",", 0); + const char *port_or_path = NULL; + bool suspend = true; + int gdb_fd, port; + GStrv arg; + + for (arg = argv; *arg; arg++) { + g_auto(GStrv) tokens = g_strsplit(*arg, "=", 2); + + if (g_strcmp0(tokens[0], "suspend") == 0) { + if (tokens[1] == NULL) { + error_setg(errp, + "gdbstub: missing \"suspend\" option value" USAGE); + return false; + } else if (!qapi_bool_parse(tokens[0], tokens[1], + &suspend, errp)) { + return false; + } + } else { + if (port_or_path) { + error_setg(errp, "gdbstub: unknown option \"%s\"" USAGE, *arg); + return false; + } + port_or_path = *arg; + } + } + if (!port_or_path) { + error_setg(errp, "gdbstub: port or path not specified" USAGE); + return false; + } + + port = g_ascii_strtoull(port_or_path, NULL, 10); if (port > 0) { gdb_fd = gdbserver_open_port(port, errp); } else { gdb_fd = gdbserver_open_socket(port_or_path, errp); } - if (gdb_fd < 0) { return false; } - if (port > 0 && gdb_accept_tcp(gdb_fd)) { - return true; - } else if (gdb_accept_socket(gdb_fd)) { - gdbserver_user_state.socket_path = g_strdup(port_or_path); + if (suspend) { + if (gdbserver_accept(port, gdb_fd, port_or_path)) { + gdb_handlesig(first_cpu, 0, NULL, NULL, 0); + return true; + } else { + error_setg(errp, "gdbstub: failed to accept connection"); + return false; + } + } else { + QemuThread thread; + + gdbserver_args.port = port; + gdbserver_args.gdb_fd = gdb_fd; + gdbserver_args.path = g_strdup(port_or_path); + qemu_thread_create(&thread, "gdb-accept", + &gdbserver_accept_thread, NULL, + QEMU_THREAD_DETACHED); return true; } - - /* gone wrong */ - close(gdb_fd); - error_setg(errp, "gdbstub: failed to accept connection"); - return false; } void gdbserver_fork_start(void) diff --git a/linux-user/main.c b/linux-user/main.c index 7198fa0986..5c74c52cc5 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -1024,7 +1024,6 @@ int main(int argc, char **argv, char **envp) if (gdbstub) { gdbserver_start(gdbstub, &error_fatal); - gdb_handlesig(cpu, 0, NULL, NULL, 0); } #ifdef CONFIG_SEMIHOSTING From patchwork Fri Feb 7 15:31:11 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 862984 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e42:0:b0:385:e875:8a9e with SMTP id r2csp382689wrt; Fri, 7 Feb 2025 07:32:56 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVbzGX0CgvlXEyygGLpn0mnEIN5QbLVmvlfJn9V/4oU4XwytoFBi18OgR4HrBAAJmPavy9ZLA==@linaro.org X-Google-Smtp-Source: AGHT+IHgnbrALbA5DCF95kGnT+PeYDZlsoJfUZ+27BRwq9g2OF5MQD3ocCSTcrpzEBYVUZ+j3ZS3 X-Received: by 2002:a05:620a:1929:b0:7ac:c348:6a52 with SMTP id af79cd13be357-7c047c45ea4mr558843985a.34.1738942376235; Fri, 07 Feb 2025 07:32:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1738942376; cv=none; d=google.com; s=arc-20240605; b=CGXEhNY8nrvSnCnfHF35AqP0CSQKsWjLJK8FAzH/o+iqOByGFPTI2VqGDSMpNERJ+2 3kXgsQpKlmLoA1BQFQhNAuIn3N8pIQ3fMEuMGCFsImM5fo95JFGRlsCgsbA1HuIuVXEO DQ/Dz8MfzbMgix1UNPScj6yesgtf8N+orgSq4ipMRLeOhI1cWjv5YrNfLCk2hpg+XRpf dr10SKra873o0djAdgM135Kzaljejo0ogT5mXYllCjpPL4XhgP8Os2mAiFMi25bt6C3l 5QNkPt4S47dwIsKjnMqcOuNm60H0F5wh0aARVkZaPL21DsU3xzPjDlFKk5UhzwzoLufS cH1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=BYLUPD3P/9Yhc9T5gc39GsuYcITC/cYJ3+WE96RAZnc=; fh=htMF8hQWTZiOGUJHuB6bq90yox4j6xv33yHiWqKjtG8=; b=E2EG6rWAzozoKonfmhw5PpNAtjDFwQ4WGvyBZ7gsAISFtw9L/ANdYG82FNo+SjLim7 Bf43lstI673aT8A9v0G+iU06dSwZJSa/A2EwrV9Bs3k98gmZOyZ7ig0b2e+N1uR4Rt5r Giwyrd6v/nOHofGQcYxN1PAVQN/XKStIeMPSsm8hCJ2SVszeQRwZ9HU7yv3tTsgOZdaP TUaFSOFQ94UYC8KlQbiEJD6m6GkXd2iE7woYuKEZ+U29e5H27nw8qvP2lJwUm+VwchO1 myBjWDG3kV2p8jgKsohWaISFQ8AQ9PDbygBPju7ksnPeJhadQwxzZL7UOioqCvUIQjvl CoCA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cNWUNp6i; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ada2fe7eead31-4ba7765969asi754627137.122.2025.02.07.07.32.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Feb 2025 07:32:56 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cNWUNp6i; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tgQLc-0001Vp-Qn; Fri, 07 Feb 2025 10:32:53 -0500 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 1tgQKY-0008G8-IH for qemu-devel@nongnu.org; Fri, 07 Feb 2025 10:31:52 -0500 Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tgQKI-000447-MI for qemu-devel@nongnu.org; Fri, 07 Feb 2025 10:31:45 -0500 Received: by mail-ed1-x529.google.com with SMTP id 4fb4d7f45d1cf-5dcea5d8f16so4380497a12.2 for ; Fri, 07 Feb 2025 07:31:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1738942285; x=1739547085; 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=BYLUPD3P/9Yhc9T5gc39GsuYcITC/cYJ3+WE96RAZnc=; b=cNWUNp6iqSEN5S+2196aERtNTILTuYe7zoTFQEYG2iVvo6cNmv7LfgHfBLKsjcEKbV /TlcM2NFGPJf99CjtpwxiZhWi24C/Z8oUuRFhsWz7z8eH8gqbTBDqiuWNRI63xFdInDJ ZDSMJY+gjwYjrIkVOzh0C6sumFaArCuw2eS56B4glzmFGX0bTviMXW0Ehr6Yj8C/eNUr NcezNty/W1Sa9wvvLG63REW8sSnWRigyiFvCSfboJwCwBiAOIQrARXTNbOhVcXZE2uM/ QBniJ7KcLfm0kDseFLy3n5Zt3i7X9yGVV7Z9Y5uah8XSJaAxz4DRNC1Po/Pz7WhxxffP 1hfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738942285; x=1739547085; 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=BYLUPD3P/9Yhc9T5gc39GsuYcITC/cYJ3+WE96RAZnc=; b=Pli35lnk9j7h5XuK3okIfytqzeyIAea76ezTTPC7vZFmMzbBStQJ9PBkvWt+M7PB4m 12jppk6BlYd8up2RJa/PzEBDqYGkFAE5ZcFjOdorti+RRcx4w1MmO+cMe/Ay10c/hROt fZB9/cU7DPqxoyABhkOa1K+ePtJFd+XTczv62XXxUpr6W7fUTCggU7VbiOfFDlPFAmZU vZ7fyFFwzdpOD2u+wI3WQYMEU9AfFJHBPeu9cCYosVTgE8SRoW5DdLRTTIUoE3VrLmnX ORPdF3elgEvjDUNGr9sntiNl3hkufhgHiQaux6jPRadjWnxq1YIaT7/QZ79ZZuL8TXnq FyjQ== X-Gm-Message-State: AOJu0YypZ7Y9v1RpopSvf73KQUD8mTNdJtwVmvMJkdSoU0+hacQT0dCE /VMLCJ+7sEqX3zBueMeKnS9EQIU743bMK4zDiGLZbPqCKjpdYvqMO/61QEG4GRA= X-Gm-Gg: ASbGncs9J4IhUDMYViydZLx4PsNlRckTDnl5T0YYaskL2QUAFuoolrPX3FP5rZ3vLtg Lo7HjLY3/STO+OnDGtUH0dzVqS8YWJaeaobWxKWJsUA+scZrhpEhKGBh3jAaStWbKb8QhXqOAzk kk6KGmwjCluL8Ngt4vgnVrXQx6gQ3ylg10mFPY0L8bCvGVUsGh40y1wpcthO1YE5U8owoUVpYl4 /osYzrMowFkTcg9G5NpdpvxJ5hdADMHtpFoPRVp2yNkaEUgIbVayPwjgxoTFxdCHR2E/c0HXGWB +PZgRB1rNHPFl3zBSQ== X-Received: by 2002:a17:907:c28:b0:ab7:63fa:e368 with SMTP id a640c23a62f3a-ab789c87ec5mr381999866b.52.1738942285213; Fri, 07 Feb 2025 07:31:25 -0800 (PST) Received: from draig.lan ([185.126.160.109]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ab772f842c8sm285285766b.39.2025.02.07.07.31.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Feb 2025 07:31:20 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id D224960F1B; Fri, 7 Feb 2025 15:31:13 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Peter Xu , =?utf-8?q?Alex_Benn=C3=A9e?= , Thomas Huth , Weiwei Li , qemu-arm@nongnu.org, Nicholas Piggin , Liu Zhiwei , Bin Meng , Tyrone Ting , Hao Wu , Kyle Evans , Alistair Francis , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Laurent Vivier , Riku Voipio , Harsh Prateek Bora , Fabiano Rosas , Alexandre Iooss , Laurent Vivier , Daniel Henrique Barboza , Warner Losh , Pierrick Bouvier , Palmer Dabbelt , Mahmoud Mandour , qemu-ppc@nongnu.org, Paolo Bonzini , qemu-rust@nongnu.org, qemu-riscv@nongnu.org, Ilya Leoshkevich Subject: [PATCH v2 16/17] docs/user: Document the %d placeholder and suspend=n QEMU_GDB features Date: Fri, 7 Feb 2025 15:31:11 +0000 Message-Id: <20250207153112.3939799-17-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250207153112.3939799-1-alex.bennee@linaro.org> References: <20250207153112.3939799-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::529; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-x529.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 autolearn=unavailable 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Ilya Leoshkevich Reviewed-by: Alex Bennée Signed-off-by: Ilya Leoshkevich Message-Id: <20250117001542.8290-8-iii@linux.ibm.com> Signed-off-by: Alex Bennée --- docs/user/main.rst | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/docs/user/main.rst b/docs/user/main.rst index 80a77f0a0c..9a1c60448c 100644 --- a/docs/user/main.rst +++ b/docs/user/main.rst @@ -54,7 +54,7 @@ Command line options :: - qemu-i386 [-h] [-d] [-L path] [-s size] [-cpu model] [-g port] [-B offset] [-R size] program [arguments...] + qemu-i386 [-h] [-d] [-L path] [-s size] [-cpu model] [-g endpoint] [-B offset] [-R size] program [arguments...] ``-h`` Print the help @@ -91,8 +91,18 @@ Debug options: Activate logging of the specified items (use '-d help' for a list of log items) -``-g port`` - Wait gdb connection to port +``-g endpoint`` + Wait gdb connection to a port (e.g., ``1234``) or a unix socket (e.g., + ``/tmp/qemu.sock``). + + If a unix socket path contains single ``%d`` placeholder (e.g., + ``/tmp/qemu-%d.sock``), it is replaced by the emulator PID, which is useful + when passing this option via the ``QEMU_GDB`` environment variable to a + multi-process application. + + If the endpoint address is followed by ``,suspend=n`` (e.g., + ``1234,suspend=n``), then the emulated program starts without waiting for a + connection, which can be established at any later point in time. ``-one-insn-per-tb`` Run the emulation with one guest instruction per translation block. From patchwork Fri Feb 7 15:31:12 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 862995 Delivered-To: patch@linaro.org Received: by 2002:a5d:4e42:0:b0:385:e875:8a9e with SMTP id r2csp386599wrt; Fri, 7 Feb 2025 07:40:16 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUabMViOz9MADrjJuN4wVVGJrqbs46cO6QV1TTVlh5+H2Ig3379Fj2Hx0qtZLiyY8df/GgKyA==@linaro.org X-Google-Smtp-Source: AGHT+IGZQfUOWJPVT5gEHRCYZ2qF6o+xy2NmcnBQU+nKiiFR+PpSjf4ecZDoM16K7eYdNJYDz/8m X-Received: by 2002:a05:620a:284d:b0:7b6:d939:f958 with SMTP id af79cd13be357-7c047bc6df7mr559937785a.25.1738942816517; Fri, 07 Feb 2025 07:40:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1738942816; cv=none; d=google.com; s=arc-20240605; b=L+M3byoUKa/0N/Lp5aDAExnwd8uBkIxfvSale9F07rEkUNCu2jrgoovF6IzbWM8bw2 ByHuD0CqbUQOblrA/deB2QWg+WkvLLcNW54MxU8uvMw1iRz90PQU1e4qMjaXeuCLY521 fubb9vO7W0EQJAmLLsjpEzleKdvy64/Grvuw9neUcJZNkTogAQ9G4mJiTYjYfp5z+w33 1D6Am36VWzD5Dc2yA0hQgxioXZLQEZ+fl0kaH4iwmDtSI20W8D0dzoqgXsV/CczQFi1p B5Ub97xFmxzjNieuCeEtXeqs3WvK+e1IOk0YM5S3fivuc0p9a0DqYpIpCBqk0Q+6w406 QykQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gkJVfCavNsBQMZBi92Kjm0ej3U2Pdiir6so6tZSVLo8=; fh=htMF8hQWTZiOGUJHuB6bq90yox4j6xv33yHiWqKjtG8=; b=F+xmIm1HGR7wfZf3mHBSgt9uNYUpIGMRmrUH7CVG+U9fiobmf4FRiOF/9vz/SB/1n7 2ERRRdtn6gMgqWXwQIuuX2WGqjSls0BF35WZGw9DJDnuOEZjZkV824uognuOBtU5T91s ctRGRDIBdVsawdwGk5L3W/1BIL4jDXxtxgfoNlvutoZkGXLmo54tBecLulFbUQrVIaZD 5EvgsT9llS8LbDG7I5kK5X88EX0O1QeL4p2jbDJszR0kS5XZ34/0cOrgvlGbHYlbY3xp u1QP5GpD6sw+j5DXQkUIVExUEF6X9D69IhX60htB1YDBXd71G2ZBYWMqLa9Vf5YQmhFO md1Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kK54ulUU; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-7c041df2db8si359867285a.53.2025.02.07.07.40.16 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Feb 2025 07:40:16 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kK54ulUU; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tgQSb-0005NN-0i; Fri, 07 Feb 2025 10:40:07 -0500 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 1tgQSI-0004dG-Gh for qemu-devel@nongnu.org; Fri, 07 Feb 2025 10:39:47 -0500 Received: from mail-ej1-x636.google.com ([2a00:1450:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tgQSE-0005Qf-Pm for qemu-devel@nongnu.org; Fri, 07 Feb 2025 10:39:46 -0500 Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-ab794ae3cf2so41912366b.2 for ; Fri, 07 Feb 2025 07:39:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1738942781; x=1739547581; 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=gkJVfCavNsBQMZBi92Kjm0ej3U2Pdiir6so6tZSVLo8=; b=kK54ulUUTfU7vcmorGOTmA6Lj5XKpd809W86iO8J3WqBjScA6oX23y/GUU6+L5BQJv jjRN40Jzs23P7C61Cs+Zr35xsx/Y3J+8PTvboy1hJPGkfC5EOcRcT2Xzgnpe2pfFhtTp BAOgJ0bl/lLfSA9+OohuKUsLsZn24q8dyDk/prjEXcI6s9c5IQWVQsN0nCNne9nW8LQ9 a+F4zKAzvba6280Bbi0PeWOX6L8zLGmu2Juei+j3BdUwNb/sXkxqB/6Hr9/6LBtkM06B sNO8+/zj++W14LDAWQ6TLTyuX5Jyl3CtGZJkDkYpxQ/INwxQSTir9hlOwiFFpSU/6HMD q4Iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738942781; x=1739547581; 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=gkJVfCavNsBQMZBi92Kjm0ej3U2Pdiir6so6tZSVLo8=; b=YxM3/v0yefWRXYUtMocxDk8q/mtXO+O9+s2z9WKEVvO+9JZY/SBwS2/IMxbSYKBJx7 tEgw+m0arQ8Mi/tpnhZI70XsO60qlcCfcgaJopDcU/TB/mZh1q53dpm/6kYD//FHIQUG xWZQzEkK0iqUPby6nFtZMsKhPXPlbSivcoziqFLVZeQ0ZKJtI+Yl+zPm4AUtl+Q5TMni 5nxSs9fPTiIHIUMCkQAOTgur5ES/ZJNTXCQb6tkJPBSJpHKdJDWFA/zfyw5UQkX8KWA5 pkHM8brN6CFPgITzysLAS9KUD072I+pHMEdgO0ZDgfYhYwPY8ih9aplTlo1jW4DU0Z20 MweQ== X-Gm-Message-State: AOJu0YxfQV8jfQkXNo852FJNjwYa5bVBDxGsCsfA0Y5KfEP99NAbgfVV dYYeiL2XjxX95LcSfegLWkq9STKk92e8rWrvjpLe47wjYGAFIrW0/lnXGhmQu6Q= X-Gm-Gg: ASbGncuK03ynfRcZ/Po+Gjj2L4nbY9AH+O/ZbTHdQuhED6TpyaxbQAEJEYCk6BSxlaI J5LNvBKFcQ4PlU9rdPEn9YHUxpwzQhoiZ5939t1S+JUjz6vQIbfrfSOA7TQKy9Ppm6RBe73hXvb LXBcEvcGAHVw5RCZ8ebZr0qB3msU64/3IC/yOyVgxvLSIxFvQB134ZjfX+WvvOSidr29UlLYpLO I5+Il0iH5LUdIzTJGed2QvwEWSOVXfjBLoQbmDg7m4Q4ccNacAAOc1vUiU6plYoUNR+W9JxQ2qv g/1tyDFKBydZBxztvg== X-Received: by 2002:a17:907:7e89:b0:ab3:ed0:8d7 with SMTP id a640c23a62f3a-ab789ac0f4cmr330413066b.23.1738942780986; Fri, 07 Feb 2025 07:39:40 -0800 (PST) Received: from draig.lan ([185.126.160.109]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ab772f843f4sm290915266b.68.2025.02.07.07.39.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Feb 2025 07:39:40 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id EBB25619CE; Fri, 7 Feb 2025 15:31:13 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Peter Xu , =?utf-8?q?Alex_Benn=C3=A9e?= , Thomas Huth , Weiwei Li , qemu-arm@nongnu.org, Nicholas Piggin , Liu Zhiwei , Bin Meng , Tyrone Ting , Hao Wu , Kyle Evans , Alistair Francis , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Laurent Vivier , Riku Voipio , Harsh Prateek Bora , Fabiano Rosas , Alexandre Iooss , Laurent Vivier , Daniel Henrique Barboza , Warner Losh , Pierrick Bouvier , Palmer Dabbelt , Mahmoud Mandour , qemu-ppc@nongnu.org, Paolo Bonzini , qemu-rust@nongnu.org, qemu-riscv@nongnu.org, Ilya Leoshkevich Subject: [PATCH v2 17/17] tests/tcg: Add late gdbstub attach test Date: Fri, 7 Feb 2025 15:31:12 +0000 Message-Id: <20250207153112.3939799-18-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250207153112.3939799-1-alex.bennee@linaro.org> References: <20250207153112.3939799-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::636; envelope-from=alex.bennee@linaro.org; helo=mail-ej1-x636.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 autolearn=unavailable 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Ilya Leoshkevich Add a small test to prevent regressions. Make sure that host_interrupt_signal is not visible to the guest. Reviewed-by: Alex Bennée Signed-off-by: Ilya Leoshkevich Message-Id: <20250117001542.8290-9-iii@linux.ibm.com> Signed-off-by: Alex Bennée --- tests/tcg/multiarch/late-attach.c | 41 ++++++++++++++++++++++ tests/guest-debug/run-test.py | 15 ++++++-- tests/tcg/multiarch/Makefile.target | 9 ++++- tests/tcg/multiarch/gdbstub/late-attach.py | 28 +++++++++++++++ 4 files changed, 90 insertions(+), 3 deletions(-) create mode 100644 tests/tcg/multiarch/late-attach.c create mode 100644 tests/tcg/multiarch/gdbstub/late-attach.py diff --git a/tests/tcg/multiarch/late-attach.c b/tests/tcg/multiarch/late-attach.c new file mode 100644 index 0000000000..20a364034b --- /dev/null +++ b/tests/tcg/multiarch/late-attach.c @@ -0,0 +1,41 @@ +/* + * Test attaching GDB to a running process. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ +#include +#include +#include +#include + +static const char *phase = "start"; + +int main(void) +{ + sigset_t set; + int sig; + + assert(sigfillset(&set) == 0); + assert(sigprocmask(SIG_BLOCK, &set, NULL) == 0); + + /* Let GDB know it can send SIGUSR1. */ + phase = "sigwait"; + if (getenv("LATE_ATTACH_PY")) { + assert(sigwait(&set, &sig) == 0); + if (sig != SIGUSR1) { + fprintf(stderr, "Unexpected signal %d\n", sig); + return EXIT_FAILURE; + } + } + + /* Check that the guest does not see host_interrupt_signal. */ + assert(sigpending(&set) == 0); + for (sig = 1; sig < NSIG; sig++) { + if (sigismember(&set, sig)) { + fprintf(stderr, "Unexpected signal %d\n", sig); + return EXIT_FAILURE; + } + } + + return EXIT_SUCCESS; +} diff --git a/tests/guest-debug/run-test.py b/tests/guest-debug/run-test.py index 5a091db8be..75e9c92e03 100755 --- a/tests/guest-debug/run-test.py +++ b/tests/guest-debug/run-test.py @@ -36,6 +36,8 @@ def get_args(): parser.add_argument("--gdb-args", help="Additional gdb arguments") parser.add_argument("--output", help="A file to redirect output to") parser.add_argument("--stderr", help="A file to redirect stderr to") + parser.add_argument("--no-suspend", action="store_true", + help="Ask the binary to not wait for GDB connection") return parser.parse_args() @@ -73,10 +75,19 @@ def log(output, msg): # Launch QEMU with binary if "system" in args.qemu: + if args.no_suspend: + suspend = '' + else: + suspend = ' -S' cmd = f'{args.qemu} {args.qargs} {args.binary}' \ - f' -S -gdb unix:path={socket_name},server=on' + f'{suspend} -gdb unix:path={socket_name},server=on' else: - cmd = f'{args.qemu} {args.qargs} -g {socket_name} {args.binary}' + if args.no_suspend: + suspend = ',suspend=n' + else: + suspend = '' + cmd = f'{args.qemu} {args.qargs} -g {socket_name}{suspend}' \ + f' {args.binary}' log(output, "QEMU CMD: %s" % (cmd)) inferior = subprocess.Popen(shlex.split(cmd)) diff --git a/tests/tcg/multiarch/Makefile.target b/tests/tcg/multiarch/Makefile.target index 18d3cf4ae0..688a6be203 100644 --- a/tests/tcg/multiarch/Makefile.target +++ b/tests/tcg/multiarch/Makefile.target @@ -130,6 +130,13 @@ run-gdbstub-follow-fork-mode-parent: follow-fork-mode --bin $< --test $(MULTIARCH_SRC)/gdbstub/follow-fork-mode-parent.py, \ following parents on fork) +run-gdbstub-late-attach: late-attach + $(call run-test, $@, env LATE_ATTACH_PY=1 $(GDB_SCRIPT) \ + --gdb $(GDB) \ + --qemu $(QEMU) --qargs "$(QEMU_OPTS)" --no-suspend \ + --bin $< --test $(MULTIARCH_SRC)/gdbstub/late-attach.py, \ + attaching to a running process) + else run-gdbstub-%: $(call skip-test, "gdbstub test $*", "need working gdb with $(patsubst -%,,$(TARGET_NAME)) support") @@ -139,7 +146,7 @@ EXTRA_RUNS += run-gdbstub-sha1 run-gdbstub-qxfer-auxv-read \ run-gdbstub-registers run-gdbstub-prot-none \ run-gdbstub-catch-syscalls run-gdbstub-follow-fork-mode-child \ run-gdbstub-follow-fork-mode-parent \ - run-gdbstub-qxfer-siginfo-read + run-gdbstub-qxfer-siginfo-read run-gdbstub-late-attach # ARM Compatible Semi Hosting Tests # diff --git a/tests/tcg/multiarch/gdbstub/late-attach.py b/tests/tcg/multiarch/gdbstub/late-attach.py new file mode 100644 index 0000000000..1d40efb5ec --- /dev/null +++ b/tests/tcg/multiarch/gdbstub/late-attach.py @@ -0,0 +1,28 @@ +"""Test attaching GDB to a running process. + +SPDX-License-Identifier: GPL-2.0-or-later +""" +from test_gdbstub import main, report + + +def run_test(): + """Run through the tests one by one""" + try: + phase = gdb.parse_and_eval("phase").string() + except gdb.error: + # Assume the guest did not reach main(). + phase = "start" + + if phase == "start": + gdb.execute("break sigwait") + gdb.execute("continue") + phase = gdb.parse_and_eval("phase").string() + report(phase == "sigwait", "{} == \"sigwait\"".format(phase)) + + gdb.execute("signal SIGUSR1") + + exitcode = int(gdb.parse_and_eval("$_exitcode")) + report(exitcode == 0, "{} == 0".format(exitcode)) + + +main(run_test)