From patchwork Mon Feb 3 14:40:31 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: 861557 Delivered-To: patch@linaro.org Received: by 2002:adf:fb05:0:b0:385:e875:8a9e with SMTP id c5csp2056318wrr; Mon, 3 Feb 2025 06:43:54 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVaCgYhuQ7CFKIujKIrgwdC1KMjVjZ41ec3egi6c5Nmd4WN47qIR0JWJXG+UKuBYevLuHF6Sg==@linaro.org X-Google-Smtp-Source: AGHT+IFuqmMVXbL+fSIxji3bbzmubKA6i+WKMSUkhHjNGYox9BJaIJqeXRbIsPqhbo+ZSmGltY8v X-Received: by 2002:a05:622a:88:b0:46c:726a:2b39 with SMTP id d75a77b69052e-46fd0a81583mr267516231cf.3.1738593833873; Mon, 03 Feb 2025 06:43:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1738593833; cv=none; d=google.com; s=arc-20240605; b=L3QTHUKFP9+3E1hoYmiw1fUg1JHskyzJDCb4Yp4rHWLqZxBdcqnT+OYHPLPMYRbSG/ 35OsWhUYpRM3COt6Zog2Qt+wcI2CvStaa4ypTwKYEusi8jX9a9w/jL4mnqwQRGqNkIZQ Gqxd92/lGNjuZ86kRx/qeHj3J84i2uV69K9ehCTPrgJpdKJd+xhr81UC5KF0u0WEI7il 7/35ODzSYJ9+fkA7EI72e5mZdMKe1g1uOr6QgJE2UeLXaqDM7uUNP/BQg9wTJHUcBivF ujgiLmXyVsYjd1Y8pqDo0ZSbfMqtE055U14FAlOlZbepiVF7XZJeCeQNqWX+Wp3gzYrF YKew== 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=QTDOVYxM0E7wRyBsbgpa8GUo5K0fruAd8IIEzTdI9Ns=; fh=jyfZ4bE00qD+eKuDDH0TAcN7aiec48pwVXD5svQqzcE=; b=G4LguXhS5FkvsH4POpIs/Rznz/Fz10LTSJqlRSPR9Kpe1zs0nclIM/RQGDrXFf6oNR dwP7EULm/Wg/ItEM31ViewlyOv4TTaB3UHgbezzHwl26HFxFAmXtXbGXct0vEEVYptwU lxZEaTTYktyU//nZ/yASWsl/wR/e1EBWzKogAbAlzCQiXsjnvkHjFrCQTfnkSahCuJsW NfP3epDUK/oiZ8UTZU+/1ULsiYYx/tpUyiWhP8zf6gwzoDFIIixqz74N2vbUtuxM9Q57 GQ+GY0btjKheVZzTPfz1JT8vtkn199z1YrhbZDpSBVjfNkaitOGLoToZz+f94ByGUQuQ HO3w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="bfIx4/dd"; 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-47016bab244si2455621cf.438.2025.02.03.06.43.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 03 Feb 2025 06:43: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="bfIx4/dd"; 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 1texdH-0003am-M7; Mon, 03 Feb 2025 09:41:03 -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 1texdB-0003TH-OE for qemu-devel@nongnu.org; Mon, 03 Feb 2025 09:40:58 -0500 Received: from mail-ej1-x633.google.com ([2a00:1450:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1texd6-0002LR-Ri for qemu-devel@nongnu.org; Mon, 03 Feb 2025 09:40:57 -0500 Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-aaf57c2e0beso918674066b.3 for ; Mon, 03 Feb 2025 06:40:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1738593651; x=1739198451; 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=QTDOVYxM0E7wRyBsbgpa8GUo5K0fruAd8IIEzTdI9Ns=; b=bfIx4/ddsM9UzAGhPaKwjAeWyH7jl7felKe4s7x/7JvXmAIMVZJmbOPi1i2UWg5bPF 0PK1WBIjYq0OxgHNdHhzPXTfoVt0aRImjga26zJ6DN47jHq8VK6//GTWcISDzld6OwsP KI75O5Z6nz81HF+i+TVNBGOdIXcWgB3mf5nYTCSkVI+JmdLpRM8GmOUZtqW3ozAvq5BA MuvOEO8ZjQRMODGhuI1cgIDAdEJoqN+SDshyrisrVLno7YfZbMo+qsihmU/pIIaNXdJW QjFeXybFllhSJxNpKsjUl9qpxlzdl7yGHGSU8IbCrPxQ5V/gaNGcpixsDNimX2CxdxAX vhIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738593651; x=1739198451; 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=QTDOVYxM0E7wRyBsbgpa8GUo5K0fruAd8IIEzTdI9Ns=; b=GykgsdW0xDhke757xZWf4Jg2Uxg5Q1rEBjZflXgM4AxQS2cGuGyPP0uCs5HO07O13V pPgmcLp5PQ11dPOr+/YNvEHOk/ue3lcNcpbkESK+2Tqjdzou31nb2XMMZO+w9L5+xHnn iuwezV2RKw3LSbhqvxe2EV2aYhOcd/sIB41cqABw9VMUz1zQUsNht+jweUR1t+GBMoSs XAVhrYnleAaVeSBcnncL33XySm/Kmef9Oi1TT0eHxvSZY2zHLye34BG+VXcmB9VDgw8b QE8hF4tNRfDwgqbVP9VhwQ/RQnn+MdfDsfdT14NT8hrbKqnhtKVuFwew/qnNcJFl/Dyg se6w== X-Gm-Message-State: AOJu0YwJT0TD5MoVCM13udTvBEbLgmO48bgMUhMPjO5j0SuJaGxE71Yi CXSaNChDisiYg+KEFoPMtWZ7spRlY72t22kGz887j8ru+3ae6BqG4sB/75hfsow= X-Gm-Gg: ASbGncu6aSOjxsi+svcwELtA2rYlLFlcn0PWyGSBfmRhM40GlqHCaKEIE9OdcBlckwB 90xRIE5MMkVURbMEhaq4DdDgalzc2m6Ooz1EBNfz6L23C0u5KnLcIf571ga5+I5rNuEb1rNM9of t7dchLpWCzbl2j+TvK86wyCmIaMbZlXBmCKTNlDL+YBMKD/azl0edqmyXZdGqi0DooAuMX62yks xTaN0vcUEDceu5OV28WKKFkAIooBH1QYk0H9A7D7qNv/xPHcFssRFZPUiZnGRGjfsYH11bZB+f0 vGuqgvogG2AMiQwPfw== X-Received: by 2002:a17:906:6a24:b0:aa6:aa8e:c89c with SMTP id a640c23a62f3a-ab6cfda42fbmr2842139766b.39.1738593650836; Mon, 03 Feb 2025 06:40:50 -0800 (PST) Received: from draig.lan ([185.126.160.109]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ab6e47a827esm773718766b.15.2025.02.03.06.40.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Feb 2025 06:40:49 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id AAED45F906; Mon, 3 Feb 2025 14:40:48 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, Mahmoud Mandour , Thomas Huth , Daniel Henrique Barboza , Alistair Francis , =?utf-8?q?Alex_Benn=C3=A9e?= , Hao Wu , Peter Xu , Warner Losh , Pierrick Bouvier , qemu-arm@nongnu.org, Harsh Prateek Bora , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Palmer Dabbelt , Kyle Evans , Laurent Vivier , Riku Voipio , Bin Meng , qemu-rust@nongnu.org, Laurent Vivier , Liu Zhiwei , Weiwei Li , qemu-riscv@nongnu.org, Fabiano Rosas , Tyrone Ting , Paolo Bonzini , Nicholas Piggin , Alexandre Iooss Subject: [PATCH 01/18] tests/docker: replicate the check-rust-tools-nightly CI job Date: Mon, 3 Feb 2025 14:40:31 +0000 Message-Id: <20250203144048.2131117-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250203144048.2131117-1-alex.bennee@linaro.org> References: <20250203144048.2131117-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::633; envelope-from=alex.bennee@linaro.org; helo=mail-ej1-x633.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 --- 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 bf737eb6db..8008db18ab 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3384,6 +3384,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 Mon Feb 3 14:40:32 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: 861553 Delivered-To: patch@linaro.org Received: by 2002:adf:fb05:0:b0:385:e875:8a9e with SMTP id c5csp2055632wrr; Mon, 3 Feb 2025 06:42:20 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUBYl1zpvK3tHFg02cCyUsxbsp8MxxOiZNTaVjp1Dmlg402XpPcszGm/U7cotBHVtpik0xx2A==@linaro.org X-Google-Smtp-Source: AGHT+IE7+3Rw7OLXs+UOj+Y33aVVMYvCbDqv0l4+Zkj96R4lURxX8Nuav3p3CwnXkRr8LsLZ0g+w X-Received: by 2002:a05:620a:28c8:b0:7b6:dfcf:3352 with SMTP id af79cd13be357-7bffcd95672mr2976078885a.38.1738593740626; Mon, 03 Feb 2025 06:42:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1738593740; cv=none; d=google.com; s=arc-20240605; b=cL4Kz6m8WAO7Roq2O2gWdpIEGKEFUec+AQ+QW3lcamABmigDKbHcm401jmlfc1ghF2 TSk3Rh2LqjNWsZAEcNDo1uzslv1uAqHnu+5T8vqXAETXZAu4YHUBzv+yQRV2WrOm/TW3 OnuiM55V8FWcklxWtHxKFXy6v4uM2K5YjWd8TMHFQdVuo7MNMwR+OOhEKlaFkpSuduU/ 8ybhiFmBFY1TU7TOqBjpYpWmBV7Xw2T6ROAmTeGdazBzbD+PTIBPZ21uFtlhFjrbvt0j P1b3z0khL9wJUbzBEpiMEnsWM+zK7gedzLQMomQ2GnxXnbCcMmlDAckurl0TcJ7S2fp8 lBJg== 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=jyfZ4bE00qD+eKuDDH0TAcN7aiec48pwVXD5svQqzcE=; b=ATnrI+jTATHPw5RLaOkgQJttHgk5an7NHbYjhlv6hts/eMAarHOElzo3RQgfa/er8y S++9W2TZob/CmkJHcmc6czzSUCG9ZwJcBrZgYw8B/puwnKgvn13VAYnLRNualWjvhbnN HPmL8yssdFo1fj/cKdLfeoYth4M1HrLLU94LVRy0E0JDLYPuMc0Xr8lGV4pVT9cJW7zX y9lHPGInroVODXk5lLEgiCR9hhPIxf+qRLnnhrQQcLK4U8fAHn53LlQmUXULcbNwhS4+ PJEfROHfRnq1sYvNNXXr3kQwClzjpCrWWhc1LKQgBneatZ/GXeJWxIxL+dl4HtbQzdg9 p+Sw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OJkpiYtD; 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-7c02db62b5fsi26599285a.175.2025.02.03.06.42.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 03 Feb 2025 06:42:20 -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=OJkpiYtD; 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 1texdX-0003iv-2f; Mon, 03 Feb 2025 09:41: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 1texdC-0003Ts-Em for qemu-devel@nongnu.org; Mon, 03 Feb 2025 09:40:59 -0500 Received: from mail-ed1-x532.google.com ([2a00:1450:4864:20::532]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1texd7-0002Li-8S for qemu-devel@nongnu.org; Mon, 03 Feb 2025 09:40:57 -0500 Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-5d3cf094768so8280784a12.0 for ; Mon, 03 Feb 2025 06:40:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1738593651; x=1739198451; 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=OJkpiYtD6E6GEmmqrI9dSgSRSlzrb1j0auefJdyFSeiqYpuBDUasJJj3HwdPcvDSPE 6pEwYe0KAWpsYLshitEQX+N+4YiOn2rMOMB1NFtoCt+FZRvYElZpS2fNZS7ExCP7JY5c XZbP1GFNt8pHc9DPY436eyYtKtU6BxsrKU43mEAnLpf7C6AL2+l4oDEcJrn7nAOUpgdj /7yAZ8AP7qrmOkxjhWGoV3GmVJCrvr4977H1EpNR/kgvmXA+JHJ3VH/ArXjWccPr/nit YzFk4/EQGoQNURCHp0UKHH93ir/V9AsLjTNXh/JtL8g2DMgm4C/40GkxrpDxnfYU7BoW CmxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738593651; x=1739198451; 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=kYkD/i1RAZIo6CB/7mi2Y5N86eUGxDbjJzArNzwzw6QxqJzZGpo4EUWu7RT1Q+Z1rA vcK86Ma4cdYh+XvyvQ/7iIFiyZvGprNzBZn9DV1ZFDQKozwmKai12tp3ZdmMThGC5lTi LlZDa44sCUFoN2114w9XhaWrYRgrGlVwKfxptF7NG5AJadkaHyHQ7DEa4QNlZsoX5rhN UKOZRdrfhz4uxc9eZHwk0vR+KkKTVXdzND8/HsZrFe0KgdTkw7ysL4zJaisOlkcVGQh0 7GMMU8BVa8JLbBCfp1k/0doEOV56P6vt6jrKhnQhwKbwLdxcdwfsSupi3uLI46/8/Lhu ychA== X-Gm-Message-State: AOJu0Yx9zA+i+Obd3+JaGq6bog/PNPSPK/u8MFWQlJSQAiPLC+vbYDhz 4P/0dXFGKiKsw/Stc4rfxB9CZ8SLixbiwEBl9XDFY9kSDNLj/tdAMaScfYvhGxQ= X-Gm-Gg: ASbGnctH7FfEyOce+uuNuW5pN901jwmC8fV5VkpYDJ+jt0q03CH1dk++udsuaoJpoHr YvX/iL34Z2/gYOt7O8TGjd/Cc7kraPYh2vDDct4hOgcCi7vjlRxDzv0EpkGA8Ipg4UkFzCnvUya /63igAfHa7I6P3mTb8ZL9WrGMPJ6ohwFP4V/rLsy5Ge3jEqUGTIcfxm+zPaxgZJEGYwtwWBr0K3 Ilb30eQfIHsSyEbH127ZltC++I9mk+xyCdwXzmKziQ8d54xh9lNx3w6K+H2WrLKJzjBk5f1nzjP j2ty0RyCCFW295MjIg== X-Received: by 2002:a17:907:72c4:b0:aa6:5eae:7ed6 with SMTP id a640c23a62f3a-ab6cfce8dbbmr2236592666b.13.1738593651441; Mon, 03 Feb 2025 06:40:51 -0800 (PST) Received: from draig.lan ([185.126.160.109]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ab6e47d21aasm763112666b.74.2025.02.03.06.40.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Feb 2025 06:40:49 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id C3E6D5FA53; Mon, 3 Feb 2025 14:40:48 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, Mahmoud Mandour , Thomas Huth , Daniel Henrique Barboza , Alistair Francis , =?utf-8?q?Alex_Benn=C3=A9e?= , Hao Wu , Peter Xu , Warner Losh , Pierrick Bouvier , qemu-arm@nongnu.org, Harsh Prateek Bora , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Palmer Dabbelt , Kyle Evans , Laurent Vivier , Riku Voipio , Bin Meng , qemu-rust@nongnu.org, Laurent Vivier , Liu Zhiwei , Weiwei Li , qemu-riscv@nongnu.org, Fabiano Rosas , Tyrone Ting , Paolo Bonzini , Nicholas Piggin , Alexandre Iooss Subject: [PATCH 02/18] tests/qtest: don't attempt to clock_step while waiting for virtio ISR Date: Mon, 3 Feb 2025 14:40:32 +0000 Message-Id: <20250203144048.2131117-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250203144048.2131117-1-alex.bennee@linaro.org> References: <20250203144048.2131117-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::532; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-x532.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 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 --- 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 Mon Feb 3 14:40:33 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: 861565 Delivered-To: patch@linaro.org Received: by 2002:adf:fb05:0:b0:385:e875:8a9e with SMTP id c5csp2057459wrr; Mon, 3 Feb 2025 06:46:10 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXaZmaUZxk/BmQaQ3ur7d9CqnuiCThpGEWnQE855SUG+5DZ1Wc+v4ORtj2TpssoFEE9GKYphA==@linaro.org X-Google-Smtp-Source: AGHT+IGMZPTTi/oaKv/iUvTDKuaJqdcwjdh0RPeagI5Jddu+KKG1Lhcrh4/LsyjQFR0Kr/0XlQm2 X-Received: by 2002:a05:6102:2912:b0:4b6:20a5:776 with SMTP id ada2fe7eead31-4b9a5225574mr15090415137.17.1738593969893; Mon, 03 Feb 2025 06:46:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1738593969; cv=none; d=google.com; s=arc-20240605; b=CSPbPDmo+bDiyqCGw18I7WXXjhiPKU0aSwqpEhe8ophKmLRufhvTMhWfGLdbl3g1NJ negnNcXRo1obqpWQD0HoE+StZQpwE6otVigm5RZh3ttFxI2/ICjYnkDCaUssTBogLrst yfCc+IcYeA/cwrdxL9l2aJeqDcKkD4g58h3IUTxva7mVByJETlkd2bccZzlP80zBnF5s 3gW1OpSc9sIRYheyO7Zx5Bv1B0l4L3ooRy8Vquz9Px6oI7cLVKqiKrVEQ08gBy7cLAvQ Ce2RwCNvtJ46Kv64YxSMONcjgWsNX99nZx7dGXQFpGoubsPtDFaWBQw0qunsGTehvlz6 PKOQ== 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=jyfZ4bE00qD+eKuDDH0TAcN7aiec48pwVXD5svQqzcE=; b=KdM4n81y2XS4DPqc418ZaCH+SmMLEsB1sc3+KqOOn97wACI8/K/2QhWz8f7XHTiFpp heuCXbYCWUM+zZ/SJ94BMyAhYUJ8ClRPa80b37UZ4p94Er5LlnUE8N8BOadOysw3BSy+ uspsrvJl+Qd27zLu894GTxxRLldMpLwx/tFacpMBEgRylem3mqK6iXhQG6pDbHRuKKeV 4281kIRjjxsH4ZRKtH6k39PNSGWILFlW9LTnLnXYdfqseHV7KJFkmr5/9g9tVn/i8Jda N2dsXiezHxKZOoQYX7NqH5YIFvC/z1eQXUU5G305gcEEu+ifxdS1HiLSTvyGQWoWi9v5 WRsQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hKyUtqsA; 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-8669408a763si1744498241.65.2025.02.03.06.46.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 03 Feb 2025 06:46:09 -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=hKyUtqsA; 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 1texdA-0003Re-4s; Mon, 03 Feb 2025 09:40:56 -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 1texd7-0003Qb-GU for qemu-devel@nongnu.org; Mon, 03 Feb 2025 09:40:53 -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 1texd5-0002L6-SY for qemu-devel@nongnu.org; Mon, 03 Feb 2025 09:40:53 -0500 Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-ab39f84cbf1so839216366b.3 for ; Mon, 03 Feb 2025 06:40:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1738593650; x=1739198450; 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=hKyUtqsAaxZxylw6Tv9N84zqnI+wGv6KW8UTkmOrQLZPhczt4k1ItN2iuCMMZl8OMS 3e3ivfn8ap8zw0ivs9ckq9q5bWleSsfBoOjGhoh8qcrkoGQD4aJoFNous6igCWoHCPmt KgInbJG027NUlcs9xu4ULv6ugQV1lHsS8eJLlxTpaGSVIxj9hTV24ah3OMtCMVwn/cTK ljL6RjpRWiXKUys9q+RMQ5e0P2GA+6SDcYAYXJzt7O3Mtjobf3XWifNCRxg6LK6cdbXw nuYLyrbNLKTwl6Hcgl9lFI+3LX3K7QsESWWsXDOUg5hl62/rjWsNb3DvdSEnZhbtkbfT r4sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738593650; x=1739198450; 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=qgbmDmzPFFDq3PKHORqIe12Q28Xe3eWCZ0PNxzVHPSv9c0RX8R8zcvBGycsTq8GxXu TdpqDEUho2WXW7b2GO623erU8RSMPWQS6hXwQAsvx1Yc1wFjlZGqkgfnxMOoI+xSIwJB o9D30PztMhf5DodwdQE4e251UYWfPeUQXPI71l3GpcoMLDsji1wyr5tkzk/k/86w9asf hm3FwzOGj4BnPsw0FkK+I8XjM9rCAKVlpD6ymkalh+2yI3WnwmcVGBY9lKbA2Gle59qs KbHWUHmTkqFn80tYzoGTfdJzkoHqE3/rPftiUwI8MvX5UYV7azvX9+ROxPk/qWEwusN8 8elw== X-Gm-Message-State: AOJu0YxBfy7BfRLZg4KL23KgDU5FjzMB1Obr5StkqmNnXqQv6dt4aO5s 17YBUAazfyaybrzAcDJSbARa2kbxKXojVgUhq9VHllLuQiHM5ph5l0d4DoYuCZY= X-Gm-Gg: ASbGncv4yd+Rd51QDK3M0B2Hhs9ML/QX17zlckcrlZW2CmOwpyomSkvb3sS0iblnFtb rylg+g/WF4KYX0qIuNWAjqRZv+jJJWaaoHOVV3mHHQIlPiRUbuO5pJliOf/7ikFyO6v6gR1dy8d 526VSH7JzhDAiCbEJ+K1b2ARfybAB0mrYBD9u1w8yDUItlQm4xP++e1E8K7+cbx1YQAM8X26C8X sWtwRQf4PxkpVx/gdZIOnwp+RvCPv82FfD7VxHrjKy0WpGalrP0bQdPLu+pNLQ9nq5eE8bsPUPH hYk9pNjwGwURCSlg1Q== X-Received: by 2002:a17:907:9452:b0:ab6:f99f:45e0 with SMTP id a640c23a62f3a-ab6f99f5410mr1861892366b.37.1738593650045; Mon, 03 Feb 2025 06:40:50 -0800 (PST) Received: from draig.lan ([185.126.160.109]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ab6e4a56fbdsm775529966b.179.2025.02.03.06.40.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Feb 2025 06:40:49 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id DA0415FA5E; Mon, 3 Feb 2025 14:40:48 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, Mahmoud Mandour , Thomas Huth , Daniel Henrique Barboza , Alistair Francis , =?utf-8?q?Alex_Benn=C3=A9e?= , Hao Wu , Peter Xu , Warner Losh , Pierrick Bouvier , qemu-arm@nongnu.org, Harsh Prateek Bora , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Palmer Dabbelt , Kyle Evans , Laurent Vivier , Riku Voipio , Bin Meng , qemu-rust@nongnu.org, Laurent Vivier , Liu Zhiwei , Weiwei Li , qemu-riscv@nongnu.org, Fabiano Rosas , Tyrone Ting , Paolo Bonzini , Nicholas Piggin , Alexandre Iooss Subject: [PATCH 03/18] tests/qtest: don't step clock at start of npcm7xx periodic IRQ test Date: Mon, 3 Feb 2025 14:40:33 +0000 Message-Id: <20250203144048.2131117-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250203144048.2131117-1-alex.bennee@linaro.org> References: <20250203144048.2131117-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 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 Mon Feb 3 14:40:34 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: 861556 Delivered-To: patch@linaro.org Received: by 2002:adf:fb05:0:b0:385:e875:8a9e with SMTP id c5csp2055891wrr; Mon, 3 Feb 2025 06:42:57 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWTM3GpzF41dgYUK345WmHYNcHwrPLjwkwxobcBEGl2s9qr0V+yeeP1pWnEqj8SLbo42OAGRA==@linaro.org X-Google-Smtp-Source: AGHT+IEpyFQziyeJ5dX8+eRX2qlPUo6GuD4DLDeTSiJF0QKQq6CVObyWm4Ay7VInlKPw8POCXBBt X-Received: by 2002:a05:622a:210:b0:460:a82a:39a8 with SMTP id d75a77b69052e-46fd0a97307mr348883271cf.13.1738593777731; Mon, 03 Feb 2025 06:42:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1738593777; cv=none; d=google.com; s=arc-20240605; b=SHb/Xl/co0CVfO/Z4c/NLmrZcsEt03HJyPANtysk3V1nvoOt0E8JrCLln7Iq7xky1R yBdIS2oCN8EbmDARyp+2LCdB7U3ioGE0V9uiqhND9TdwLESgNv2RWNFJ1EP8zPXYipmA 1qPdj6fG/tiEAsjx6aCnNQTq+WOsTx6LNv7NHYnlsxN6G/z7h95uC2Aqfk1NXsV+nMNF d+cAabopeHXGh9RfEmq/PiPxZVVWEmWb7yrrIqfUNKzRX9NDyzWFW2RA8+aKYbGd3qDq HoYi54eX2Jo2BmLFbBNeM+BBLs+p1tnKfAqdQhX9Kiehqofx7E9snq3Z5E30WPTM1gZD lw7A== 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=ptvjzIuVDQT2UCn5M7MTp4nlZSIRLqW4pGkuqXQqZnQ=; fh=jyfZ4bE00qD+eKuDDH0TAcN7aiec48pwVXD5svQqzcE=; b=gXrTw8lsfAMTM67KX62n15cSTwg6AGDloGvjtb3wuYfwWUrYqV3Bm/ulYgK2ZLNduX p3wjHY/+U8RcbQ6xnI6CdFQFUhGGN6/UZwmtsgUxBHam9jKMTOSOXyNqg/qXQilAi0JO I8SV3WmeOFzkhLJJSmoQrKLvgEG9UDcx3rwqhefNYNYwwt7c+sXtYdDhTG/deYeuOGev ALycf58L52VXZbZazDin9TwfpsBaGUWIYkR/TBMZzjeoyMa7gRxH/1WagRAbZZkoV130 Kwfc7d1uvW8qSd2j6cgg2UqEf63x8qbNKViHelUm4n/9JLGbQyrD9vFrpHiaNupd3EWb PBEA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PCG01pZj; 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-47016bf5fc2si2758581cf.637.2025.02.03.06.42.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 03 Feb 2025 06:42:57 -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=PCG01pZj; 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 1texdK-0003eY-R1; Mon, 03 Feb 2025 09:41:06 -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 1texdF-0003XX-1M for qemu-devel@nongnu.org; Mon, 03 Feb 2025 09:41:01 -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 1texd8-0002Md-VQ for qemu-devel@nongnu.org; Mon, 03 Feb 2025 09:41:00 -0500 Received: by mail-ej1-x62d.google.com with SMTP id a640c23a62f3a-ab6ed8a3f6aso669928566b.2 for ; Mon, 03 Feb 2025 06:40:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1738593653; x=1739198453; 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=ptvjzIuVDQT2UCn5M7MTp4nlZSIRLqW4pGkuqXQqZnQ=; b=PCG01pZjH+glbXe7AkXY6IMASqZiVhqNzQoVuD5Vc5KJpivgFEH2Q5XOHWEpgBMqoc iP4emz5Uh2xtCTQGphhNgvaZp2J4VUwZCyulN3gLo/BNqrOzZtCQeHsV5FPSUZNOs2R3 85NNEIq6Khi6iLfPZjbQo27u9s4wDLrk0LQ6B99ceCVe2y00zVDvR29+tdRCpNzfwNWy JiCbyMnSvBebOHSvmXWPzsZ7LFuWuxjj4jCwCxB6mEROYA3xKnA8FAsxsRGEbvO9Cg80 E4cN0Td9U705qU5iPez+rLZyqhC6z/X1AYVuhYylnKGnBuOKC3Q5FgPTn32GiV1WxGIH /+Vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738593653; x=1739198453; 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=ptvjzIuVDQT2UCn5M7MTp4nlZSIRLqW4pGkuqXQqZnQ=; b=j2iVQQKqoxL9KCjtWlIY7byRSgi5f1QYJRdrpMbXs4GZfIXKUiiNkxXTzs5VufNC0Z O6mtTngnIfBebRg6voS3u1+BoaZmmq8PsSEhBNMJgFHAdqLA8vMdhB9gx6jyADsW8WOT OQ57lZaF9yC/a/83PtU68NSJK5ua9kCZBw6AOC9wYGXqLh7PX8Xyd5E8Ci/4PqGp+lCg 3oQZ7vhyJr1nyY0XlV/tsFcNX3cfjVF5K0ilXJdYMzS9HJw1jjMTVh+509OS3G5xvrsc PYX8TB60+ziLGAYYJTywDfR8NGBVMGaQ2hJLR6X1eJg0sFf+LVmhrLTBHvvVIQz7b+Y3 WYaw== X-Gm-Message-State: AOJu0Yx9sF+44xaqm/B0Ipf/x6Oft5UOxkHBehbOhtOs+8h00FNCoaoz /IdkhTfD/ZmXwfdiGLvuIKjkeCEvFQWptX/2i8QBf2xZ1li/nBTV21PohThQ/nM= X-Gm-Gg: ASbGnctqlIoIKXheEqQzOz4Euaq2QQWByKM7U13tm0C9eXVmxeeYiazBy4tFISaiKFS yL78Adlf1rVYNU0RI77hxnmsDrAH3pU3Vc6W3xzxLpyQtEAXjkbbLSX6ZWg4jrWzG2vpmYuUoKS F7rC+IdX+wKWTN/h8fCDskes9+Pp1x/wKJYhD7Se+zA1/IIzK9LzN/IahupUNhCsIDYjps585/P ry47FtojOuCwqemqOl8glbM9urUBILOiJAw28TGpnjtpUme7OTi04qmvXZRX1tlPdMx9zGAgfAz n8BlMN+ki4SRgiI3CA== X-Received: by 2002:a17:907:8b94:b0:aa6:8a1b:8b84 with SMTP id a640c23a62f3a-ab6cfe17745mr2460856666b.57.1738593653070; Mon, 03 Feb 2025 06:40:53 -0800 (PST) Received: from draig.lan ([185.126.160.109]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ab6e49ff968sm767111566b.111.2025.02.03.06.40.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Feb 2025 06:40:49 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id F2AE95FA60; Mon, 3 Feb 2025 14:40:48 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, Mahmoud Mandour , Thomas Huth , Daniel Henrique Barboza , Alistair Francis , =?utf-8?q?Alex_Benn=C3=A9e?= , Hao Wu , Peter Xu , Warner Losh , Pierrick Bouvier , qemu-arm@nongnu.org, Harsh Prateek Bora , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Palmer Dabbelt , Kyle Evans , Laurent Vivier , Riku Voipio , Bin Meng , qemu-rust@nongnu.org, Laurent Vivier , Liu Zhiwei , Weiwei Li , qemu-riscv@nongnu.org, Fabiano Rosas , Tyrone Ting , Paolo Bonzini , Nicholas Piggin , Alexandre Iooss Subject: [PATCH 04/18] tests/qtest: simplify qtest_process_inbuf Date: Mon, 3 Feb 2025 14:40:34 +0000 Message-Id: <20250203144048.2131117-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250203144048.2131117-1-alex.bennee@linaro.org> References: <20250203144048.2131117-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 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 --- 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 Mon Feb 3 14:40:35 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: 861558 Delivered-To: patch@linaro.org Received: by 2002:adf:fb05:0:b0:385:e875:8a9e with SMTP id c5csp2056322wrr; Mon, 3 Feb 2025 06:43:54 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCV937xHhjjOoVPddKWxf88cNvJbSnTyXmVWEfleb70R21KlnoQrZWIzGRancFISexzVaUTraQ==@linaro.org X-Google-Smtp-Source: AGHT+IFZ1b5iJMIE8Zaj+9z71Ho7vxT2WmKV386cUjR5pQLP+3CJMAQh7+4MqCEIrsSS+vZztPwW X-Received: by 2002:a05:6214:5d87:b0:6d4:142d:8119 with SMTP id 6a1803df08f44-6e243c7859dmr334779836d6.42.1738593834445; Mon, 03 Feb 2025 06:43:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1738593834; cv=none; d=google.com; s=arc-20240605; b=XTIWII8H3VUA3t3/8HbcUuGdIGYmR3PD32ua588M611Rn7pw5bEfw3xq6+vjuLcZW5 7X0Tzn22llT1yR48ZAI+bh82OpQ95DgEdqQnHa7etHsI7o4dqX0e1DLLqNvNyCxfpJTZ +3yq1Uk3Wfv22PxnOnyUQnnVCJ1TP/b1GxRM07G3i7L/faQu65iB7wPGJzczgYBRc4x5 UAAI5Ij8oNAXVu3TcxBzwTTWTgfj00xrUxbU7Gv57t0RTl9soN6pMr1KGfDJop0zaitY thrWolE1IxJk0qQI9P+PEf8Mf0Mi1HNAVz+ZTiPYWhPTjLXP4qay/jntPqa3cskFVcki Nqqw== 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=jyfZ4bE00qD+eKuDDH0TAcN7aiec48pwVXD5svQqzcE=; b=ibebauSasnsCTitrmnIG/U7n/HXWCF7lH6atEnCElT64vzykVsZUOsnnwxjPY4FNBk qjHH4E8gXQNlPOM2f0cEtw6OoAUk5fMBx5CRZuGRul1BB7UVZ0O0/IxOg+tn9Q2hWk8o X4HKBeRQQx/RD7JU3tpRIvj/bcUkm+T/MNGXYIzP+0VSIzOU/vhXDtK9x501fJj4BCcd HqQjCBpn1TaFkWp+tAX/GeyI8RjuNdT4s0ZqFFBlfygP4cgRmtgc58dQWJQPlpnoTDR/ dT05JB108D/VlO0btBdP1/HB1AUWrXU7Y1TrFQ8z8SVwgD59IOtjSSkeB91UQy+yQSfU HqJQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="z5zE/bxS"; 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 6a1803df08f44-6e41feebb70si2504016d6.494.2025.02.03.06.43.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 03 Feb 2025 06:43:54 -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="z5zE/bxS"; 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 1texdb-0003pp-DL; Mon, 03 Feb 2025 09:41:23 -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 1texdI-0003cI-6I for qemu-devel@nongnu.org; Mon, 03 Feb 2025 09:41:04 -0500 Received: from mail-ed1-x532.google.com ([2a00:1450:4864:20::532]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1texd9-0002Mv-DY for qemu-devel@nongnu.org; Mon, 03 Feb 2025 09:41:02 -0500 Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-5db6890b64eso8595123a12.3 for ; Mon, 03 Feb 2025 06:40:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1738593654; x=1739198454; 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=z5zE/bxStLJTPZSqkNaqbWaiwfln4Qq0K+qfTvclO8W5/2lHtOyeEZM8dH3JOQozjV pFTcpkYuQ0aaYFNpxQul2ybiOaHxZ2Mr43bwGTMkFbR9QTl4+IkO8pvpg5V5H3Gk7Il2 PX6HcIFVAM4bvEtjr6D1gwO9LgXbF9IJPgdPmCN500F3SE2ywgvSrfXVC+uwgWTGBmEr h81EFJL0NcXmN6RU8+9MQvYAzav57j75L8u/W52xBwBKsCVN8Al94VbDNJI+/V0x+4Ph Uo4EG9tNVo3hl1Wuece3jDNTXwQeruZBGBtyEZLpNlwmZt5KibRA4Ze3OthhcStGhWOw Arxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738593654; x=1739198454; 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=IGwCb3nSaUCiFONyP/m+CBnXcCWc81sqSrB+vobBw67piOtBGRCsOVH+gT5bci2Vao Rcm+OW3D29n2VIg7posp4nTUX856tnQifDvIVcwnaFPoDsZe5f6bxw6PvleTEAqWzms7 kNl6OiLPIejapLcuyoDXQoK2dOhqFkmHQWOq4t+zRns5733OzXO2bSgoLD3dVxAvxHSj T8uWDOE17SOJU0Pqwx6AP1csRJr70HG4R3Ex8PUGNLIVkCXf4R5SRife7zY/oTNzsmCT p+d6CL5W0b6r9UQIOUVx4urs70Yfb8zkcmU8Yupo6LGGXwo45gvYX5LxmZYosEEzJ3/e DzjA== X-Gm-Message-State: AOJu0Yw+Yd6dIl58TRyJStEPfR/gc1+xdt1Vu7yy+hadXyxTVrXxHCSb Sfg3nz2X6i7y04Q78VVz+QWVKLd5nvMGLB9pOqykfA3Bf3U/JAAbv8BHTHATgp4= X-Gm-Gg: ASbGncvLgmcF61MQ+cLc/uyGPvbbUF1ReI9W6gBVlQ3caxs8wOJtaVC4afaoIBDgT9e OWDWNIWr4osbvHq5te2yVoXF84b5zYEtcFvMKx3qEbDftDohCstu5v3Ddp8KyahIpiLntH8yjRw gkYnFPfiEP2QOyP3HL2tLPshOa/e//ddDO7Tt5+z+YJ/MdPNhUtQS8jlE5FUOgGZW/jGOJqr6Yl 4L8GKrqo5Mbja7cqZ6yXoJ8LlbdwvH7Ca/sUAqx5rnGOmAe7i+Q/wQpsLbzLM/+qOVIyllIUk1l j1llm1yZGOE0VvrpXQ== X-Received: by 2002:a05:6402:400c:b0:5dc:7fbe:72f2 with SMTP id 4fb4d7f45d1cf-5dc7fcdb647mr17727126a12.3.1738593653579; Mon, 03 Feb 2025 06:40:53 -0800 (PST) Received: from draig.lan ([185.126.160.109]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5dc724a9f90sm7629324a12.62.2025.02.03.06.40.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Feb 2025 06:40:53 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 184BD5FA80; Mon, 3 Feb 2025 14:40:49 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, Mahmoud Mandour , Thomas Huth , Daniel Henrique Barboza , Alistair Francis , =?utf-8?q?Alex_Benn=C3=A9e?= , Hao Wu , Peter Xu , Warner Losh , Pierrick Bouvier , qemu-arm@nongnu.org, Harsh Prateek Bora , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Palmer Dabbelt , Kyle Evans , Laurent Vivier , Riku Voipio , Bin Meng , qemu-rust@nongnu.org, Laurent Vivier , Liu Zhiwei , Weiwei Li , qemu-riscv@nongnu.org, Fabiano Rosas , Tyrone Ting , Paolo Bonzini , Nicholas Piggin , Alexandre Iooss Subject: [PATCH 05/18] tests/qtest: rename qtest_send_prefix and roll-up into qtest_send Date: Mon, 3 Feb 2025 14:40:35 +0000 Message-Id: <20250203144048.2131117-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250203144048.2131117-1-alex.bennee@linaro.org> References: <20250203144048.2131117-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::532; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-x532.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 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 --- 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 Mon Feb 3 14:40:36 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: 861554 Delivered-To: patch@linaro.org Received: by 2002:adf:fb05:0:b0:385:e875:8a9e with SMTP id c5csp2055736wrr; Mon, 3 Feb 2025 06:42:36 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUsPD0vC+XeMFJRDMV56b5zHJ4pIJPqNaggcjRWxEMnCpIkH92FRnek3mEi4X1GqncN+63hFw==@linaro.org X-Google-Smtp-Source: AGHT+IGr80W/6xl4nqy27TOdaipERFuyPCkOfjiJigX1TN/P9zehA4iM0mB5GV98P4AGiqjaTWfi X-Received: by 2002:a05:622a:1104:b0:46c:86d8:fc5 with SMTP id d75a77b69052e-46fd0a12f8bmr314551061cf.5.1738593756495; Mon, 03 Feb 2025 06:42:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1738593756; cv=none; d=google.com; s=arc-20240605; b=kKb9EcpuZWWswjS3ZB+s1ydP3FJVvkD0UhfGDaMeTdzoXvdulYfqO6ueiuT02U6B4A Gm/nDSzAOjrk+PUIlra2bG1SXQ3oPZrP6Lwdb4p77bLKjZzqtO96WkdTgNAMr/F/aqF3 6V45FadtmiOt6027tPOz/rvdBEbRrhMNZvhvQhuT2ZH+6sDtrXbZqG4WfoEmGaiD+CfY AZMuJPAIMUmVoByi4cBuD0vlCefF48I/qPE7C4S87dBz+vYq7lO8pphw+wVA0a0yPccV Z1raNIL/Vq2okVVnjpJbgG96+VAlc01Z/yleLa5Gql+GH7a5kx9/BQpUGc4Oav7ZWDQo 2NiQ== 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=rhXT1GZ1FosRrGUDia524QgRgPZ6Dnd20b35E6F9zyk=; fh=jyfZ4bE00qD+eKuDDH0TAcN7aiec48pwVXD5svQqzcE=; b=AiQtMAGQtwwbt3XzkfuHrv+MoCZeAOqmebWMfWFgOKAhqP0UcEVyoky0akLwxPZ1oR WaHxMdLF6tYdIp+BhaEsS1hLUzc6bSk1VeCRCeAC5pknON7g8SQz5ncuytV+GXGFGqBB iothFmxJx1VV1nw+w5kBqIq+QeSSU1+ig1LS+axRYSVqeDTvijtGtwx9806U+5cMGXsG O6oh4n51Hyz7+qXaj3yUEd+AL+YIy/D7AbLsbiegO7r3Jg8rXmboIrDQY3Q0oSw/ptZI uNjVK9VbSqNccXs7htizvAR+axWxvYnM7A9RABx403uPLc8jym+zmz1It1Vhj+39SVja GdZQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fAM5l5sF; 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-47016bc2caesi2741241cf.475.2025.02.03.06.42.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 03 Feb 2025 06:42: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=fAM5l5sF; 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 1texdc-0003rI-IA; Mon, 03 Feb 2025 09:41:24 -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 1texdI-0003cs-Mg for qemu-devel@nongnu.org; Mon, 03 Feb 2025 09:41:05 -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 1texdA-0002No-Qc for qemu-devel@nongnu.org; Mon, 03 Feb 2025 09:41:04 -0500 Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-5dcb060ca2dso1609216a12.2 for ; Mon, 03 Feb 2025 06:40:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1738593655; x=1739198455; 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=rhXT1GZ1FosRrGUDia524QgRgPZ6Dnd20b35E6F9zyk=; b=fAM5l5sFMo+ZDLJDneB2DtWyteAByCRX0zM+gtzG3XCFZdVqjiGwICAMoOFJqTpZiV CGTNZ+d2Y1jh6J8i6cFK10MeMIfM5IJV8H+3eO/8+6Ll+8H6WO9hsCRDErXGDfB4xyN8 Ees/KWd9JQPZfTtwxk//YcEMbZ4WSc9W8I5nuiwAc8m/p1cfvLFSF5SANxzHXzet/ZvP QJmYqAm/IlJRg9ciUzQSTcsPijKw8KFWZmgNPjVri40GA10/a08PIoQvbLGeVrpFDlJJ DX0+KcgJ/ygqqrcV4NmaglLutgPm7hzUjrPgL7zP1T9g08w2LCUKWrRMOHSSjWdmPo8P mhNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738593655; x=1739198455; 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=rhXT1GZ1FosRrGUDia524QgRgPZ6Dnd20b35E6F9zyk=; b=sFhT0rKFkFPOmzkvDNX7HDxtNPD+SKU8bOxRSar1hiQ9ErxIq+72a3v+VcaJcR7nl4 oYVp0RqH+pBqiVy1nSFFxk7PGOqAYplSGLH6+1bvW6JY0+jOR1bgswLHfPZypIvRb2Da H0X7/NSYT/r4XloJpCNwUM2X23EEyS5oAFchJcnP51ulgqt/a4z+ZU98VBjVIxndnKCt GljUI9Q5M0AxQMoSyoQamcIKASl7Tz4a8Yh6yRaCNNa2P2UwUzyyk27K52hcWUByO53D G5yy8sMQ6lQLLN8PCct5kzgGmYw/+oOOZrgj/ysJMsFj0GF59o453/NI9wdBv7DCDoJM ryYg== X-Gm-Message-State: AOJu0Yz3E4J9U71YkEaQt6f+LQ2ZMDelN4bqXMCmsXutbYgvxhVGlzjQ QfJ/g8+i9ysn9ZrnfXTxBZS/L0U1IDvk+VqmCLR9szd1TDmgTnAloKgRi7qLO5U= X-Gm-Gg: ASbGncsZqOkA7Z+kyZES7tLmr+ycLQJIwVsp2eaZHkccUOuQU2cbMux79SKD/eXI6g7 7ePqXT9szpFmhoZfAVjf7YKLRUH70T4aI7nqWy5p8atFoedqRvkwdqajV88DpwGnM16nbyisK9E v3n5WlmgIaddn+5tkQeI07iZGYKsp1d8OggDB6LkKo3JBzKQgQGRsoGO7491rp6819hvpxjdZXL lsCDVckifTKHOvExfnfGj/ZAbJiWt5MedgxddE6Pzks5nIjO2qgpjdfpM+/xgDd3Y8WRjl1eu94 UD4GXGO7Vncu/uLRpA== X-Received: by 2002:a05:6402:4406:b0:5d0:81f3:18bc with SMTP id 4fb4d7f45d1cf-5dc5efa2fb7mr22965907a12.1.1738593654930; Mon, 03 Feb 2025 06:40:54 -0800 (PST) Received: from draig.lan ([185.126.160.109]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5dc723e9fa7sm7741236a12.20.2025.02.03.06.40.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Feb 2025 06:40:53 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 2EBA05FAD2; Mon, 3 Feb 2025 14:40:49 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, Mahmoud Mandour , Thomas Huth , Daniel Henrique Barboza , Alistair Francis , =?utf-8?q?Alex_Benn=C3=A9e?= , Hao Wu , Peter Xu , Warner Losh , Pierrick Bouvier , qemu-arm@nongnu.org, Harsh Prateek Bora , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Palmer Dabbelt , Kyle Evans , Laurent Vivier , Riku Voipio , Bin Meng , qemu-rust@nongnu.org, Laurent Vivier , Liu Zhiwei , Weiwei Li , qemu-riscv@nongnu.org, Fabiano Rosas , Tyrone Ting , Paolo Bonzini , Nicholas Piggin , Alexandre Iooss Subject: [PATCH 06/18] tests/qtest: tighten up the checks on clock_step Date: Mon, 3 Feb 2025 14:40:36 +0000 Message-Id: <20250203144048.2131117-7-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250203144048.2131117-1-alex.bennee@linaro.org> References: <20250203144048.2131117-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 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 --- 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 Mon Feb 3 14:40:37 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: 861560 Delivered-To: patch@linaro.org Received: by 2002:adf:fb05:0:b0:385:e875:8a9e with SMTP id c5csp2056431wrr; Mon, 3 Feb 2025 06:44:09 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCW/5ipt33157WrWILnkVtW2Sj/jagK4SDSauNnIJjLTQpCwPGX93mSlFr14MLbNCTrnbO1VDA==@linaro.org X-Google-Smtp-Source: AGHT+IE8EfdQS6LUioLFxpRWmfrGgk2IfGXwjvKlqd5ZujoOHQGwEKlO6l6pzAIrlmN52gLSd1Ax X-Received: by 2002:a05:622a:4815:b0:46c:7151:25c0 with SMTP id d75a77b69052e-46fd0a10e83mr329476971cf.8.1738593849434; Mon, 03 Feb 2025 06:44:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1738593849; cv=none; d=google.com; s=arc-20240605; b=TZhiqm6Mtgi3UBZAuPegT0sJ5iRrR3xszW4pLC+fhNdyxeBVn2an5zVVkZdImMBfTw SpCxnK4Xhe2E7aj3NKHGrM400Ygq4bFa1TghLfXdaPWSGb2Ht3TkzgdB6Nq3tVSSsfYQ qCP10YDYihxp27R0bCMPhydFh7YSfF3BE3udSXVqF9lB2zXR/+MEDlTjbv90aKwMZcZE kd+Xvqpe2rdujYXbd6mCBIHmfXuvifIle1o1zur/W6VOtw7udNABXS+Tq4APCLb6zoqB Cw/gkJMUxzzzBGW1WfS6/zIGXrZfSCJgvk0hSpekACkl7h5v+g8JpSNzlAcrj1q4DynN bHEw== 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=OdEyfb2ARjEb4j0/bYd/22LdLj+HvII9zUuxIjGCbvU=; fh=CLE+JtTt9bKMR47hVLNe9nR5hhav8mC7OxafJwUD3tI=; b=LN4GdkvBobTY/AagrfbpxbUR6gV0k1/SsPKuT5rlMVCJ/NZytw9OWvneuEVVN4XBR+ 8rdm2/bhPSGz5uhSfQcXRjwJ0PqE+gHgmjTyqF/ld3A3dbud0JiqqxFh9VMr9PLrhyca c5ukERiBj8V6tLsTfagyQWJri/tc7qmZMXm7H5Q/k69KO+SJg7KmglC+B+j2LHIARiwM 14Da5e8MUZ91Ga22dzKIU7hl9nLpEe8Qf/YvWA1po1uEofmP3RaGu4VQC9UWQNTR985o iG+XxHYvmHMaPILXyLyDNt573sLueHpmghKpoE8u4vvS9C/xHIgKiQABMDzBXWvr6Kz9 Uklw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="SRBmj/Rx"; 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-47016bc3a52si2332151cf.487.2025.02.03.06.44.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 03 Feb 2025 06:44:09 -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="SRBmj/Rx"; 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 1texdg-0003wr-9Z; Mon, 03 Feb 2025 09:41:28 -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 1texdP-0003ge-FL for qemu-devel@nongnu.org; Mon, 03 Feb 2025 09:41:12 -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 1texdD-0002Pk-0O for qemu-devel@nongnu.org; Mon, 03 Feb 2025 09:41:10 -0500 Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-5d3cf094768so8281007a12.0 for ; Mon, 03 Feb 2025 06:40:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1738593657; x=1739198457; 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=OdEyfb2ARjEb4j0/bYd/22LdLj+HvII9zUuxIjGCbvU=; b=SRBmj/RxOfqz8oPg8EUiw1ZAgFWS4JNfdbkZGAUoYF6lqxH6Rwn7aAUFiVjspVd4fN CDcsF8KgBHnPbLxe3CIDhHmn+tNOO7BtwEQ1Vf8D4gVzeE3y8fDCHbVLjMNjaVz0udbI rh3p5gUcUCBRwrlCB+v9RmI0jiwnfJRRlpiCEOsniIwqIJfe0rerD4G24TOgbWh/s7Ec EEbKcMLufKX4AHBOy1j/t3eKD4u/MKREHqInqF5MrHQDjV6xQuyND5LfWOXo+TLR2rNt vmnH5edcg+1bFzheT1zri/omD6fhTv8mgvp+3lxOx7SaNz1ycFSAbw8+f/lUGFPdyQbo upUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738593657; x=1739198457; 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=OdEyfb2ARjEb4j0/bYd/22LdLj+HvII9zUuxIjGCbvU=; b=Kz9xImlIMJE5Vmx0NK8QebKTAcZbJiK+bRF40AFzXBm4s/pWAPMV5sRaZ5Bkht+20Q GqzQO0dwrLv+PP1d00cqSs1p2xOvnn1w+XkkC/asqYpEjNq9re72YXyMEy6KZgT3qFuF CJv7sPTF7Cu3v7iXE5fizQbIsi7AtrMAxZOOBKm5vGbkZOwKyImZMm7Y45joI72yan9p gWZq2ap1CmYfYRiFkD3EdIGPJccELK2mZjxruienY7jzwdwFvVnsWfLhwzJg6d1D8/zd MPnQao7k4qlwL6AGCNF+D24NWywQT/p+5msw4SHt0QkurRFv+IZbOMBuYpBiJaCa3Ahq tCYg== X-Gm-Message-State: AOJu0Yx4psWP/dU376aM1zGlHvKF48Pm92f6BUuwCGKQoisYM90GosaS xOQbnAjEJ5WLCDiyfhPTV2NeOez+uR0BTwUHkl7kRgdfkMaGTpZfkfV0/UbFTT8= X-Gm-Gg: ASbGnctrBq8xs7bK+0m1FdAnmBvu1qeHgfR2umYT5o8Fdli291xplYxCDR+KWkh+iL2 tQWcoFIJbXl0jBKFrgLIPA1VeZA2vGYGnf7v/etXfiDEcbh/uQf59wLYTq1ABm3GCWG52DCrkGA bhwKAMH0SPRHeAfWn2kbKcJ5NrrnN/6t1pQJNjncRrUCLRN7Eb424N1Hi76W/qSGf2LMxKGy45U xhV7pqLWd/NWKW86Fm55GAIV9xzzd0rNNcQLMGQ7X4q1bx7lDZJbPS0s6iCzEzTNavan0x6uvbV j0iw84lMbxqm7Y3wWA== X-Received: by 2002:a17:907:9452:b0:ab6:f99f:45e0 with SMTP id a640c23a62f3a-ab6f99f5410mr1861971866b.37.1738593657466; Mon, 03 Feb 2025 06:40:57 -0800 (PST) Received: from draig.lan ([185.126.160.109]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5dc723d0021sm7829264a12.5.2025.02.03.06.40.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Feb 2025 06:40:53 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 438F15FB14; Mon, 3 Feb 2025 14:40:49 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, Mahmoud Mandour , Thomas Huth , Daniel Henrique Barboza , Alistair Francis , =?utf-8?q?Alex_Benn=C3=A9e?= , Hao Wu , Peter Xu , Warner Losh , Pierrick Bouvier , qemu-arm@nongnu.org, Harsh Prateek Bora , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Palmer Dabbelt , Kyle Evans , Laurent Vivier , Riku Voipio , Bin Meng , qemu-rust@nongnu.org, Laurent Vivier , Liu Zhiwei , Weiwei Li , qemu-riscv@nongnu.org, Fabiano Rosas , Tyrone Ting , Paolo Bonzini , Nicholas Piggin , Alexandre Iooss , Peter Maydell Subject: [PATCH 07/18] Revert "util/timer: avoid deadlock when shutting down" Date: Mon, 3 Feb 2025 14:40:37 +0000 Message-Id: <20250203144048.2131117-8-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250203144048.2131117-1-alex.bennee@linaro.org> References: <20250203144048.2131117-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 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 Cc: 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 Mon Feb 3 14:40:38 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: 861562 Delivered-To: patch@linaro.org Received: by 2002:adf:fb05:0:b0:385:e875:8a9e with SMTP id c5csp2056792wrr; Mon, 3 Feb 2025 06:44:56 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVb4F7wbUpHJvX/ubSK+vbDaz2QDH6LsNEYdPStLMhQsg/4mKKuLDOFgA0LTd6Vxx/qwy8aXA==@linaro.org X-Google-Smtp-Source: AGHT+IEZF7fEVfpuJcrUFcy7+pAV9hdoUfjvPP5iktnzsGWwrhuqTB2AmF7aLtPMw8ihs5ER+eO8 X-Received: by 2002:a05:620a:2586:b0:7b6:c4c7:ece5 with SMTP id af79cd13be357-7bffcd91fc9mr3206518985a.43.1738593895915; Mon, 03 Feb 2025 06:44:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1738593895; cv=none; d=google.com; s=arc-20240605; b=ehHw5JMDCE5kISgLPKCskEzK5Ry3+6XOWgeIzw8P9bGat+iwB9crvdEZcJnizCAjkR SjcxXX6FZr2GGBrdc06fNvii8vAIrb5CxsPFTcAkOu88MYwqn/7ozWyTwu1Tnoy87BDT qhr7usaxj/Ko4WjNCfpSCetSqYW+piftl2tm5IiLuEJsvfNVfuMHoRoKpnjV1Xkh4erT ffwC2BX+m7iUCI1be57/6n5kC6zuqCplGrpzCVkFdQySc92tlluKyo0VrenDkQkg8Tvb Fqm0MIGMsUyvSapZqwwR97i1OMmOhYBk0ZE47YkjEh/EAkyv/rVvWVskBgnoiq1zspUx fJHw== 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=NqkvdbJVB8UnpcPUocH0maI2AO9mRVOLCVcPRrsvb5A=; fh=jyfZ4bE00qD+eKuDDH0TAcN7aiec48pwVXD5svQqzcE=; b=O1QLDzdf73QQjwQ1X4fOu4MH5rF87g1coYGHQ/L5esUpBRMBO9MeuzlpumCaR4LKU9 c3iBw2/t9P6msV6Nllj6V0gip3ylzOdyoGGhBc6YnpU83RqSJmxz8YCdixD23BgnvAsJ ExTknc+yz6HqrjC7ECVE28bOY/0mdf8I23fpZtDZo4JsmeDytayDywn3RdHkh/r2sKwA nS03hepfPGazDSRQPe3GpMwiET7AR3eoQRwcBL89HIFUCWUzekulRJwbAn/ohQ/a2yHE SPz2emosvlXL5HjhP+hwmsI0TE9851dBjb+vFPbOmSNDXJULfMaTCChiloJqsUDjv6vy sDIw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AG5z2bCO; 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-7c02dbdc804si25449885a.276.2025.02.03.06.44.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 03 Feb 2025 06:44:55 -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=AG5z2bCO; 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 1texdd-0003sx-Vn; Mon, 03 Feb 2025 09:41:26 -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 1texdL-0003fY-QQ for qemu-devel@nongnu.org; Mon, 03 Feb 2025 09:41:09 -0500 Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1texdB-0002O8-3b for qemu-devel@nongnu.org; Mon, 03 Feb 2025 09:41:06 -0500 Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-aa68b513abcso792551666b.0 for ; Mon, 03 Feb 2025 06:40:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1738593655; x=1739198455; 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=NqkvdbJVB8UnpcPUocH0maI2AO9mRVOLCVcPRrsvb5A=; b=AG5z2bCO3EoN92hSjtSanaYGrJqEvQ/Q52ptcQUuJesoF+dwISVzQ40cQ1bMbBTxI7 77jY6w+34lygSFm1xnxuj9bjwaVhfEzRMnyBAXWKWtsDfhSNnpz7nCEWjx/hLoxTK1hy AXuQczhGRYtaHkDMUYBbmgr3enJP6b1eohCf2OS/NdBBMjyzip9YBL2fkKZoWrM/RnjG msyiChC0kZ3RyMaCcKLaEsL/tZBnF+wNsBSq2Ga/zp2hgsX611rBJyfXWeFI7DnbB2/n F5dlGHiVxMTOG5aB4aTuf/1jjvqCx4ZPppFYHfUNBonv+FUV4wDerazEsu3hN0/bYVNT FUVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738593655; x=1739198455; 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=NqkvdbJVB8UnpcPUocH0maI2AO9mRVOLCVcPRrsvb5A=; b=KqL5aDBkjtPcgZwS0UDowWRpgKuAKyULCmY2cMywoJGgCZ0/PG71uRK4N/7qhJGsj+ h16P19ZDIGqkL39vHtwB/fVGQXttQIgbewRnhR3cANWkrQkBsrttoaK9S/5OS4FT0734 vjPIsifP5q/aY6vd09Pytlkcg6E6b1QQul5pTzhpDbB7cXvBB7WetxgYFU51/tpPm5Xj I2l2FqdtW1WMP8iTmBz/XRzmnj/+l4NU+U1kQyH1C4JdNH3JbmpbJrsgTdqadmN8l7Wa OH51m2/AdWxZ5/ksCys4LQL9xu+HJTQ5Si3okqG1MGlyQk5IBeaHrHHBPYAjPg4s7/3t AreQ== X-Gm-Message-State: AOJu0YxzAWe1En/u1y12u6HIfDAbSogYXCMJRpv85u12Vwc7H3xSZDnp xWmYCanCD/a1bJEl5k95F/dRevR7rjYIk/EQ86Tqa+5IdzEWGWp+PwJ/H6DAmmg= X-Gm-Gg: ASbGncuQs158dvhB+E/VSEf9Dh9xeNeyh8YSKoJMWyxOPdJkH6FP2bms55IIIZjzui2 gzjcsfGMwvMqvagdsIDI8TdoSvqzB0GELK7E8paI8RzbDZhv97d8J1bK7FxXVVoVurTkHbAstz3 eu27tQeQhQo++zKv303N0uJalRS3Eu6dznLka1X928sJBs+xZ0YELalac/xlzdxvN8/J3dgdVZm OYxkYvW5xv1PbJyAfQQLDvc+C31Zbp4RfcZ88E0HIDqsuxLOnsPuQxVprebUmt/O6Jk+jv/+Men +eZQBDUvVqxMWNUO+g== X-Received: by 2002:a17:907:7d8a:b0:ab6:eeb4:504f with SMTP id a640c23a62f3a-ab6eeb457a8mr1558116566b.21.1738593655326; Mon, 03 Feb 2025 06:40:55 -0800 (PST) Received: from draig.lan ([185.126.160.109]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ab6e4a59855sm763310266b.180.2025.02.03.06.40.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Feb 2025 06:40:53 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 673165FB89; Mon, 3 Feb 2025 14:40:49 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, Mahmoud Mandour , Thomas Huth , Daniel Henrique Barboza , Alistair Francis , =?utf-8?q?Alex_Benn=C3=A9e?= , Hao Wu , Peter Xu , Warner Losh , Pierrick Bouvier , qemu-arm@nongnu.org, Harsh Prateek Bora , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Palmer Dabbelt , Kyle Evans , Laurent Vivier , Riku Voipio , Bin Meng , qemu-rust@nongnu.org, Laurent Vivier , Liu Zhiwei , Weiwei Li , qemu-riscv@nongnu.org, Fabiano Rosas , Tyrone Ting , Paolo Bonzini , Nicholas Piggin , Alexandre Iooss Subject: [PATCH 08/18] tests/qtest/migration: Add --full option Date: Mon, 3 Feb 2025 14:40:38 +0000 Message-Id: <20250203144048.2131117-9-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250203144048.2131117-1-alex.bennee@linaro.org> References: <20250203144048.2131117-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62f; envelope-from=alex.bennee@linaro.org; helo=mail-ej1-x62f.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 e60e92fe9d..1fa05e53a2 100644 --- a/tests/qtest/meson.build +++ b/tests/qtest/meson.build @@ -404,6 +404,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() @@ -437,11 +439,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 Mon Feb 3 14:40:39 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: 861564 Delivered-To: patch@linaro.org Received: by 2002:adf:fb05:0:b0:385:e875:8a9e with SMTP id c5csp2057006wrr; Mon, 3 Feb 2025 06:45:21 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVlJULz6T1IidgTBu6XfmKhF6IF6f6/Q52CWg1yg7L1wbNkhWvO5YNYW/60RIoU9ocsrpyh+w==@linaro.org X-Google-Smtp-Source: AGHT+IE6v7f9fAFYl78UULeOvuvcQPBg2BdHAc2BOHUJi+CgY0HtyLfn8IMqhzjvtlj0tVoeqWeY X-Received: by 2002:a05:622a:6106:b0:460:dc96:27bd with SMTP id d75a77b69052e-46fea0aa0e4mr204838601cf.14.1738593921308; Mon, 03 Feb 2025 06:45:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1738593921; cv=none; d=google.com; s=arc-20240605; b=UA/K3h5ixY19HYT+5hFkcDjh79BzJw+BIBvaN9ABtdZeq5y9CjQaHRnhy30k/iT9p+ Onzju0r3ECc2q6B8LuXO/JVq+etI23bBGcl5f2mRK3K/wLRUlvSFIyj3MJqzF4L+hqZD 1BugMrBNeNMyU0H1DaRgPisFLH7QU06jOCnp7DbFcL+J2Z1ZghMSDVTDAxF/VFtrvxXB cGCc2F9wqiCEosYIdUrKLzbvN/UTBPLNPn/Do0MZbOXFiS8OzBlI4AA/bm3dEVbv0jYk LClZlyWZz7zoe399CfAK6F/0cdZuSiQ2hoBmxHIDfDhfLfCFR6gJ5JzBq3ecraaSqh2Y Wo7A== 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=jyfZ4bE00qD+eKuDDH0TAcN7aiec48pwVXD5svQqzcE=; b=iW4g1sneVZ6cPgVuWzneBPKziADZV1YcJhQijtJKbv+Qd2Tt9tmB6gIIDXCMgpQlUj LsFCfQ/CbVp6ZPnyWll8OecIFfiISQF668r2EYw3XerTRgGRLE5aqp0nTPi0rqt4ez7K /n2YOzrqcIQpo6Z66atLPbv/7gOE9YOhbbTfm87CuUaQCwdkd4ZZdgZVihK+68/uFw/2 NTFgx53LdPHqLJ4ZqEjTdmMnHDBgimRJ52QkgDfQkYlDvCD3uAjoH3CgnyTyKkPhbNgp +8cCCjIGviyCZ85tP/qww5dZwOmQxeSaG3znkXDYFSn3F1Da3EZaEV2a+1kZ7AVNq+Kv FFpA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oDMcGp52; 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-470169f7ee5si2910311cf.59.2025.02.03.06.45.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 03 Feb 2025 06:45:21 -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=oDMcGp52; 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 1texda-0003pT-Gs; Mon, 03 Feb 2025 09:41:22 -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 1texdP-0003gg-H6 for qemu-devel@nongnu.org; Mon, 03 Feb 2025 09:41:12 -0500 Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1texdC-0002PA-Lr for qemu-devel@nongnu.org; Mon, 03 Feb 2025 09:41:09 -0500 Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-aaedd529ba1so624566866b.1 for ; Mon, 03 Feb 2025 06:40:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1738593657; x=1739198457; 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=oDMcGp52sMaT41Uhbt/AijUmdLSwvFIyKciJgrKPvm5/K6rhyXG2nCUydjd4jnPjgR REoZADm+yJ+ndTviXQllERpiWv1bPg0eVeLInFDEgZT7R2WsLuAImwgsJYxUlY7n71zr Uh1/+GZs9uLY1UEmBRMYlKThpT34u7aDHmu2PG8BJr0uJr5B1t674fLN7Vyb2Xb1EkhE wKrOtHaXgboD+djNpOFb1Yo6CjIYug6nCAQCMG1Sx0Qs77ymCDunwyGAMBkANQDzA4o9 aNESt2EU8BgCdRhbRGZr5YYRdkb7X6Q0VZEg5gRQL9e2T0U6x+fjvEGFXrNaLjyMUp6q n7sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738593657; x=1739198457; 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=OKOCbQZsKKOMqJcdcCQubmzxarR2TP4n5uKGFmzZ4WnvDS32+Jky1nCbtBEurIn1Ep Yi6cSchF4OHIRHWKRYD79tQj7KTxrRe+Ebn3+BgVb6/lZOS2qLlpQ0Yf0rAkjsb2GE2q KYHtcVRPCqQaMZlbc9E/Y5QwDdc3AwLUzXOOltAvtS57GAg8ZPCo0OqhiyXcMX0+L6Gb 35fYqYHgcL5ugbu+goarMYqcyorkbAhnjNpo+dq+opJzXeZUid2vye4nghogLT4kC1xk ZWOMr2qyHhU4o2xFSc4z5lQiAhrQ9WTfMs9toIrGVbmDlOFqtka0OtHiUllIQaWPvBMR +0Xg== X-Gm-Message-State: AOJu0YzTJcUkhCouGkvixoBQZ32cO/J62a8FQ903CBkoLGMTR9ThnmQK Itda7KHAc3NxusL5xN1PYSmzjSyTRh4m/CAWh1Nw0DhIQaQItIcyKpMrdIFLK+A= X-Gm-Gg: ASbGncun+Bvpvi7klQB3Sn3+kMITj91ipa13YU4tQ/aiocMWua/xYylewr2tjsVtFGY ItcLmj9HX1BTCdkYM4kxnL3hqjQmBmBJheSnyqzveAj4VRyUVzpjNffbRqO0DfIIfCUUh5IF5PY +DnFDwFICqQcXCJ1vs8Ab/Jz7V3KONkkdDXf0m7BEramlFEpM5J4umo3JImeqB78D1b68JPVI+e XfYrnV3ctiwKm1MLrAxQWl0slCYjLsmRle1Wt2CsV0qEARHNZEg65kM8XTuecMSNsc0D+EIxZ5N Ff8yKJOJZq++4w4j3w== X-Received: by 2002:a05:6402:4149:b0:5dc:a44e:7644 with SMTP id 4fb4d7f45d1cf-5dca44e779fmr12991043a12.2.1738593656729; Mon, 03 Feb 2025 06:40:56 -0800 (PST) Received: from draig.lan ([185.126.160.109]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ab6e4a314casm762664466b.127.2025.02.03.06.40.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Feb 2025 06:40:53 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 89A145FB91; Mon, 3 Feb 2025 14:40:49 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, Mahmoud Mandour , Thomas Huth , Daniel Henrique Barboza , Alistair Francis , =?utf-8?q?Alex_Benn=C3=A9e?= , Hao Wu , Peter Xu , Warner Losh , Pierrick Bouvier , qemu-arm@nongnu.org, Harsh Prateek Bora , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Palmer Dabbelt , Kyle Evans , Laurent Vivier , Riku Voipio , Bin Meng , qemu-rust@nongnu.org, Laurent Vivier , Liu Zhiwei , Weiwei Li , qemu-riscv@nongnu.org, Fabiano Rosas , Tyrone Ting , Paolo Bonzini , Nicholas Piggin , Alexandre Iooss Subject: [PATCH 09/18] tests/qtest/migration: Pick smoke tests Date: Mon, 3 Feb 2025 14:40:39 +0000 Message-Id: <20250203144048.2131117-10-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250203144048.2131117-1-alex.bennee@linaro.org> References: <20250203144048.2131117-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::635; envelope-from=alex.bennee@linaro.org; helo=mail-ej1-x635.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: 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 Mon Feb 3 14:40:40 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: 861566 Delivered-To: patch@linaro.org Received: by 2002:adf:fb05:0:b0:385:e875:8a9e with SMTP id c5csp2057673wrr; Mon, 3 Feb 2025 06:46:34 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUH+cV+jgbHF5Ioy9zUJeoyIVM0taUSR7MnLoNowElM/F5Fr1yLayqTP+hIngXggkrdfy7z+w==@linaro.org X-Google-Smtp-Source: AGHT+IFqg+AwDQ9uzzCs7Bo6KheT4TdIygffn7WBPPW+e8RxYs6NB4fV7ao7T8GbGtgUKk5YS63K X-Received: by 2002:a05:6214:21a6:b0:6d8:aba8:8393 with SMTP id 6a1803df08f44-6e243c980fdmr242013786d6.44.1738593994526; Mon, 03 Feb 2025 06:46:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1738593994; cv=none; d=google.com; s=arc-20240605; b=By5yJGynXfYsFmwb5UqJkn3ECFJYu62lMQdPlsGsGOMQtCHlq8zfHj/PCcEAfWB5Bu keaYjKsmIMsMPiDdPfEdJnUSWwZ558UerYjl8Qaw8bMCYCSVN436nW8YjccWqD9jZ1Tx fgGmLHlxIrrPOOyVPfox0HGpkk04Lw84I2iYTvdlwKsVAwmCuTromA9vrHft44hQt+3z S8FF9UBjQkpAVKCe6eT59cBm9V8G4sI8yZWJRPXJTmNFTEmXH7KSKcTrkc8xRObyPEcZ waUqp+oGOtmfRq3Gtau+imFbu/eJkxHIplQN0U1YJVIJzHEAKd4CViz5V4wzVNK1zb4j Iaew== 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=N6UesbPZcZz9+Zg4ASs7M2135KItBmvEYXga50ssWlI=; b=YSuClpQV4qRXBhnaBbTWhccWJeu3FX/JGTWhXc6w7+G3KTn8HALT4vbY9BEMwNq8aR SWTMDrl7i6honhGnLC2FUI3XCJ447t50y2xJtkmKjkSn+dZ7aDEO4l25UOPl9f0JakkR zDIzbh1p4W/u1rmkgTGb6ujU9b21ihzATsQHk6iwScbOaNuR/TTuPl161uUqr5zQWjR0 XG05IVXGpZs8ER8laLFZNnkcrjW7GorIpyqQCEPIzoip7es+8hkmj8IDh8XnPlbQFwev YrHQr1Ldbhuk+U0U0BTw6hAsU1UemMm8SrC1CwOXURtUx9+bZOY/Bu41RvqbWNiEhXqv wz9g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sHOqC0vR; 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-47016bd0700si2247201cf.521.2025.02.03.06.46.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 03 Feb 2025 06:46:34 -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=sHOqC0vR; 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 1texdt-00047z-Vb; Mon, 03 Feb 2025 09:41:41 -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 1texdN-0003ft-8p for qemu-devel@nongnu.org; Mon, 03 Feb 2025 09:41:11 -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 1texdC-0002P0-30 for qemu-devel@nongnu.org; Mon, 03 Feb 2025 09:41:08 -0500 Received: by mail-ej1-x62b.google.com with SMTP id a640c23a62f3a-a9e44654ae3so719431666b.1 for ; Mon, 03 Feb 2025 06:40:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1738593656; x=1739198456; 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=sHOqC0vR6eHlwNI6PcgEdE/FX4h0ziH7bPelCgmBDCUI6MYsY+PRNJCVbkcPUL8+ap Xobyw+Y3pFTIdgZ7eR3AwmObQyHqJu+hnOr2y78M1u2qeWR238+F7b005yvyaBlmgSC0 k9odv5xB40MDNbiZjst+sdttbL6cQedSX4uPR7bkVhlpfcWWf0xFHphkI4dICtsLmpXe MZcfEQuk0NQYWR9t7SsARjE0CeAIi/BPJngcmv7PptKf0Z1gfd6iqbTc2p31z5NbHkzk 3c3BhXa9vEqydTRB5Rn+hc1omNEnCXIX6W3GU9v9s55iW281OM9ZeJVGNTQYy6qRYujM kH8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738593656; x=1739198456; 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=qPD4dtFe98G5N7PhkU84DfV36f2gKA3tyPb8qzLDoavQ3OR4tZdsAawiqxnO6oDDQJ 7eGQqnC3Wf6yRBHx/pNJ1bBTTpbJwRUf2qHqYxqv9fPsEt2Ip8RkDe9z5q8S95yur5EZ eZq84NijBxWv2zbdwVgdtdFr4fKog0As1aERWYtvXUUXCIxcCI3AE7YAaJpte5SPcrpS iy7aEdGBf8hURwoLLvv+vYwUklKCHHHg1fFTSSRsY5jKlm37lzid0a03FeQGF3dR+xI6 ZW+rrI760ntcgZ05UA912036nt8EHmcLPzIlgxrRdwaPfcrsOO66c4FsTYtzt45obpnP QInA== X-Gm-Message-State: AOJu0YyzX2K6s0FCgtw/lqAeS3ZEZQRZN4ODOl26fr8QnSVz5xU2nQKU rT+cVLOVFUBI47FkM8kuOlAc651c8lup0Lk4cpps1uQPH8aBvU7u2LEq1Eqw4uo= X-Gm-Gg: ASbGnctNe+eRFUt9cjNt/5ijHx/PURjfPQMYPPyCoAbMDtD5mryFpXAmtUILwa4kL23 kKcRfbzwEKkNEYFXuDVR2Tls0Xox1DWvszGbHm3D2gVoUfyvvUCExufcoATrau2W4ZRtLKK+8Ea IxC+jclDyUBw6uuRC/iCrjKOHMi7umicpgaGR9RV6cyhdoKa9l52Ddhz7vZPuxHSEyLIKnkvZS+ ejSDiHZTKRQkvRsXAVK1RUSv3LWlFz7HJA9VilBeLR/+gpUSXu9cj3VmKmYyTPNZzS8Fla+3C4V 6mM2W7YCJZiXlhSHYw== X-Received: by 2002:a17:907:97c5:b0:aa6:5d30:d971 with SMTP id a640c23a62f3a-ab6cfcb6979mr2706860166b.11.1738593655675; Mon, 03 Feb 2025 06:40:55 -0800 (PST) Received: from draig.lan ([185.126.160.109]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ab6e47d070bsm757877366b.48.2025.02.03.06.40.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Feb 2025 06:40:53 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 9F6B260870; Mon, 3 Feb 2025 14:40:49 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, Mahmoud Mandour , Thomas Huth , Daniel Henrique Barboza , Alistair Francis , =?utf-8?q?Alex_Benn=C3=A9e?= , Hao Wu , Peter Xu , Warner Losh , Pierrick Bouvier , qemu-arm@nongnu.org, Harsh Prateek Bora , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Palmer Dabbelt , Kyle Evans , Laurent Vivier , Riku Voipio , Bin Meng , qemu-rust@nongnu.org, Laurent Vivier , Liu Zhiwei , Weiwei Li , qemu-riscv@nongnu.org, Fabiano Rosas , Tyrone Ting , Paolo Bonzini , Nicholas Piggin , Alexandre Iooss , Ilya Leoshkevich , Richard Henderson Subject: [PATCH 10/18] gdbstub: Allow the %d placeholder in the socket path Date: Mon, 3 Feb 2025 14:40:40 +0000 Message-Id: <20250203144048.2131117-11-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250203144048.2131117-1-alex.bennee@linaro.org> References: <20250203144048.2131117-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=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 Mon Feb 3 14:40:41 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: 861567 Delivered-To: patch@linaro.org Received: by 2002:adf:fb05:0:b0:385:e875:8a9e with SMTP id c5csp2057859wrr; Mon, 3 Feb 2025 06:47:03 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVQJ1CM45TAQoR0K5AtBBE78Y2EJ8JmlKgviTaxmE0ixl/eO6noKrv+Pn0Wn9xUItVkt7Ppbw==@linaro.org X-Google-Smtp-Source: AGHT+IF8upDfW6TU9xErxbQT4gWM9GSoYnYwN2gaqAb8zpJeGKLtb648EJNQVpEfDEDziKKOjg1I X-Received: by 2002:ac8:7c46:0:b0:46e:549b:3e79 with SMTP id d75a77b69052e-46fd0aa1fb5mr303805791cf.16.1738594023645; Mon, 03 Feb 2025 06:47:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1738594023; cv=none; d=google.com; s=arc-20240605; b=TLF2eXXEssJ1xWmexa38kgS+7nqpTneZQmGTGuF2NT/sUxzjKuKa5YCpfYJ7xzI7nJ 9uh2KbqbYstb9nELIXYbHs2Toh78pxkGvu6ne7ktyzAAxXIlTX/1ULUlmsitjJNYJNrQ yu0/26zZQarPTIjuVswqk523ls6pxJX8iE38G33VIvF5nU24j+hhRB93uhJwPSd448fb i8IGuqCNSZLjw4sZOKD8tQrzJu9JNMv+TqvUartXUma0SuX3eWETbXB2Pht9kGnLh5Jv aXPEYjjXFtS+5mNy7Ru0gP4f+sgc3CTxGR4jez4g+zABe5AjkzLOEJr3vwpGlFZjoNkL XMSQ== 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=oSJXNFQZRCHDVEQGzM+syjAcSIPFoBhiINu+GEymsjY=; b=dhr3cl7nhhmEGAhWjG/H4Vk7ENJntyx3xryufSzadlVPFYs2gCzA/wrboiQbrIGBG0 /d/YttpRoHKjkM8uoTnrHcfKK7NfDSUOMkbd7lPogZqdCk5Kp8kaQMI8RS0C7QFWktdB iMfGWdFKS6iTT1w3BBNaePUHLImty7fKdgVyQFtdvXEdsYysZNEV6FEyWCv/luMSTEr3 YDm/osqjrzKtjD0kzTlxJi0jIC3Bg5PYfSto2BHoKSx2ABaGVPH8dbCSO8qrm7MVTGQp +/9cf2YOZOdCIhfxn8Ra3IhASeCbDGwbt2j396TspPo5s4bnyF2xktaIm1VBR0Siaebs zWSQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="m/cZ7HPp"; 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-47016bd1866si2432781cf.554.2025.02.03.06.47.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 03 Feb 2025 06:47:03 -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="m/cZ7HPp"; 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 1texdd-0003sX-9v; Mon, 03 Feb 2025 09:41:25 -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 1texdY-0003oZ-7t for qemu-devel@nongnu.org; Mon, 03 Feb 2025 09:41:20 -0500 Received: from mail-ej1-x633.google.com ([2a00:1450:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1texdG-0002Sc-J9 for qemu-devel@nongnu.org; Mon, 03 Feb 2025 09:41:19 -0500 Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-aaeec07b705so736091066b.2 for ; Mon, 03 Feb 2025 06:41:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1738593661; x=1739198461; 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=m/cZ7HPpkdKAqBdfoXW/kFoIg8MkBsNFYWBlmLbcP8UYigF01sHNbRQTlqunWobX+m ztIiPzaJnVr80A/hEYl4fMV/BWMsIZYULbeFy3PhMod+Sh4AOejPYn8ugfrZQWx75vBy 64sqqMFzPWCJH7ko2sBEAtLnKtL2b2Mhd3X0L8qqK8xdI9c9t112IVFwAl6+wKn2I6bK r3bK+F2u/CHopPS9DY26qZYlppRgXQMjjC5qIWWc5ilZAiy3dUMfhzkddKhBYRdToQXo i9mBGuZOaQ0/UQR+TxLrj31A1z5+lXRHK3wgqSMQhwnzQ8W8IMMcK7G0vayVdGusNTYk q1gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738593661; x=1739198461; 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=hXWIXFruJ0dAC1aA2EQDLLWeEwKBlucWD7aJ+JRhfZncPREkx6vi+fAZqltlL9GXgS j+iSbnRHgKB4ykCS4OXrbO7vdLQ/xrXTaGQspEZgA5bdZSAkOhvzr7RCi8fyI7VGval4 ic5SewpCK/g9KZF/jkvSXVTdqKpAS5qH7nIRwICgDAvCnCIyHwmdqgsv23ajQF0J8vk0 HfVsUMDrcmsSBetXTq9jz5KZlw7JRF2V3W7HfjoASKEm/30brvfAtYJ7FR2hA4SBH14D h9JxrPfc1p4itLlAijz5WqDYS5OeEI1Kt2lPZui0W0dzG1LIl9RXSGrrwkiZArNUwch/ uQ5A== X-Gm-Message-State: AOJu0Yzpywaf15SUTL6wjzq9nsPLZuXKAwwe9evZA6ttyuTy/al9X2BG ebot1dDJGk6KAu2Lm7Yg80tMNub47VbbOi5Dlucb1mlUED/lZ57bpr02elK/JgU= X-Gm-Gg: ASbGnctZX50h3HAiZwGZhPwfNXWYFwRofkXxokQqYBOLOlGuoevvW0WIULw0XuM/TA2 JDoTSzERv3f4zCX2SCZn8lul27jMThJyAV41pFc3raFtSiNCzJuIqICJmZQWq+BsjSw2LmtK3jl bOyMlhStv8wfXF6m+7jgv4txbynmWcGPvjpz7Bx8LxD7LC1AKuBM4ABfa68rzIsGLe8cdcdgDVs /+ww0uSAksdulpRRDfhb0/jjn7hNgD0N7yD2gFkscrPyG1vSAOGKnDHLxkgBogHFFqJVsqmgKiX 9/WpHpe4fZbvvwfutA== X-Received: by 2002:a17:906:c146:b0:aa6:1e9a:e45a with SMTP id a640c23a62f3a-ab6cfdbc62cmr2220431966b.46.1738593660687; Mon, 03 Feb 2025 06:41:00 -0800 (PST) Received: from draig.lan ([185.126.160.109]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ab6e47d0feasm777494766b.52.2025.02.03.06.40.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Feb 2025 06:40:56 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id B9D4A608B4; Mon, 3 Feb 2025 14:40:49 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, Mahmoud Mandour , Thomas Huth , Daniel Henrique Barboza , Alistair Francis , =?utf-8?q?Alex_Benn=C3=A9e?= , Hao Wu , Peter Xu , Warner Losh , Pierrick Bouvier , qemu-arm@nongnu.org, Harsh Prateek Bora , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Palmer Dabbelt , Kyle Evans , Laurent Vivier , Riku Voipio , Bin Meng , qemu-rust@nongnu.org, Laurent Vivier , Liu Zhiwei , Weiwei Li , qemu-riscv@nongnu.org, Fabiano Rosas , Tyrone Ting , Paolo Bonzini , Nicholas Piggin , Alexandre Iooss , Ilya Leoshkevich Subject: [PATCH 11/18] gdbstub: Try unlinking the unix socket before binding Date: Mon, 3 Feb 2025 14:40:41 +0000 Message-Id: <20250203144048.2131117-12-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250203144048.2131117-1-alex.bennee@linaro.org> References: <20250203144048.2131117-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::633; envelope-from=alex.bennee@linaro.org; helo=mail-ej1-x633.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 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 Mon Feb 3 14:40:42 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: 861561 Delivered-To: patch@linaro.org Received: by 2002:adf:fb05:0:b0:385:e875:8a9e with SMTP id c5csp2056737wrr; Mon, 3 Feb 2025 06:44:49 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVWLMqBc/A0OL2l8uDaBkyvjlxKGUy4Sgxv92MjBjwlaPSrEb92fcVTYnznsr0zKtTch3bV9A==@linaro.org X-Google-Smtp-Source: AGHT+IFYITd42aC3fEm0zzUHsVtHqL+U7XRpr4faLgwMkUEM9ptIoF8UMNbV2XQb9sLE+t8t8o5x X-Received: by 2002:a05:6102:2ac3:b0:4af:adb2:5133 with SMTP id ada2fe7eead31-4b9a5268bc9mr12585326137.23.1738593889326; Mon, 03 Feb 2025 06:44:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1738593889; cv=none; d=google.com; s=arc-20240605; b=GzQ+DhGvRTbdh8iLb+DdUm+VExgCWQpJXxTCE60jVf0r2OgDPMKHAyl8TCBwKb/5hK L+blNSZrYBluEcd6GYnoepu1id4EDT1onLpHynWWWr5LfmqAPvsLxP4d1H5QkKur5/7K QSq8hbMVX01RYEI16lfT52BfNQhXWy1tIKF24c46IHlGypBZnSmoqgu51ftnODNdLEbV LutKBGiIQOhDtsFUkiZwOUjI5c3rP6ykSF0aKwn5MAonwa1xV0BU/14uG0NbACZOL8Dl ESp48ju7dM4kZSqBTpEgRvBl4CCKgevGWus4GgVv/+jlp7zGqUbmPWyAaLJGfymEX/Fd J3SA== 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=N6UesbPZcZz9+Zg4ASs7M2135KItBmvEYXga50ssWlI=; b=ZY8dZWs8/0n4kRMWcnfsfsgF6MIVoVNCfXY5aycgWe91ZFXx1ib28ZyIaXOAmeWSpP J/fpe/To50HEh+pGB8ZZU/Sl3OyVxyUIk0BIHkgXRicQrTpQHOq7h3wkdgQlHHql8QRD RCgF2yc28gWQPmMlxQKscY53x0VQJ6cXqVhnBtfOaup2OEkrwzCHEwJrCJgVA7QAj2HE bmbL0x48+Z7OQb5rjNBKg5zLJcxDyaYc1EeN20JB4YSv536sAv+vapiF1byrrCBuK0d8 5CvVWYaCksmQWRjDZOmtI+WNwGB9GaBdrvSAp0kL++1td49TMOWF/NKHPSvtubS4KLoN gs2w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DbSFy5BJ; 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-4b9bad86c45si2128136137.257.2025.02.03.06.44.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 03 Feb 2025 06:44:49 -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=DbSFy5BJ; 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 1texdg-0003x4-Dq; Mon, 03 Feb 2025 09:41:28 -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 1texdV-0003jf-KM for qemu-devel@nongnu.org; Mon, 03 Feb 2025 09:41:18 -0500 Received: from mail-ej1-x62a.google.com ([2a00:1450:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1texdF-0002RV-53 for qemu-devel@nongnu.org; Mon, 03 Feb 2025 09:41:17 -0500 Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-ab2aea81cd8so804170766b.2 for ; Mon, 03 Feb 2025 06:41:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1738593659; x=1739198459; 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=DbSFy5BJSGk1sOPzs6PdLDs66WCZqVowkG5tqGqmpwLzzLD45pn0Pq3+UTbwqLhhx3 Qq1VJX5MOkYyuV+5slr2vUCLj0qPIqMckhPjdc0A3gvZqsvF5r+yjbYlbx9M8KP5uEeP uVvRQU7wm8ZIvzHvltWccd7scYeJXtZf7Mxh73erhOf9o4kvEmBs/vZDAyW8i5ZZc1dZ B/TzJlAf1BceBfxg/YOJvFDpq1bFei1ox7/FNW/5TjVXViZRNHnpV2IA+ochi24bGxRX 4mWe4yvOhfAZ6LS1KFCHbF1ENrvPP4x2/Rr4CYTcLSjUMQ8pbqNdZmDW7KaAfzEdKXuh b0ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738593659; x=1739198459; 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=t+rh0gCABALKjCHRiE7uHQfRFAENWvao2zRY3JbQ7Fn0AftONRkWk/o6fF+Blk5dsg lS249d1iYNM9PH4PRzsyELuHS0pdY9pB+DRagFxrN9LlOYnWKMTeUyeBdVWI6lBXkuyQ US/Iu4Fz80Nh/ybuLAmEfcuChVs9NGe72X4ppzKxbj83Th8mUN8zLHunycfrxgYx4Iub 10Nlub1vHcXSKLro+QKwo+QXdaYOwcxfdE7vBRqUDUK+tXN2cOwvo7cLrXrMBN68jtDZ ujLgm4d9vrZByWc9sAVqhl8cFaJ0Nhf/zr+nMUs07zmcEwofviuS+J/434Ar7SZirdjT 6jHQ== X-Gm-Message-State: AOJu0Yy8E6YEZ6+OhxhNqKB+IQpmFIjp0FDipKpySbuPYqECU0+ez9cb s8kMNaAQJXUryJPBPuUs3Fv46BjtVmunAqQEn/lSfMvPJrBJkuk8GPScbTAEDH8= X-Gm-Gg: ASbGncu4deYZK9Kf+Xegc3bYOlFfgp+s4Z2PkiON1tPtbRAsAoX0gqu3mFJDSvGbx1r 9nCsx9rFF7dE0IwnoOi6lKgAxVmCQNf+CI02XbxrbyjeGdkoFIRXGWauLM888UZtDSkF/4IclyS lI8hCbH0/uiAff+agHu6KenGUf+WFtwCFDMn3hiKTXr6NMPf1qWX9LuADkFD/UCBsMq4LwyFXxi jkak5IRpVv/LSyh7Y30Z0jeKrTzhTvBk9pIR14Wgddn0UcGd8d2H0WB32vseJTkLO/+88XtLjuJ 1iRQ9iAjW7mOXrgxSw== X-Received: by 2002:a17:907:9452:b0:ab6:f99f:45e0 with SMTP id a640c23a62f3a-ab6f99f5410mr1861994166b.37.1738593659460; Mon, 03 Feb 2025 06:40:59 -0800 (PST) Received: from draig.lan ([185.126.160.109]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ab6e4a5a26bsm762985066b.183.2025.02.03.06.40.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Feb 2025 06:40:56 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id D836C6099F; Mon, 3 Feb 2025 14:40:49 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, Mahmoud Mandour , Thomas Huth , Daniel Henrique Barboza , Alistair Francis , =?utf-8?q?Alex_Benn=C3=A9e?= , Hao Wu , Peter Xu , Warner Losh , Pierrick Bouvier , qemu-arm@nongnu.org, Harsh Prateek Bora , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Palmer Dabbelt , Kyle Evans , Laurent Vivier , Riku Voipio , Bin Meng , qemu-rust@nongnu.org, Laurent Vivier , Liu Zhiwei , Weiwei Li , qemu-riscv@nongnu.org, Fabiano Rosas , Tyrone Ting , Paolo Bonzini , Nicholas Piggin , Alexandre Iooss , Ilya Leoshkevich , Richard Henderson Subject: [PATCH 12/18] user: Introduce user/signal.h Date: Mon, 3 Feb 2025 14:40:42 +0000 Message-Id: <20250203144048.2131117-13-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250203144048.2131117-1-alex.bennee@linaro.org> References: <20250203144048.2131117-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62a; envelope-from=alex.bennee@linaro.org; helo=mail-ej1-x62a.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 Mon Feb 3 14:40:43 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: 861555 Delivered-To: patch@linaro.org Received: by 2002:adf:fb05:0:b0:385:e875:8a9e with SMTP id c5csp2055783wrr; Mon, 3 Feb 2025 06:42:42 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXmuzTcR0QptqLNcFaawJCl+lXRQkKWZR+LLV6gASCJkzKMSo+7H5OSKhmo3ZeIrcoEHn4Vww==@linaro.org X-Google-Smtp-Source: AGHT+IGJCBrnHFep6e3Tm2OZvGPgq545WPMYxSxpyfi2Kcj+wUjHgMIBvzujK1C52wAetA36fhz6 X-Received: by 2002:a05:622a:20e:b0:46c:791f:bf56 with SMTP id d75a77b69052e-46fd0a113d9mr357619271cf.1.1738593761937; Mon, 03 Feb 2025 06:42:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1738593761; cv=none; d=google.com; s=arc-20240605; b=Gc1zhVxP2Q6X1ntYhW+LEbKDaC63Z6LCWrKUfoF78jcrVJoLNhCSzZYrwg0OV6Yex0 ifIQO0ffT4ZzkzRgMnQR59VewceWkeA0sH0VjaWK9d9uaucSTAy/lhEurxwnjwZWXgeP LKTz7PNuYuoLO/UOoHMj/4wsonjdd/qatN78hPcKXLAZiiH8rGXTLgzDp+CsnXwtkg6g CKbTrrpKTeC5oWfzqG3+/oBR0qaXCfimnxvs3NAYQMXh1b/Ar2HG8YBjGGySMRxtB+8j Pxx/o1yUv/zquCYGqFS7lipIVP+ZxYrNNembQymJXYQ5IjKKzjPAwjTEDRssnDU2ab97 8ylQ== 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=oSJXNFQZRCHDVEQGzM+syjAcSIPFoBhiINu+GEymsjY=; b=iRObmghMiLCdZmUElcuF8esORa1qG4wXu5rz0sW1/MSNNlk5OJNT3EjTVEkP5KabTT J22Tjc7YJRh8M+4f1LBcl22z1KaK8HmCU3NcIu0NDlQ/8QzK81iGs52QHgj66IaunV00 jS6TmfazuwAzF5V4/o/KLQgDx0WaCldO7/oOa98H6RGQJ7BdDLwwjgSAE2t/5kQ9x8Vz t9HGK4A4bWZfWqyrNZokSXexFl50S8+TxI/rxPo/f4v2PDvlUfrBXqeJJyLcD/mnmWTa hvPuq8Z3t0oFSkM0FKwuqM1nvpElFY3bqFheJQG1NLVpJ9h5DGYJEykMJpGR0Pmnvddy l6Tg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oz+PZ6ku; 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-47016bad8c6si2633491cf.460.2025.02.03.06.42.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 03 Feb 2025 06:42: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=oz+PZ6ku; 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 1texdb-0003qR-V4; Mon, 03 Feb 2025 09:41:23 -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 1texdQ-0003h6-Tw for qemu-devel@nongnu.org; Mon, 03 Feb 2025 09:41:13 -0500 Received: from mail-ed1-x52c.google.com ([2a00:1450:4864:20::52c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1texdD-0002QQ-Pp for qemu-devel@nongnu.org; Mon, 03 Feb 2025 09:41:12 -0500 Received: by mail-ed1-x52c.google.com with SMTP id 4fb4d7f45d1cf-5d4e2aa7ea9so9629481a12.2 for ; Mon, 03 Feb 2025 06:40:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1738593658; x=1739198458; 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=oz+PZ6kuKYzRbF0YsJ24w2ZlzLXWsH6vlpQ6lvDLM61YNufw5HDa9Pd07PAoxcI17A Egr2JPiH9/rPIRdoPt6k5cvGVzepqygM7IPQRoV7gIWdIuo+7vccv12IYw5QlelaIVpK 83+e2zGxYyzGdZjIYOxWPyxbvXyzh9iQlehp9AUXf1GRdMRHTpG0LtbOYRIuS7LitXYf M+NJ9p5o69xgyRaMI4qKWxAJe4OAnwQHuKOff26WwDKTdtc+Ao8cmEnsWQefrNCy3O8v ZoszT+5HlDUp5PLMXyNVreggW0eNXjRD7K5k3Ecsj+OHXxMZrvpLqLH1xy6hpZkNAhkK u3PQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738593658; x=1739198458; 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=u4OeUx+YcMtm7KXl4rBnTC3DCoPFF0DM86fUZkxivvQeGpG/umLUPnjia/n24pYVKb PP4VeSYKL1AyU2aRX13yRD+t3i370jy/20h/yj/OCvZDwmb4FwEkQipbtezFnpapck2Z VfDiycw3Ta/+WFuvh5L5c4Pemiz+c+7Vyjy3tBikh2D7ZNERfpzbIRyvvhwOt3rkr/69 mNq6D6e/EuC0ZCLHR9iHYwMAXw3cHIt7XDWGSo+0Bdp3DYDue+L5o6bDqx1NK2MeXT4G nK8owYIJnx7tStq1iaJbXTIa6lgbkih8idoBC+RoIgbQDmstw6I2p2HPZEiqh77A9zhq WYOg== X-Gm-Message-State: AOJu0Yz0QMpoGL/uNi8z7ZLexsSYAPxBmbf0lx9xw2Dy6fcjT0joZkWh JfbWPy8gf5GO85i7kfB1qprwVv5OJSp8HO/Tju5rST1MggOMbG/MDYw/Oizve7Q= X-Gm-Gg: ASbGncueX3bT/0MPtkhfZpvLtQsn3Gz6TG/IyUApDbQT18QbzFr3YEpV7sgxsbR+K/Q w/mNIkUHiIolIV3TcC0VJtl+NIn5RMjhhw7t80VFTlbMGRY7kcKQxyN24kiBJU7pSolFQP/2HK/ iuNaKkgQQSJFClhM6SiICemCeMzA+/qIyTfspr3hLXOft6tz3yrw5cTW+DYZY7TQNb8Hwt1sRht SAjA6n5OqFiBh1rTDPLoIsg2xl+3vmC+ZWla/kd5DGdN6tOn7EdTJ/ex8Vj67vw4YdxBFJj8UGj 8tWdkvZTapSpy/w95Q== X-Received: by 2002:a17:907:8b94:b0:aa6:8a1b:8b84 with SMTP id a640c23a62f3a-ab6cfe17745mr2460903766b.57.1738593658202; Mon, 03 Feb 2025 06:40:58 -0800 (PST) Received: from draig.lan ([185.126.160.109]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ab6e47a7b0fsm769101066b.12.2025.02.03.06.40.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Feb 2025 06:40:57 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 03C70609FC; Mon, 3 Feb 2025 14:40:50 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, Mahmoud Mandour , Thomas Huth , Daniel Henrique Barboza , Alistair Francis , =?utf-8?q?Alex_Benn=C3=A9e?= , Hao Wu , Peter Xu , Warner Losh , Pierrick Bouvier , qemu-arm@nongnu.org, Harsh Prateek Bora , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Palmer Dabbelt , Kyle Evans , Laurent Vivier , Riku Voipio , Bin Meng , qemu-rust@nongnu.org, Laurent Vivier , Liu Zhiwei , Weiwei Li , qemu-riscv@nongnu.org, Fabiano Rosas , Tyrone Ting , Paolo Bonzini , Nicholas Piggin , Alexandre Iooss , Ilya Leoshkevich Subject: [PATCH 13/18] user: Introduce host_interrupt_signal Date: Mon, 3 Feb 2025 14:40:43 +0000 Message-Id: <20250203144048.2131117-14-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250203144048.2131117-1-alex.bennee@linaro.org> References: <20250203144048.2131117-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::52c; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-x52c.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 Mon Feb 3 14:40:44 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: 861552 Delivered-To: patch@linaro.org Received: by 2002:adf:fb05:0:b0:385:e875:8a9e with SMTP id c5csp2055630wrr; Mon, 3 Feb 2025 06:42:20 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXVUyCxh85DaWewOyShSpaKW1vkEDRKhJPr7pelYhUyb5LL0gARyjMA2e+O0TDg8QDOPil6Vw==@linaro.org X-Google-Smtp-Source: AGHT+IG0xZo3O2q3EoSNBKfcF5MRB7FyD8BlN6BGLzxJi+NAuaQaL8O4t+frTOBNjUfuVJZyKknZ X-Received: by 2002:a05:622a:199b:b0:46e:2a18:93a6 with SMTP id d75a77b69052e-46fd0b69ec2mr340903191cf.38.1738593740544; Mon, 03 Feb 2025 06:42:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1738593740; cv=none; d=google.com; s=arc-20240605; b=ENfoeUXNJ/ytT4K6AkswdBsN0opIYGnSuJDUg39DY7u/PQR16LLZ7uS07/FgV7xz34 fEmJXUo04F8zMEcS6vjXkvpnmAeF3Nm6FvUWafT1D6ub7gs6MkiM0/EkEcQB1pvjc1bt 6vALLIDkxzJc2Q4HP0OX4U5vw6C47Y+TMKYyyWAKxHUS9345Q/lCeX8jF4mRT1GJH0eD LOblgguuh5AOvfiKhRzhE+pbZm2RexR4GhTqKBKLbd2T04Vvspjs0nXsU4nKotqnyhHL tjn/FRxxFdZ+VMiO+05O1exGCOrqYO/Dvw683eyADlpkmZgEqaaw1YBrurOC2rBiJTq6 7wEw== 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=N6UesbPZcZz9+Zg4ASs7M2135KItBmvEYXga50ssWlI=; b=IXNG8l/biT0DrKDAuTBKQtwjVhLSmub+QmE5Pe6u/QieF7Pwra/JbrqpPmovyrHmxc u3roGzA5xKFJ4toBaJN8ftqmtiwQN18gMpPHxhfOYi/SZ40o0bk0REnlFvO/OY31497j ttmcCQ/4EAEu0noEC6m4kKuz29jbNe6ZuYwTECcMnwMi0tkW5gRTrAOPiDUafo3YCR/z 7b9odfDDi5OoJZYhZy+OXb8LczKL9T2P48YTl87YmyCTA4xJ+HJNs+EdlKRPJZD+h4Oo BnmQr4LlsNI3G/h1A9I2gO1yzu0dqCyChqrrosO0LOhcROjQxBU6pRz+yvWO2kvhb1I3 sviQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZIgKeMFb; 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-47016b7dcf9si2447511cf.327.2025.02.03.06.42.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 03 Feb 2025 06:42:20 -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=ZIgKeMFb; 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 1texdp-00043Z-96; Mon, 03 Feb 2025 09:41: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 1texdX-0003nx-Ub for qemu-devel@nongnu.org; Mon, 03 Feb 2025 09:41:20 -0500 Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1texdF-0002S6-N8 for qemu-devel@nongnu.org; Mon, 03 Feb 2025 09:41:19 -0500 Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-aaf0f1adef8so854345466b.3 for ; Mon, 03 Feb 2025 06:41:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1738593660; x=1739198460; 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=ZIgKeMFbhbW4z/mtbAu8u2zY1rb+fKzdkxh79pY3Q+WAvCOBZckbdYzoOd+HCwCkPV QSmYXn+o9aspZAqFhflXdU5rHo2O5Ffx7suQnmMzp/LJJ8U71269l3tYn8AE1sZDHYql 45kFFSnDZhJTjszzUhsqG1K9vCmFWv5jqTxRCQjZtin50pwYCIquNhc74IJz4W4XW/ef MYRhbKL+rRYvIvsXRuGVJHzmW/J0WEqZm79fv0XNmtgee0WftZce08JMhOS5Xia8qGs1 +uob1GzxHR+LXHv16De5ZhyYAyTM9tLPcD+8gi6ai9Ck31+I6D/p/FUhzyrqHFMQXtDb AKCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738593660; x=1739198460; 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=m/eAA3MPgYNjdge0G9bow5Db7ExF/I/gCLv4Af7FVBKDUleHnPYcG7CoBAHqHfBD3+ 2tbolFjUAf1n348R3LobxzQnVCnPx+eAAQMgVIShv1ZM0x5ikzvwxHaVbVWXpIFB3fnv BZT5e8LHJx4i+CaT4/OcNF0c6oIpA2XgEwHZQADrNJG6v08cdusppVrotmk+C7if61iu 8pmSzHf4b53U81hf20C3tnLPknAj+T4ia7uGj2aPLYQBZNG9+OT02aIjCh94TCNNkoOY 430GZzRIXqslwcnNZzDzUF49FjHusXWOJn75b8a0PsB2ACpMFYgfZMYdRfxl3z4Wgi++ +agQ== X-Gm-Message-State: AOJu0YyNCQ5zqwhFPPx/pKklQAkAQwSziXHJuMZgA1K941G3TgJP1IPu fwcLre/qKMM2gNkahWV0dk8uxk+p0T8H+IE6KInEXPp3Aa539uhcBpgKD4fuBCA= X-Gm-Gg: ASbGnctaXliTbc53PgvzU1vBWKONutrwRZoW3An1BZq0iiRGaNBwQAd3Y30pMIGO2Ow 4k+9n6PhM1dnT1RZIvUh06ZWPr204+2jyMtcgGUJXTCIv2CO1XuNwTvCPfvAc9fMumJqNvYEqDP jYBrsWdxiV3Fj5jLh8WERehd3ro+TrYkH2xbr+5rus9qPek1LhoXaaidN5tus/bLf/JVqZ9Cu7d KWvD0ENR0y4SLT2ULpPyDjv66/IrrieL5D29842D8OOPKklJZAmiqG8cO90+ppJtu2ycCLL0u/T +eCUxMmXDlKtMzoDPg== X-Received: by 2002:a17:906:478a:b0:aa6:94c0:f753 with SMTP id a640c23a62f3a-ab6cfd096f9mr2288818066b.33.1738593660035; Mon, 03 Feb 2025 06:41:00 -0800 (PST) Received: from draig.lan ([185.126.160.109]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ab6e4a5621bsm779576466b.172.2025.02.03.06.40.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Feb 2025 06:40:57 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 1DBCA60BD2; Mon, 3 Feb 2025 14:40:50 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, Mahmoud Mandour , Thomas Huth , Daniel Henrique Barboza , Alistair Francis , =?utf-8?q?Alex_Benn=C3=A9e?= , Hao Wu , Peter Xu , Warner Losh , Pierrick Bouvier , qemu-arm@nongnu.org, Harsh Prateek Bora , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Palmer Dabbelt , Kyle Evans , Laurent Vivier , Riku Voipio , Bin Meng , qemu-rust@nongnu.org, Laurent Vivier , Liu Zhiwei , Weiwei Li , qemu-riscv@nongnu.org, Fabiano Rosas , Tyrone Ting , Paolo Bonzini , Nicholas Piggin , Alexandre Iooss , Ilya Leoshkevich , Richard Henderson Subject: [PATCH 14/18] osdep: Introduce qemu_kill_thread() Date: Mon, 3 Feb 2025 14:40:44 +0000 Message-Id: <20250203144048.2131117-15-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250203144048.2131117-1-alex.bennee@linaro.org> References: <20250203144048.2131117-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::635; envelope-from=alex.bennee@linaro.org; helo=mail-ej1-x635.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 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 Mon Feb 3 14:40:45 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: 861559 Delivered-To: patch@linaro.org Received: by 2002:adf:fb05:0:b0:385:e875:8a9e with SMTP id c5csp2056400wrr; Mon, 3 Feb 2025 06:44:04 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXLwRFTUEiLqlt04qkXEF/FQJ7c/bobiwR/P+ftQc2ws1tWG/2AeU88tY4UyEnNHvKKCrOLtw==@linaro.org X-Google-Smtp-Source: AGHT+IFzDv06d0HQ5O/MMJHl7VAGfpkchJukXP0VmvvOXRkiDr75QcuozDA3mRDdf5BjYtGZq0cR X-Received: by 2002:a05:6214:258e:b0:6d8:a027:9077 with SMTP id 6a1803df08f44-6e243b8fc50mr319194046d6.5.1738593844465; Mon, 03 Feb 2025 06:44:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1738593844; cv=none; d=google.com; s=arc-20240605; b=AvPsCvq4hb1xRMu3nJ417fSI/50+Q9zOROIIwrvdTXXp5hhkkZ7tAfhmGNAiRfCNng 8BqhnLS6pbo7XisAPCF4YeKB4MryhgiWL48FXwIh+bUlUqPor8ZOEEMJo83p9nDMzlsD d1JlOI5dQ8IvrdW4wgjj8uGsCNgFzxLi+wfO/7u+9lBfKSTfdBat8HfjnhCf7CoFjwY+ qIeNvi9+fGj5XsGPUae8liGvCOW8ChXlQLYrvz7x33RA7tbf8JOilluS6jB0H1p+z936 BU7dVvqCgtUysMl72hbn0jLfHeSDZY2yDaj/lcWzUKcpBBm0kvlieMxgxZQCeeb2+yys dYlw== 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=oSJXNFQZRCHDVEQGzM+syjAcSIPFoBhiINu+GEymsjY=; b=PCrXfJRpbbbKecnoV83uZ+3QMf15CJog4ZY/yNnBLVnccLjNLSD1zaJeHAcAA8Bfzj bFA4DaclGDukgZkEYp8/W+KFUX0/jMjPSSyLkTlbEYQzpWmAG55SQNNOb/GdTHQoYo4Z dsUi3tBqxEioQpxdTJftgkIDsOV1s24ArAcYdmvCI80UxehPBFI7Itf/pUOl14WBqkBR jvai8TE8R5Q7QSIVM74eqZkOxyZLA4vic+/qurCa79pd+eQ8Sx/YSmbwGgYR7wFPoWU4 31t0oV6LZ3gn/CtaOuCFQme1ZP++EDHZ4wF2Qra9wZCqVwgEYcXEIGFN8unsEzgKMRlH aS2g==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qaWAs1id; 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 6a1803df08f44-6e41fd03018si3268476d6.0.2025.02.03.06.44.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 03 Feb 2025 06:44:04 -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=qaWAs1id; 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 1texdh-0003xI-7L; Mon, 03 Feb 2025 09:41:29 -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 1texdS-0003if-Km for qemu-devel@nongnu.org; Mon, 03 Feb 2025 09:41:18 -0500 Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1texdE-0002Qr-Fi for qemu-devel@nongnu.org; Mon, 03 Feb 2025 09:41:14 -0500 Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-aaf900cc7fbso970374366b.3 for ; Mon, 03 Feb 2025 06:41:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1738593659; x=1739198459; 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=qaWAs1id5oc0k+rIsPeBbxyvOV13fuiVqJVROMSZB0Lb44lr8Y2Xs75qAVbH2Oc1lY Vr8Vg/3PdTsuplHxgt6YxLgRb+h210YtsGbaU+Msoqa/nr5Tkh/2bhxhzXPk5x8BveS0 58CNPmAE/Q1ec6u+pCIWyw5v4pdg9ssa9DD5pn41hHPN6rbBmYvJ+2Kub21PQecSA4rE 8tzwTs9r/nxfzVVu0WQIdc1Ud+QTg1eVPwl4fY7vo7ixFUDfJBSjsye3qSLToAv6KpOm MujfGLUdRVFPmxk8a1pj6HHYXZB69gJXi4yJn76Kuud34fDLagvGGRzITp3cRv2R+BAu rjDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738593659; x=1739198459; 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=ZHsrGg4ita1BXobi8P4NYxsWIx/kry8JooAtqrriF4IT4jxG8yfYhi7/VAj0Nj5rZV hRVs19qFiaf9TEB5R9TRLZXmW/vsBtZ8tqzHe2aonvvqqzUH9W1Y10JvUaRJNHLfLv8e rlsA0Ua47Hz9iUhnHFJWQRwe1PH+Gue+USfAXkUsGgUobRZKcKm/RdHkg3KoH3zupObb kHm3kWt0klspkJMgQYv+u1pCkdVPXBFcE638Lt6DJAmU5F/NjQ2xe4CGgFPDWy3DpAaw ZMh0CtueLebrzkUWNl/eh/M0+OYst50Wo2N9kxiPjjQMOi/aHXmOTmcI314r8GO3AZPa boBA== X-Gm-Message-State: AOJu0YyEIWAvIVdbeWQPkUYhiS6arGqbci+z3e/vUWItqjy8gof1P/Qe ed3qoUiG/6Vff4n4JNP89k8Dcg5991RwXpEKCsyjR4Fiyw0EJdPNMLUtWuOCzOI= X-Gm-Gg: ASbGncugwdPSBQLJbjOgGR0KXdtJr5yqbDIXu7dAQ06RfdmUCCFcfBBcT2o/XzP/Nad 1wL43ANGEbcA/Ebjj0fbMRtx3GShbP6a6x4d87pI8k5QKCrN+TmzqcWls2sEEfgCId/1jZvPxjP u4DHipGfZQ33jcDwG03aljPIHaTPjg2SqVORVweGhzWCnJszelc5EagFaRXCLV4T8Gl0ftcAGEe TdC5pEvAzwI7crCkr7czyr8OV20N2ryYVKo0xMtMcrLt+V4PSIkZ0c9VXBK+9FkmpkHknSNX2tc rkw4QCxBuns0bxFJDQ== X-Received: by 2002:a17:906:e218:b0:ab6:dd6b:2a3 with SMTP id a640c23a62f3a-ab6dd6b0549mr1789421266b.22.1738593658893; Mon, 03 Feb 2025 06:40:58 -0800 (PST) Received: from draig.lan ([185.126.160.109]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ab6e4a57181sm768648166b.170.2025.02.03.06.40.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Feb 2025 06:40:57 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 356195FA5E; Mon, 3 Feb 2025 14:40:50 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, Mahmoud Mandour , Thomas Huth , Daniel Henrique Barboza , Alistair Francis , =?utf-8?q?Alex_Benn=C3=A9e?= , Hao Wu , Peter Xu , Warner Losh , Pierrick Bouvier , qemu-arm@nongnu.org, Harsh Prateek Bora , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Palmer Dabbelt , Kyle Evans , Laurent Vivier , Riku Voipio , Bin Meng , qemu-rust@nongnu.org, Laurent Vivier , Liu Zhiwei , Weiwei Li , qemu-riscv@nongnu.org, Fabiano Rosas , Tyrone Ting , Paolo Bonzini , Nicholas Piggin , Alexandre Iooss , Ilya Leoshkevich Subject: [PATCH 15/18] gdbstub: Allow late attachment Date: Mon, 3 Feb 2025 14:40:45 +0000 Message-Id: <20250203144048.2131117-16-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250203144048.2131117-1-alex.bennee@linaro.org> References: <20250203144048.2131117-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::630; envelope-from=alex.bennee@linaro.org; helo=mail-ej1-x630.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 Mon Feb 3 14:40:46 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: 861568 Delivered-To: patch@linaro.org Received: by 2002:adf:fb05:0:b0:385:e875:8a9e with SMTP id c5csp2059197wrr; Mon, 3 Feb 2025 06:49:48 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXHKofXG+BhuJ9FgnE0FQwLJ+Nqwttk/pd9ZnqzxRTMjd7mu/WalN8ogoWFxBo1bMM1K9fjyg==@linaro.org X-Google-Smtp-Source: AGHT+IGXZGdrO47RDIx0eSqhcjI0J3vQRku9R8iUcqLWGBuCStOq5BHNilzBNob4+7msR7Xtlz/W X-Received: by 2002:a05:620a:4395:b0:7b6:d420:7883 with SMTP id af79cd13be357-7bffcd06747mr3155287285a.33.1738594188624; Mon, 03 Feb 2025 06:49:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1738594188; cv=none; d=google.com; s=arc-20240605; b=MyWsFileaHlbszNGacGok4VeK0ZoG6Bbzv3JW89zyqUMuF6DY3aRsn9PFE6AC1w7m3 8gmOcS1aXKlB3lTQmqkzc7JWB/XMk80mNtk/qoyn/f0A5fKp4uGALZ1DQydmG44Us2jg W3Gt7aeOijbVuzvROcCt7vSbda02nhiCQ/8dES+bojdv1x+CzIOUVErcfrAYBitTZHXN dp9fLZNXy7xMCiDqWSfoVY6Uzw6DqkChzhS6OqfEHbyAMq7R/7U+QNchvg5lNYjNLHVx sAowYByoZqSL1oKV8LDWkGisPV914eOcxC01xjh5JI4dpO1N59LZeCeWwVy9mK/8sWml SEkg== 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=oSJXNFQZRCHDVEQGzM+syjAcSIPFoBhiINu+GEymsjY=; b=E5D7L8t/sPatPPWh6Bf6U3wETfPCGUM6caMzQS7vGSNhLydXEIzOEZDVtGrKFyoDeq qt2IgyaK3N7gUW1WzfcMFfwSyXh4/1uSp5UvzbYVDgLJJEVeFtQHv2c93UhHm+AW6ZeT tR4VfkBNuLybHO1smF3xcGqVUulFF2MI9cRAXIPrlA1PeqsnVIkRG97mFKZxeVwe1EeW rqnLwlogxUlQ8oFrXyDRQgscV8OodP3ozgbMXv9gtGpmzPhuyBldZe/F5iAhOJhUmwwA HEcwRDJIF2dFaEVUbyTQSpEcV8OYDH9TpT9GVuR9pZX8s9dIOj0nufiphnNj8LpvI2hT vyMg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZJmmiEU2; 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 6a1803df08f44-6e41feb8dc5si2600126d6.247.2025.02.03.06.49.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 03 Feb 2025 06:49:48 -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=ZJmmiEU2; 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 1texlS-0000uF-Vk; Mon, 03 Feb 2025 09:49:31 -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 1texlN-0000qV-00 for qemu-devel@nongnu.org; Mon, 03 Feb 2025 09:49:25 -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 1texlJ-0003Hb-G5 for qemu-devel@nongnu.org; Mon, 03 Feb 2025 09:49:24 -0500 Received: by mail-ej1-x62d.google.com with SMTP id a640c23a62f3a-ab737e5674bso112591266b.1 for ; Mon, 03 Feb 2025 06:49:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1738594147; x=1739198947; 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=ZJmmiEU2YwO8sK8ZLu2i4XWkVHGOwJjSYb/KkJBq0O8xhynSIjoJFsOP5ZT/LwXx/Y htZnbgWh4HjGGwu52JTSk9gNHm/c6nFc0xd6G2Ben1p6bJ4fp2w+L/IKQiMZLgvrJG+j T7gSlaJ8WAbB9U29hKGg9tlh4bw9MQvAslEna7eBWi+nNLIRxu5dbPPwMOUyX7c+8S8B zDe2qocimYGbfvw5F0ld3Inw5OFQ0cv1UpAh4P3Y1F6CRo8bapurCVx4vydseGZfvjno 3DI4hghj69rNW8Uz257xo9Q0nNR966dv7hKz2+9iOWPx44LOoVR3VjZmI78Hk+TL2AKw B6Aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738594147; x=1739198947; 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=QyPqzmMfW1lG86Lq8AYX1AWj3883ib+goH1tXnCO/IiP9gaQpxr8MiknQBzdE29rUw E6FQR0KHqkK0wYz5gl1BRPkudA4by4iVEXGbKXV+viTVfWZsbHsNJHj533hwM4+mcCj2 WTpgQPBUDm3qRWVAA8A7xGAumkJLeuryjKafeFHXzfWKZM4mMQ3neecYCf+6chbsBOal nqmcTWm7lo4nQcn/mG8cCb91J6RPtNuKvsG9v1l9LeqjknyYJ2iMe4svyfZb8GgN2Eh8 ppYcV4+xwiCvD/xgXZ1ScRvexTNSnKMnHRur+PgeknpDhQedd+/G3gb65oHRlw18C6Sk 8dNA== X-Gm-Message-State: AOJu0Yxxxk0eOU66S4rKVSMoAKcabIA+/fdJM01A7yD038FDq6hxoZt7 tQA+7L0IQCimGLSUw+no1lOvaABWo6fMPcR73DrACkSf2XS+PFxcOoNUVz9UTC8= X-Gm-Gg: ASbGnctXehlU1BR2bRki2E1aVGIitBBFqrflNXBBNXiv1/dZKLJ6e8aaB+RjAF8NNiD GJLTZaG8KDLo/emPVZi71wEupr54LUPejynICmNvFyS5sUBS9a1wg3v0C7ylNaIW8XslnTKGL8P 6mi1LFxWkYP8Qw19k3wTAYqb3PlNrKuMO8wD0WT4LwYw7lKOfcaXhE3kqpPdEyEOX5Tl4YdMe69 t5+RJeYL++j401UVKTc610WJFGeuXwQxG5CI+JF6GY4BTnUKeo4xZc4wOOC4Z9Y5H+4UF2cYQTW /EogPwQmjG/THIwqVA== X-Received: by 2002:a17:907:72c1:b0:aa6:ab70:4a78 with SMTP id a640c23a62f3a-ab6cfda4254mr2919815166b.37.1738594147146; Mon, 03 Feb 2025 06:49:07 -0800 (PST) Received: from draig.lan ([185.126.160.109]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ab71166a8e0sm404508566b.158.2025.02.03.06.49.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Feb 2025 06:49:06 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 4D79B60C3D; Mon, 3 Feb 2025 14:40:50 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, Mahmoud Mandour , Thomas Huth , Daniel Henrique Barboza , Alistair Francis , =?utf-8?q?Alex_Benn=C3=A9e?= , Hao Wu , Peter Xu , Warner Losh , Pierrick Bouvier , qemu-arm@nongnu.org, Harsh Prateek Bora , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Palmer Dabbelt , Kyle Evans , Laurent Vivier , Riku Voipio , Bin Meng , qemu-rust@nongnu.org, Laurent Vivier , Liu Zhiwei , Weiwei Li , qemu-riscv@nongnu.org, Fabiano Rosas , Tyrone Ting , Paolo Bonzini , Nicholas Piggin , Alexandre Iooss , Ilya Leoshkevich Subject: [PATCH 16/18] docs/user: Document the %d placeholder and suspend=n QEMU_GDB features Date: Mon, 3 Feb 2025 14:40:46 +0000 Message-Id: <20250203144048.2131117-17-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250203144048.2131117-1-alex.bennee@linaro.org> References: <20250203144048.2131117-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: 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 Mon Feb 3 14:40:47 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: 861569 Delivered-To: patch@linaro.org Received: by 2002:adf:fb05:0:b0:385:e875:8a9e with SMTP id c5csp2059209wrr; Mon, 3 Feb 2025 06:49:50 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCU9yn+gm1z2fBI+QvF1ErMJtjBQudgl8erbcmo16s4x250yZbZf6zWMcDDElWYBfl0Wm7btmg==@linaro.org X-Google-Smtp-Source: AGHT+IEOfBGSGr7shMNRoIBJdWUK4V0dGL9R9Eb78YwetMlcpdo8LTRC0Qwtd4uGex25LRnqpDV+ X-Received: by 2002:ac8:57d1:0:b0:46c:74a2:3492 with SMTP id d75a77b69052e-46fd0b925ebmr318838831cf.41.1738594188562; Mon, 03 Feb 2025 06:49:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1738594188; cv=none; d=google.com; s=arc-20240605; b=KRCaQX6J4ZYiSWfH6ho1d0ijFm5W+W9yMCiXxayyeji6TFXvu/B7uTgJL6+JZ0AwLX gOWZEtWPYxnmWdq7guZiQQTsW1c96v2jb0kujLfLWo4qRSihwSvhyZJJfP7JAXLbVOa+ qr9LVUp7LrRrfcQPNyiaCpl+rECrKD6+r3qZiiZQjZpzxWiCFKo2vawjmS10iXZy8Fkh ohFjAPwj1qX67IhgntBmaVRzJKQmylgczmlIs3rSShg/Z6d190FdgwFBAVSna5+XptBT +NxWI4rKYE7pFzGeNwjIxG9Rj5p9SzM24NIFOSvWTcUJvLJTt6aYsbLeS2RvB2Ni/2j4 88rA== 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=oSJXNFQZRCHDVEQGzM+syjAcSIPFoBhiINu+GEymsjY=; b=RAg0jSg/N0+GgmUKETcfN8J6Fqf6h/gc2UWZdmKjoLE/UB5ak97xWUQ1WYDLSYPfgX XjQwRMmdGNs2WR2M4TP4rph8l6RFXUIQIs0ZmcaSOZpcKH1dqr3YFiAziHJzq3CLDlSG 3IED+0P3RmQYA1eAGgEnPQKk8MbUb75l147ruH+Ol8ZOYze6vmdtfhCqbw5HDiAz8FRe 39AZMeej5i0zSZpmfGJ6E9dKyWPijlYTID1NTi2ocVlP9kWAcSE7pENU+iz0vdOPYXy+ cZLLcV+m4HusWO1Y4Hg9di+yYRkz9Vqd5YCPUT+z93McajCFvOvfjTaTRLVdyhecRz24 Rw/Q==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=llWg49HQ; 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-47016b7dfd5si2546251cf.329.2025.02.03.06.49.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 03 Feb 2025 06:49:48 -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=llWg49HQ; 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 1texlR-0000ti-Sr; Mon, 03 Feb 2025 09:49:29 -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 1texlM-0000qO-At for qemu-devel@nongnu.org; Mon, 03 Feb 2025 09:49:25 -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 1texlH-0003H3-J8 for qemu-devel@nongnu.org; Mon, 03 Feb 2025 09:49:24 -0500 Received: by mail-ej1-x62b.google.com with SMTP id a640c23a62f3a-ab6fb2940d4so650067966b.1 for ; Mon, 03 Feb 2025 06:49:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1738594148; x=1739198948; 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=llWg49HQy7LIUgk0ureWH1hH7ychITM+21b+zGQ9yzmdGmqRViUBr0irDAHrJ4V0UV V5a6JeZuJWokCU+LOtF55WqN+QIbQT8uPcqvIlT0uKWzmmhqPSY0rTBatFjR/rYHnqmU rQ/Y4tXI9C909GlVi1bh/ZUF2gpFVEOXZBH3PupnVSZ5Fidu0RAJb+1BMaTO+4tsvtoN ujGMavj8W3GfS+L4gMzvqS5tHyw8G4Qo41IrSwEgT7AdZl+XAj3+C45KNCRcUtF4enwI WjMcqDuzo4weH5mund4uAcgNCxxpx5ZdHmvzj4zKDXxMNbbaaS14eR6irKactMWMhq3l 9Z5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738594148; x=1739198948; 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=CJdxxzV2kADjz55eMUnIrD1/IaQ+Hzq2+FD1vGDbcdmYwkpS5QfIwrOn+HiBahXu75 VnqOwQLqRAVsGeV9B4ta3B5eWwMEtBSfCeMN253c96l00ix+Br/16tVCUf8f0xvf1ifx fTqCad0XaeQw49REZmIeDVEpZZsE5p+pi51Fjv+IjmHPVLyU2XyFSiw/KPsJmNpAp2// f5dD8caF7JEMkBka8qkSuqd6sCSIlUV7hLql6c8bOzpq8ZhHpj/CSqLFjz+Pd6Xaop9B YUba5vJzGPjFUVjnwEw0YA5MeUeUygTLrC+GeOEYq74ucLKi+KxqtCpTfIRNjb65xmzS uJ2g== X-Gm-Message-State: AOJu0YyzKs1Ineb3fA4fdnpT2cuxq25qWV+Mieklqk2tPfpav18umh5N TYrNfvHdP7dZgKsTWUgvj6bh7hajqsm1KgB1aeJ1n6UlFwf6CfLTsh/rVQ93+Ys= X-Gm-Gg: ASbGncsACR4xc30XYM12rBHK+UDi+jFSyR2Q7624kFmfbgK3JWaEkX6mMKCw997fFPm SnZI0gC0nCsv4xg4MuWqJcHHPGQ6Z84GdxczBrDP+//m0iuY2PABqrJla/IMC2gxaAbwRqu/gBz NHMjP2b1Juc5NEcsqyGJmRld9ge9MP8pZKskmPsEOl4ipbM4q9hE7/ewTv2++HtXFsXuaf5ON/X 8uV8AM1EYlx6xO/6vAKlx6Es68Q9ybHtyuNivBKz51AaGiC6SpLOmhecaP/SzP24gMKd79BFRR8 shbiVJ6cK5gj4OvkHQ== X-Received: by 2002:a17:906:6a09:b0:aab:8311:951f with SMTP id a640c23a62f3a-ab6e0bc1e0fmr2196191966b.6.1738594147989; Mon, 03 Feb 2025 06:49:07 -0800 (PST) Received: from draig.lan ([185.126.160.109]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ab6e4a318fasm764533766b.134.2025.02.03.06.49.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Feb 2025 06:49:06 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 6901060E67; Mon, 3 Feb 2025 14:40:50 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, Mahmoud Mandour , Thomas Huth , Daniel Henrique Barboza , Alistair Francis , =?utf-8?q?Alex_Benn=C3=A9e?= , Hao Wu , Peter Xu , Warner Losh , Pierrick Bouvier , qemu-arm@nongnu.org, Harsh Prateek Bora , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Palmer Dabbelt , Kyle Evans , Laurent Vivier , Riku Voipio , Bin Meng , qemu-rust@nongnu.org, Laurent Vivier , Liu Zhiwei , Weiwei Li , qemu-riscv@nongnu.org, Fabiano Rosas , Tyrone Ting , Paolo Bonzini , Nicholas Piggin , Alexandre Iooss , Ilya Leoshkevich Subject: [PATCH 17/18] tests/tcg: Add late gdbstub attach test Date: Mon, 3 Feb 2025 14:40:47 +0000 Message-Id: <20250203144048.2131117-18-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250203144048.2131117-1-alex.bennee@linaro.org> References: <20250203144048.2131117-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=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) From patchwork Mon Feb 3 14:40:48 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: 861570 Delivered-To: patch@linaro.org Received: by 2002:adf:fb05:0:b0:385:e875:8a9e with SMTP id c5csp2059303wrr; Mon, 3 Feb 2025 06:50:03 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWaziO32MJ6B13ROEP+9BMR1Ryuj9oUT+BvzqwPjanZzZJ5q3dN9pGFVJGQaxoXvvWAuL0yEg==@linaro.org X-Google-Smtp-Source: AGHT+IF+23BSxQ4fOvTN8RHp6HsvdejP5mm/wZadvpa1AA/h9MrGS1om4gDMhMez3gbFjLhszdeB X-Received: by 2002:a05:622a:210:b0:460:a82a:39a8 with SMTP id d75a77b69052e-46fd0a97307mr349265621cf.13.1738594203289; Mon, 03 Feb 2025 06:50:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1738594203; cv=none; d=google.com; s=arc-20240605; b=GtxJBxo+Y9CNOuIa6KiyI6BVCvomVnBkQL0UAcoKaVd4PgN55EbAxU5FmzXhxhl51m 9MfFdA5Xu64nFDzgRfYxJs6LZBBUnd9qxqfYJZmXCoRjkaCzLhW+OD+VwDze9YoaAVir aE1Pv4Ko6cnKhQym8STpSfnD+GxwJOWUBJbJHZ0e4Y1mFP7Z1xEyRgDnDptBEgo4AU3s x2/i5J7OGfx2AWLuabnAVKc9iKZNzMdVgms4aGz9HuxfQFIY+QCkP7saZq0gk05m6jZF 7a6/G7P3Y7NdebbkMD5JYElLhd/UOqICJfy33Ca6PoeTiaX5nDpXh2GpUoiaSXNAEJdF OyhQ== 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=nWETF7v5SQvqoJsQUou+WYUPWgAQpGGIidnYpzh2j4Q=; fh=l5c3VrrUnXtFO8A4GZScGGXr9Dqhsjk7WtAV4wPkyzo=; b=Ka3EB4O6gGehVEpWcK8PzlLhG5W4CpbyNeeJa0QZ1F9pahyto9MgaeRdYMC3/XvwdS cll9LYWXpDUTRln3daF6ivk2Xm3T5v10eQ7m2e58RZPsNY/AbGCjWEL5HLrO1c8DRKOw hw/5h7frzKN12ju34H5kKcct+GzBF9zGu0ncAGZTQmbSJ/bDDYyiyS2MxZQdmIgICiJG tlX7T4cxPHT6TLXS13FMsqJWbQfHtAQmrltFu88Xi+acEniMxG5t7sM5fbL/9fLB+iAV KGFgCrz9rYvkWR9jlULwdPo0ZIxmDgf8PBY6UZzgUceRVdVyXVYiGzRS4aeoovWoPRRw Hpvw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HNSm6bRd; 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-470169f94f0si2688981cf.61.2025.02.03.06.50.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 03 Feb 2025 06:50:03 -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=HNSm6bRd; 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 1texlR-0000tX-Oz; Mon, 03 Feb 2025 09:49:29 -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 1texlK-0000pJ-Su for qemu-devel@nongnu.org; Mon, 03 Feb 2025 09:49:23 -0500 Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1texlH-0003HG-Nx for qemu-devel@nongnu.org; Mon, 03 Feb 2025 09:49:22 -0500 Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-aaf0f1adef8so856059066b.3 for ; Mon, 03 Feb 2025 06:49:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1738594148; x=1739198948; 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=nWETF7v5SQvqoJsQUou+WYUPWgAQpGGIidnYpzh2j4Q=; b=HNSm6bRdHGDDFxqkp3PlHuInutEPWBEk2K1Hfw+WbHURBlxDRcrnH+3RzDPKWdHb1F yWyZU5X/+R1SE65AsZQdIMvQYPJezx4R/3YkrZTl/fKVbX9KbeE3sLmie6ywPjtW27g8 uFE9TRtiGIKGKj5GpOvoN1uPXwYrFBO5rYqPsj4IKAC1Tmp4xonvbQKgBWSW2K8VjBpy XZU+tKVV90FGp1s/Hb+jaf7b8+/l5IAACDaZGXWRpG8vlKuSg5SJ92tWdNvEI0pCJ3Uk kE6o1OHLBfjC+zMA1RwB6IwKXWoF+IPCSoJVQBa1j5+lWSU+jS1I5I7aYaG89WOeEwQI 1iQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738594148; x=1739198948; 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=nWETF7v5SQvqoJsQUou+WYUPWgAQpGGIidnYpzh2j4Q=; b=PfTxAW/WWzRUOrwnhcQ0BPXMIgncCGPWqc99Y1tVp2oVSaMwn6x++jUscuwPee/ItO 6p2CrLV/SpHjq6Eo7GyC3dcX6Oewf8flXa5Vcu1qbFVZiRYOrpK5CHavyiJYligrozl2 SNK2MqvrboNggiUge4qQflY1c8TqYRdsGL4rU9sYGIQEczKsPsA9XBKgM9wGRoDA84nI 2ClTtaZDNi8U3HKlZBzY8fFgriwSik1Sq1qkbBnk7enk+l5l3efGLhhR4znJne91IWvF Kr0hSuAjJHqmiYhK4hwJZiGcxq9G/9MmyDTzr1WoGok8oLnsAywxAnKYa2mtsJwRAf01 HRGg== X-Gm-Message-State: AOJu0YzonstAYoB7Lh1SRr47HBks0ucSjMv6qpGKUJJYxn9LGCTGbPfV LSZBlAuY62Ka0yn7pCZ10pwfeTbS/DMdZlPZP4uqeB6Z89v2fbE2ZcZiA1edGQY= X-Gm-Gg: ASbGncsjw5S1rF4WeZJLxihQBHixOUArTBi+fmgZcOym3e5vnto2wD4pZOs2mXhe3i7 OHufkrpmV2WAL6xgWPh88EtYU0pkgbOJ3qnT9vBtR0LwkE99gzdmITnCdsHsAdk8MoQUgBZT6O5 fhLSThNF3vwHYEJbwyFCauCcBl2WlGvMqsTuTETkGDO7yfRoGwkWYO5cCfSmL/V6AICKQbRaqDz 0R8lyxgxKsLOopaySWWiA+y0kYaEaonY6yymCGa2nFwjmptVr6ULsbc2aNScyYd0j/7RUXEawWm XLT8XAiuW7NvpbZmfw== X-Received: by 2002:a17:907:6e92:b0:aae:8be7:ba07 with SMTP id a640c23a62f3a-ab6cfcdf5dfmr2398457766b.17.1738594147546; Mon, 03 Feb 2025 06:49:07 -0800 (PST) Received: from draig.lan ([185.126.160.109]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ab7106178ccsm412435466b.9.2025.02.03.06.49.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Feb 2025 06:49:06 -0800 (PST) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 8209F60F1B; Mon, 3 Feb 2025 14:40:50 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, Mahmoud Mandour , Thomas Huth , Daniel Henrique Barboza , Alistair Francis , =?utf-8?q?Alex_Benn=C3=A9e?= , Hao Wu , Peter Xu , Warner Losh , Pierrick Bouvier , qemu-arm@nongnu.org, Harsh Prateek Bora , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Palmer Dabbelt , Kyle Evans , Laurent Vivier , Riku Voipio , Bin Meng , qemu-rust@nongnu.org, Laurent Vivier , Liu Zhiwei , Weiwei Li , qemu-riscv@nongnu.org, Fabiano Rosas , Tyrone Ting , Paolo Bonzini , Nicholas Piggin , Alexandre Iooss , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= Subject: [PATCH 18/18] plugins: fix -Werror=maybe-uninitialized false-positive Date: Mon, 3 Feb 2025 14:40:48 +0000 Message-Id: <20250203144048.2131117-19-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250203144048.2131117-1-alex.bennee@linaro.org> References: <20250203144048.2131117-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62f; envelope-from=alex.bennee@linaro.org; helo=mail-ej1-x62f.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: Marc-André Lureau ../contrib/plugins/cache.c:638:9: error: ‘l2_cache’ may be used uninitialized [-Werror=maybe-uninitialized] 638 | append_stats_line(rep, l1_dmem_accesses, l1_dmisses, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Is a false-positive, since cores > 1, so the variable is set in the above loop. Signed-off-by: Marc-André Lureau Reviewed-by: Pierrick Bouvier Message-Id: <20250114104820.2613099-1-marcandre.lureau@redhat.com> Signed-off-by: Alex Bennée --- contrib/plugins/cache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/plugins/cache.c b/contrib/plugins/cache.c index 7baff86860..7cfd3df249 100644 --- a/contrib/plugins/cache.c +++ b/contrib/plugins/cache.c @@ -603,7 +603,7 @@ static int l2_cmp(gconstpointer a, gconstpointer b) static void log_stats(void) { int i; - Cache *icache, *dcache, *l2_cache; + Cache *icache, *dcache, *l2_cache = NULL; g_autoptr(GString) rep = g_string_new("core #, data accesses, data misses," " dmiss rate, insn accesses,"