From patchwork Thu Jun 20 15:22:09 2024 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: 805979 Delivered-To: patch@linaro.org Received: by 2002:a5d:508d:0:b0:362:4979:7f74 with SMTP id a13csp345524wrt; Thu, 20 Jun 2024 08:23:07 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV99fPMDCGy9rlJRlQitbeNm472MRUG9/BKRnyVwElMx0MJT0BC5qIFyN6laSbdh3GAAYh2U+zWU6TJ59FU4AQr X-Google-Smtp-Source: AGHT+IGvDytC2RAgCb0FLuyGHcNmFJe3OzjN+M0MDRz+8pgAz3d3m/CrBQcv6g7PytlrrJqaLKIU X-Received: by 2002:ac8:598a:0:b0:441:7e7:f540 with SMTP id d75a77b69052e-444a7a43296mr62464551cf.54.1718896986941; Thu, 20 Jun 2024 08:23:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1718896986; cv=none; d=google.com; s=arc-20160816; b=YFrQ7jATEWhsd14M/Ppdj/tpL/qGw198erUi70KCBycgqGANTkmdnagmr3sBoy/cDt Bd05J7qPNpoz+nzxk6hPg1+N4JLMvC+IYNtuIaG1r5+J/iZEbIkZuIbrmk5koOAQTNN+ TlDNvqOr0DpXzq10eJYtrmsVeQSzm+pYA6qD/FGsSv1P5BuYm6Uugoe45cPvSgBdaEdJ aDl9/CqIH02LjvHelAZ0DIty7ScFgkrnGyQQXVwY6gbTdU1Uyo8sC6BzDwc149c5d5Y2 UwEh1TxbK7FdpbtnDcv4YgnttvWKKel9wRwlQZXaO6RjzJoSespDEvJdT6xsDNhwvTU5 IjyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=2yimdE3nPFUILo7awwhHRy/OflE23PtwusH0HEIKw8g=; fh=qYUyA+SSE+X3fQR5X1u+SwltJ/ArWqMeAeFp+rGIm4A=; b=mL2QFpe0V6hayshlr7ojn9q/9kCbkGpT0caSmOkebuGWI/XgzOcarzxgf2wlp1n+JF GG3yOl8ahi09x/SRAqvSWu51epAKkxtR0M2vvAnOa+32mZiEPPRIZz5kbvBaITww+jG6 rD5dxIXRfwNx4xJeUuoLFpxUd2mUOK52sNvKWaP+TM42BGbQYtRE0+BOK6szIc/8NBzP L9/cusCMWPru+yGH9VS9SzI5gBe1Cei1rh5+gFd+ONjbzpEpm2sklA/DjFO7QU9pDJVN G/h/3yDNjpOQQ7RQOn54OGQs3tYzTc3Cpwn/Vdf0pno5Mw/cdfO/MmhBBWWZ1qvGeQhq riNw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=y8kGqvgm; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-441f2ea8c63si171614771cf.328.2024.06.20.08.23.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Jun 2024 08:23:06 -0700 (PDT) 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=y8kGqvgm; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sKJcK-0005lv-Gr; Thu, 20 Jun 2024 11:22:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sKJcJ-0005kw-Jf for qemu-devel@nongnu.org; Thu, 20 Jun 2024 11:22:27 -0400 Received: from mail-ed1-x533.google.com ([2a00:1450:4864:20::533]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sKJcH-0007uU-RX for qemu-devel@nongnu.org; Thu, 20 Jun 2024 11:22:27 -0400 Received: by mail-ed1-x533.google.com with SMTP id 4fb4d7f45d1cf-57cf8880f95so1162321a12.3 for ; Thu, 20 Jun 2024 08:22:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718896944; x=1719501744; 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=2yimdE3nPFUILo7awwhHRy/OflE23PtwusH0HEIKw8g=; b=y8kGqvgmunhoK6+Qx6ouVwHXfJobJfIzSioXKnjErGdhu6UH6m8nHOu5JvnIorlU+Y yVdug8rmWHpMqqKF2RQ9CY+HB+VYs1EKQH1q4TwLNKm87IEGurQRuOcHDHL2a5zYZCEn QPujWboLvLqe2KCp9UFhkWi9F+KEpwG6gFaz8shEzbcJWcsrsl4j/FU/69MPMZVXEeF9 JXA6KGtze5YMVk6MYmdheGqXiiAYEjXzto6oNhdcXXdvojCFEB1afJRTv0HmlfxT6v4e hTbfhNnitErRXaYd6VnUSAMgsdwNqT4inE/sDOEwKx0k7VdSX6U0y2YuMRMe97zmEIH8 zjAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718896944; x=1719501744; 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=2yimdE3nPFUILo7awwhHRy/OflE23PtwusH0HEIKw8g=; b=tdevPXixjhbXFEjB2H/c0pTIjw7DqLFUCErbV6/TDQ4oFghtVXNN6uSIzN08KFZbMc j5Q0MKBGSomwN6a1xxE/DgPPNI8aWSYDNC5qtRMGdti9XXcUEBnt6LaALNdvYoA4bHbD uXYyVLvrQoNeUjf54j47kNgSToJGBbfqAcK5SMfoeruzPfp2c76Vqsx/LOe15l2mgVAh sEB3zypWMuTymnde6a08wqn6WTzonelvzJ7C2mdAMxnOWwtGKT2DqcncoiPQJjE4hYBK HrDQkIyXZ6T+jxAvCgfvnqbe/Hoib7EM2+u/IFCFx9FuxrmnvmMvwIlJRe7FrAjFMJNh k2FA== X-Gm-Message-State: AOJu0YwGF2HddK2R7S08wQLKkyy+q5Fg+cRXUDacO6NpOwxD6Tt+f/fw VmgHSJm4lPjNnLD6nWsPkFy5fh3m4GOU1kPDvhhOgKxeigcxsRSJTfXYadEgDtA= X-Received: by 2002:a50:8704:0:b0:57d:3ea:3862 with SMTP id 4fb4d7f45d1cf-57d07ed410dmr4532022a12.27.1718896943048; Thu, 20 Jun 2024 08:22:23 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-57d21df986esm1006464a12.72.2024.06.20.08.22.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jun 2024 08:22:22 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 137115F892; Thu, 20 Jun 2024 16:22:21 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Peter Maydell , kvm@vger.kernel.org, qemu-ppc@nongnu.org, Christian Borntraeger , Paolo Bonzini , Jamie Iles , David Hildenbrand , =?utf-8?q?Alex_Benn=C3=A9e?= , Pierrick Bouvier , Mark Burton , Daniel Henrique Barboza , qemu-arm@nongnu.org, Laurent Vivier , Alexander Graf , Ilya Leoshkevich , Richard Henderson , Marco Liebel , Halil Pasic , Thomas Huth , qemu-s390x@nongnu.org, Cameron Esfahani , Alexandre Iooss , Nicholas Piggin , Roman Bolshakov , "Dr. David Alan Gilbert" , Marcelo Tosatti , Mahmoud Mandour , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PATCH v2 01/12] include/exec: add missing include guard comment Date: Thu, 20 Jun 2024 16:22:09 +0100 Message-Id: <20240620152220.2192768-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240620152220.2192768-1-alex.bennee@linaro.org> References: <20240620152220.2192768-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::533; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-x533.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 Message-Id: <20240612153508.1532940-2-alex.bennee@linaro.org> Reviewed-by: Pierrick Bouvier Signed-off-by: Alex Bennée --- include/exec/gdbstub.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/exec/gdbstub.h b/include/exec/gdbstub.h index eb14b91139..008a92198a 100644 --- a/include/exec/gdbstub.h +++ b/include/exec/gdbstub.h @@ -144,4 +144,4 @@ void gdb_set_stop_cpu(CPUState *cpu); /* in gdbstub-xml.c, generated by scripts/feature_to_c.py */ extern const GDBFeature gdb_static_features[]; -#endif +#endif /* GDBSTUB_H */ From patchwork Thu Jun 20 15:22:10 2024 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: 805982 Delivered-To: patch@linaro.org Received: by 2002:a5d:508d:0:b0:362:4979:7f74 with SMTP id a13csp345833wrt; Thu, 20 Jun 2024 08:23:48 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXHet7KKjJvXyfMTHNZ37c4ZWUo5a0Qam+8mARjh9qrQimXmGsP4PfV6Gr9eqeNLSkbKDlEMQmPKSEndFm10/YO X-Google-Smtp-Source: AGHT+IEEE7Kxu6pS0hM8DrUmheKuAp8tNgCfhZygHb0BgM1DW8gQG7lfLJ9xibneQ0a3cQ1DO0VK X-Received: by 2002:a05:622a:490:b0:441:322:af8b with SMTP id d75a77b69052e-444a79ababcmr72015391cf.14.1718897027087; Thu, 20 Jun 2024 08:23:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1718897027; cv=none; d=google.com; s=arc-20160816; b=NdcVtdtpSnW4DbeJrfas28HupwUINgjU4OWOanX3nq+D2Xnc6xMnOXYSGSNJ0UrlAu LNLW0F7gNRabfTK011aP4nmYElS+7xaTQTejmOkzfkPuFbAGjj45FOrIRYlyAKNYtnJo eLFwotwFKnzfzMaYljtyNQBAMYRTPoFRXMY8Bfw0TlRYCs3/YmSzqO9vaxlpFwnmdAof WY5ptoL5ACPT22p9J5MsKXLSIYM7+9/7TFmWpBrlGLVruo7tztCBMkhSmd/aYhepzNYs Yx1oc7eUUm0IXBCPYUpIw1fuLik2r3UQBqGTY2pcblT6foCJRzYEkKk52FT7o8ooi7d1 ST9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=LOX8Q5w9ilc+mTdUjLpvpvMTTAOVE9Tn6EBHwdgleNg=; fh=qYUyA+SSE+X3fQR5X1u+SwltJ/ArWqMeAeFp+rGIm4A=; b=In/3Q8GP83SQT4rT//d4JOXbLnt4m+Rv4t/26/jMcJzjnxA2SlF46tKvI1Jlgblf6d gwaJQcOFyOm7/OCjrh8NuIythU4/fEXrbwiiKhD2iv0xZz+0A3Q6wXhZ7gnujEJ7A4wO 8ZZsL6BFLOrukNxO0wWimdjnESd/rpRAPYMwxTBWwUigAh9p3xxZ8IZ8UBm7gRztitiE nQNXCYgH98euFOABGHrAy6Y+ikxFzb6jV/FnCAYhiLcfrRGEIxwTW0oEG11RBjAIHKPV NXXJPZtpD7vTkB6B/7chTPehNx0sb++AMm8YZYc7cwW+48M1zmHPQigPac7FqHbVeecS nRpg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JhgrPMpc; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-441ef3dc489si188224061cf.217.2024.06.20.08.23.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Jun 2024 08:23:47 -0700 (PDT) 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=JhgrPMpc; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sKJcL-0005np-VA; Thu, 20 Jun 2024 11:22:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sKJcK-0005m4-Pe for qemu-devel@nongnu.org; Thu, 20 Jun 2024 11:22:28 -0400 Received: from mail-ed1-x52b.google.com ([2a00:1450:4864:20::52b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sKJcH-0007uj-Uq for qemu-devel@nongnu.org; Thu, 20 Jun 2024 11:22:28 -0400 Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-57cfe600cbeso1199997a12.2 for ; Thu, 20 Jun 2024 08:22:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718896944; x=1719501744; 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=LOX8Q5w9ilc+mTdUjLpvpvMTTAOVE9Tn6EBHwdgleNg=; b=JhgrPMpcw9MvfOis0ZG6VkQ1Yu3mR8A2YHgcNN/MIMGxJmCpWWjTisS/dhHjufWzvb U35BxPASPl9+nta7CTxxwuyud8RkPd7Gz6udYw2rde9N8Kmlv6VcXvJfYfs9140zWM5E rNDKcta/kbF0HVwgvi0vuVGeuULHQB6KDfqpCJAbYn/Vj0um0ksCll0+m+FeB3oxsyry z5LBiwvHPAoQXT1A4Kh4j+DUJAcxWWuMgciSnpyLpA0/t6sh3n6o0UzBAUV1oLq3hJpw dst/+tvd56PzzfmAaQHVEujHDsEvWa0Q3V6LeLW5tuFrKr0m0p+vSdYUhBJS03AY87IE It9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718896944; x=1719501744; 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=LOX8Q5w9ilc+mTdUjLpvpvMTTAOVE9Tn6EBHwdgleNg=; b=H4cMaZ88Y7tgbMT62iAqmmCKqfz55R+FoEr0Qfbw0Sk814TegrlGLKSOMt0gd7BJjR 8y9GwWcG3CrbSf2r7qV10USImI5BuKI2UCWcbCQq6e6UQkTkndli4qiUBYjT6sEJIqHr vkuAmQfrEATpcvap8A/ScVps0TodHlzb6+LGFVyvGlFEVyjncV0gVomT3cOxieRTAgFw QvDKWN/7coqlHPvg6pyzF/4S/UjFdIZuQckuCIghMgwu0pg7OmC40Qvd7lRC17VIykcd RIXDHC4X44MPbGTSY7CEZWcjKoXKDjMwClt9C/Om0ePuIQvS59F7ehL17kgE/v+O+iqS lYog== X-Gm-Message-State: AOJu0YzRv6OtWj3M0j7AExS5+EJIPOItzGEIPVmk30J4IkoJidRrQfU9 zgpB0zvg6LDSsYhzPsSBX+6FYusOdm+a545OuBSh6KTZQWklPcvqzefq2haK+O4= X-Received: by 2002:a17:906:d8a:b0:a6f:4c90:7951 with SMTP id a640c23a62f3a-a6fab60bcc3mr306422166b.8.1718896943901; Thu, 20 Jun 2024 08:22:23 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a6f56ecd5bfsm774823766b.113.2024.06.20.08.22.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jun 2024 08:22:22 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 3A38F5F9F3; Thu, 20 Jun 2024 16:22:21 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Peter Maydell , kvm@vger.kernel.org, qemu-ppc@nongnu.org, Christian Borntraeger , Paolo Bonzini , Jamie Iles , David Hildenbrand , =?utf-8?q?Alex_Benn=C3=A9e?= , Pierrick Bouvier , Mark Burton , Daniel Henrique Barboza , qemu-arm@nongnu.org, Laurent Vivier , Alexander Graf , Ilya Leoshkevich , Richard Henderson , Marco Liebel , Halil Pasic , Thomas Huth , qemu-s390x@nongnu.org, Cameron Esfahani , Alexandre Iooss , Nicholas Piggin , Roman Bolshakov , "Dr. David Alan Gilbert" , Marcelo Tosatti , Mahmoud Mandour , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PATCH v2 02/12] gdbstub: move enums into separate header Date: Thu, 20 Jun 2024 16:22:10 +0100 Message-Id: <20240620152220.2192768-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240620152220.2192768-1-alex.bennee@linaro.org> References: <20240620152220.2192768-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::52b; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-x52b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=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 is an experiment to further reduce the amount we throw into the exec headers. It might not be as useful as I initially thought because just under half of the users also need gdbserver_start(). Message-Id: <20240612153508.1532940-3-alex.bennee@linaro.org> Reviewed-by: Pierrick Bouvier Signed-off-by: Alex Bennée --- include/exec/gdbstub.h | 9 --------- include/gdbstub/enums.h | 21 +++++++++++++++++++++ accel/hvf/hvf-accel-ops.c | 2 +- accel/kvm/kvm-all.c | 2 +- accel/tcg/tcg-accel-ops.c | 2 +- gdbstub/user.c | 1 + monitor/hmp-cmds.c | 3 ++- system/vl.c | 1 + target/arm/hvf/hvf.c | 2 +- target/arm/hyp_gdbstub.c | 2 +- target/arm/kvm.c | 2 +- target/i386/kvm/kvm.c | 2 +- target/ppc/kvm.c | 2 +- target/s390x/kvm/kvm.c | 2 +- 14 files changed, 34 insertions(+), 19 deletions(-) create mode 100644 include/gdbstub/enums.h diff --git a/include/exec/gdbstub.h b/include/exec/gdbstub.h index 008a92198a..1bd2c4ec2a 100644 --- a/include/exec/gdbstub.h +++ b/include/exec/gdbstub.h @@ -1,15 +1,6 @@ #ifndef GDBSTUB_H #define GDBSTUB_H -#define DEFAULT_GDBSTUB_PORT "1234" - -/* GDB breakpoint/watchpoint types */ -#define GDB_BREAKPOINT_SW 0 -#define GDB_BREAKPOINT_HW 1 -#define GDB_WATCHPOINT_WRITE 2 -#define GDB_WATCHPOINT_READ 3 -#define GDB_WATCHPOINT_ACCESS 4 - typedef struct GDBFeature { const char *xmlname; const char *xml; diff --git a/include/gdbstub/enums.h b/include/gdbstub/enums.h new file mode 100644 index 0000000000..c4d54a1d08 --- /dev/null +++ b/include/gdbstub/enums.h @@ -0,0 +1,21 @@ +/* + * gdbstub enums + * + * Copyright (c) 2024 Linaro Ltd + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef GDBSTUB_ENUMS_H +#define GDBSTUB_ENUMS_H + +#define DEFAULT_GDBSTUB_PORT "1234" + +/* GDB breakpoint/watchpoint types */ +#define GDB_BREAKPOINT_SW 0 +#define GDB_BREAKPOINT_HW 1 +#define GDB_WATCHPOINT_WRITE 2 +#define GDB_WATCHPOINT_READ 3 +#define GDB_WATCHPOINT_ACCESS 4 + +#endif /* GDBSTUB_ENUMS_H */ diff --git a/accel/hvf/hvf-accel-ops.c b/accel/hvf/hvf-accel-ops.c index b2a37a2229..ac08cfb9f3 100644 --- a/accel/hvf/hvf-accel-ops.c +++ b/accel/hvf/hvf-accel-ops.c @@ -52,7 +52,7 @@ #include "qemu/main-loop.h" #include "exec/address-spaces.h" #include "exec/exec-all.h" -#include "exec/gdbstub.h" +#include "gdbstub/enums.h" #include "sysemu/cpus.h" #include "sysemu/hvf.h" #include "sysemu/hvf_int.h" diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c index 854cb86b22..2b4ab89679 100644 --- a/accel/kvm/kvm-all.c +++ b/accel/kvm/kvm-all.c @@ -27,7 +27,7 @@ #include "hw/pci/msi.h" #include "hw/pci/msix.h" #include "hw/s390x/adapter.h" -#include "exec/gdbstub.h" +#include "gdbstub/enums.h" #include "sysemu/kvm_int.h" #include "sysemu/runstate.h" #include "sysemu/cpus.h" diff --git a/accel/tcg/tcg-accel-ops.c b/accel/tcg/tcg-accel-ops.c index 1433e38f40..3c19e68a79 100644 --- a/accel/tcg/tcg-accel-ops.c +++ b/accel/tcg/tcg-accel-ops.c @@ -35,7 +35,7 @@ #include "exec/exec-all.h" #include "exec/hwaddr.h" #include "exec/tb-flush.h" -#include "exec/gdbstub.h" +#include "gdbstub/enums.h" #include "hw/core/cpu.h" diff --git a/gdbstub/user.c b/gdbstub/user.c index edeb72efeb..e34b58b407 100644 --- a/gdbstub/user.c +++ b/gdbstub/user.c @@ -18,6 +18,7 @@ #include "exec/gdbstub.h" #include "gdbstub/syscalls.h" #include "gdbstub/user.h" +#include "gdbstub/enums.h" #include "hw/core/cpu.h" #include "trace.h" #include "internals.h" diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c index 45ee3a9e1f..f601d06ab8 100644 --- a/monitor/hmp-cmds.c +++ b/monitor/hmp-cmds.c @@ -15,8 +15,9 @@ #include "qemu/osdep.h" #include "exec/address-spaces.h" -#include "exec/gdbstub.h" #include "exec/ioport.h" +#include "exec/gdbstub.h" +#include "gdbstub/enums.h" #include "monitor/hmp.h" #include "qemu/help_option.h" #include "monitor/monitor-internal.h" diff --git a/system/vl.c b/system/vl.c index a3eede5fa5..cfcb674425 100644 --- a/system/vl.c +++ b/system/vl.c @@ -68,6 +68,7 @@ #include "sysemu/numa.h" #include "sysemu/hostmem.h" #include "exec/gdbstub.h" +#include "gdbstub/enums.h" #include "qemu/timer.h" #include "chardev/char.h" #include "qemu/bitmap.h" diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c index 45e2218be5..ef9bc42738 100644 --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -33,7 +33,7 @@ #include "trace/trace-target_arm_hvf.h" #include "migration/vmstate.h" -#include "exec/gdbstub.h" +#include "gdbstub/enums.h" #define MDSCR_EL1_SS_SHIFT 0 #define MDSCR_EL1_MDE_SHIFT 15 diff --git a/target/arm/hyp_gdbstub.c b/target/arm/hyp_gdbstub.c index ebde2899cd..f120d55caa 100644 --- a/target/arm/hyp_gdbstub.c +++ b/target/arm/hyp_gdbstub.c @@ -12,7 +12,7 @@ #include "qemu/osdep.h" #include "cpu.h" #include "internals.h" -#include "exec/gdbstub.h" +#include "gdbstub/enums.h" /* Maximum and current break/watch point counts */ int max_hw_bps, max_hw_wps; diff --git a/target/arm/kvm.c b/target/arm/kvm.c index 7cf5cf31de..70f79eda33 100644 --- a/target/arm/kvm.c +++ b/target/arm/kvm.c @@ -31,7 +31,7 @@ #include "hw/pci/pci.h" #include "exec/memattrs.h" #include "exec/address-spaces.h" -#include "exec/gdbstub.h" +#include "gdbstub/enums.h" #include "hw/boards.h" #include "hw/irq.h" #include "qapi/visitor.h" diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c index 7ad8072748..dd8b0f3313 100644 --- a/target/i386/kvm/kvm.c +++ b/target/i386/kvm/kvm.c @@ -38,7 +38,7 @@ #include "hyperv.h" #include "hyperv-proto.h" -#include "exec/gdbstub.h" +#include "gdbstub/enums.h" #include "qemu/host-utils.h" #include "qemu/main-loop.h" #include "qemu/ratelimit.h" diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c index 005f2239f3..2c3932200b 100644 --- a/target/ppc/kvm.c +++ b/target/ppc/kvm.c @@ -39,7 +39,7 @@ #include "migration/qemu-file-types.h" #include "sysemu/watchdog.h" #include "trace.h" -#include "exec/gdbstub.h" +#include "gdbstub/enums.h" #include "exec/memattrs.h" #include "exec/ram_addr.h" #include "sysemu/hostmem.h" diff --git a/target/s390x/kvm/kvm.c b/target/s390x/kvm/kvm.c index 1b494ecc20..94181d9281 100644 --- a/target/s390x/kvm/kvm.c +++ b/target/s390x/kvm/kvm.c @@ -40,7 +40,7 @@ #include "sysemu/hw_accel.h" #include "sysemu/runstate.h" #include "sysemu/device_tree.h" -#include "exec/gdbstub.h" +#include "gdbstub/enums.h" #include "exec/ram_addr.h" #include "trace.h" #include "hw/s390x/s390-pci-inst.h" From patchwork Thu Jun 20 15:22:11 2024 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: 805988 Delivered-To: patch@linaro.org Received: by 2002:a5d:508d:0:b0:362:4979:7f74 with SMTP id a13csp346281wrt; Thu, 20 Jun 2024 08:24:42 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXayem3SBXAzC3ofLVx6Vi71ytNQLPRA2XJfUL8GvXcf5q5Ap+igihJruRnOh2ryFLfg8HAioRYkAx/+y9T5zOa X-Google-Smtp-Source: AGHT+IHHRFViHUj7Tt1Pr3MfGKp2yeXROux6d+RDGgXclvtfZOCmRcUcLDqWNQQ7yPR20BRHviVw X-Received: by 2002:a05:622a:13d0:b0:43e:3c64:d3ed with SMTP id d75a77b69052e-444a79e16ecmr74158671cf.32.1718897081740; Thu, 20 Jun 2024 08:24:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1718897081; cv=none; d=google.com; s=arc-20160816; b=nFXde5KIdWnrUSZozmXj3HJ6ERA9Rzh7A6KQea5+V1WVFtfRV/+6xb6rRoLjBLY7BG i048RF0CVZqDZw6w3UMmZdVWR2L2sYuV9Msi+evaTeJHy2xHKdbScdyBvKb0Qo7PJD2D 91U7wDD+hKAFmsyYlrS4/MGWz3XXdZowMLOIW3ufVys8U4NSEwnEh0YihT7Zqf/d+MZQ iU98Ho8cFG5SvCq7o37XDv5mTyYJaU91euHzDUkjSoU6nfBbRhMqTmdoFGguI7ARrk7Q 9rM+aMA0LgDbFe2ljQS0CyGdb2nsvXhB1FyESihYL9ZsHuQ3LOD8gvb9THdsrjO+RrPW tpkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=GJDItK1lJ7pU44CkysDABVIUb9quWUurAs3tDshcfJY=; fh=SR5xYl9zGhRHiWMHH7Y+z31fb0W/ZK3xNQA1gYblpLU=; b=eRmvqgXajrBt5b3IVGTZVNDz4EVIBGYYP8/vAChToWqq2dInOFp9QRgk6qvu5T6EfA qOzduKHQdBTHvp0NsIcTapgxRbvHgi40TgAC6nMCaaZ+rwlEIqlx/nCVemtlmoLUWTx1 XXnDsSagBZkLAiFAk2XL7Hlas4gQtv68Hs9bcs3jsaPxf5PYXdG7NsDPnlO0ruA34oYk Hm1hCglpC9iky9EBqpjDuP34KG2zWJKgehIjyvfbQjprK2InkU7iPLQpxanVXzouOdFE ix9JWmycjmvia0Lrtl6LRIrWxZFtlHtQHYoA95iobhchHxRiv2C8AFXJeNem0QcQycZW g6Zg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JQ9QJAAF; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-441f2ff772bsi168158141cf.621.2024.06.20.08.24.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Jun 2024 08:24:41 -0700 (PDT) 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=JQ9QJAAF; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sKJcP-0005pv-Bb; Thu, 20 Jun 2024 11:22:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sKJcN-0005of-8c for qemu-devel@nongnu.org; Thu, 20 Jun 2024 11:22:31 -0400 Received: from mail-ed1-x531.google.com ([2a00:1450:4864:20::531]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sKJcL-0007x7-KX for qemu-devel@nongnu.org; Thu, 20 Jun 2024 11:22:30 -0400 Received: by mail-ed1-x531.google.com with SMTP id 4fb4d7f45d1cf-57d15b85a34so1204595a12.3 for ; Thu, 20 Jun 2024 08:22:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718896948; x=1719501748; 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=GJDItK1lJ7pU44CkysDABVIUb9quWUurAs3tDshcfJY=; b=JQ9QJAAFPFPmroROCjiWION6Zc+40YqR1RJTI5pKkcc2/e188KLCYZ/MBLnC0Qvvd7 1drXd2pKKoA4PATTo5kRPcJlYLy+o4zx39Y67L9I1MejolRIU7hThnDUplijKN8/f6JF rMZGOzvk84yHiC6GYfw2baJMwtYJgtXs35Mp7m0oh9LCkrG5j4SB3LFYbZaxAbYGrgo4 FHUuIucSxDZ02a7SuI4jI8GnqZMPuqVNRg/PsflfpWsn1T2n9xm01tMMnCGGtG8EY08R Fzkvy9v8HdumUPYQjprRgd8JR2C7VH5v1jmT/PnP/YJ5NT5LUNApraM1u6dfK8SgeyFm n1WQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718896948; x=1719501748; 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=GJDItK1lJ7pU44CkysDABVIUb9quWUurAs3tDshcfJY=; b=sTPaWE6995LyT2JaV1AbGahJrcXmVANcqJjLQYKWzsUEZFjxTeddrjozmGqTl2ivVs crFvLzESCUkPsohgo9IJuEbYHXqmvDXoKK0BnEMPilstNue2ctzGo3dX5J6sbW3HcSvY SqVkhhbXHtD6qooN6s06vZ3yZHpGtdYIllhtmZ0ZgIFIOpGJ5VRZXtd0DEpdzl0Vqg6v 8nPc+Vp+BhWhN8k7xbMp6eO5xPswBizbRKSPmABhmfb2bQzuFpVDSNv9sWdWDR1/zgf1 e82q1A+8AnijiNibyrD+ZguxATTxDviAT4MOBJLUVJlV2/kbyPVlh84EQyCNnRBHnJ38 UHew== X-Gm-Message-State: AOJu0YyefX0ISJyFHJy7XKbwywugBm8nwP8c/rKQ58WdErJT7YeJYX5h K2PpeDDMQeqp+EZEVhixaVV2DV8iXq4CUN90TKgPNcP0hRYYiMD463BVjsTKOf0= X-Received: by 2002:a50:cd97:0:b0:57d:61a:7f20 with SMTP id 4fb4d7f45d1cf-57d07e6ba6cmr3862286a12.3.1718896948159; Thu, 20 Jun 2024 08:22:28 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-57d16160c18sm1609800a12.26.2024.06.20.08.22.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jun 2024 08:22:22 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 51EE45F9F4; Thu, 20 Jun 2024 16:22:21 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Peter Maydell , kvm@vger.kernel.org, qemu-ppc@nongnu.org, Christian Borntraeger , Paolo Bonzini , Jamie Iles , David Hildenbrand , =?utf-8?q?Alex_Benn=C3=A9e?= , Pierrick Bouvier , Mark Burton , Daniel Henrique Barboza , qemu-arm@nongnu.org, Laurent Vivier , Alexander Graf , Ilya Leoshkevich , Richard Henderson , Marco Liebel , Halil Pasic , Thomas Huth , qemu-s390x@nongnu.org, Cameron Esfahani , Alexandre Iooss , Nicholas Piggin , Roman Bolshakov , "Dr. David Alan Gilbert" , Marcelo Tosatti , Mahmoud Mandour , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Akihiko Odaki Subject: [PATCH v2 03/12] plugins: Ensure register handles are not NULL Date: Thu, 20 Jun 2024 16:22:11 +0100 Message-Id: <20240620152220.2192768-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240620152220.2192768-1-alex.bennee@linaro.org> References: <20240620152220.2192768-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::531; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-x531.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Akihiko Odaki Ensure register handles are not NULL so that a plugin can assume NULL is invalid as a register handle. Signed-off-by: Akihiko Odaki Reviewed-by: Pierrick Bouvier Message-Id: <20240612153508.1532940-4-alex.bennee@linaro.org> Message-Id: <20240229-null-v1-1-e716501d981e@daynix.com> Signed-off-by: Alex Bennée --- plugins/api.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/api.c b/plugins/api.c index 5a0a7f8c71..6bdb26bbe3 100644 --- a/plugins/api.c +++ b/plugins/api.c @@ -507,7 +507,7 @@ static GArray *create_register_handles(GArray *gdbstub_regs) } /* Create a record for the plugin */ - desc.handle = GINT_TO_POINTER(grd->gdb_reg); + desc.handle = GINT_TO_POINTER(grd->gdb_reg + 1); desc.name = g_intern_string(grd->name); desc.feature = g_intern_string(grd->feature_name); g_array_append_val(find_data, desc); @@ -528,7 +528,7 @@ int qemu_plugin_read_register(struct qemu_plugin_register *reg, GByteArray *buf) { g_assert(current_cpu); - return gdb_read_register(current_cpu, buf, GPOINTER_TO_INT(reg)); + return gdb_read_register(current_cpu, buf, GPOINTER_TO_INT(reg) - 1); } struct qemu_plugin_scoreboard *qemu_plugin_scoreboard_new(size_t element_size) From patchwork Thu Jun 20 15:22:12 2024 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: 805987 Delivered-To: patch@linaro.org Received: by 2002:a5d:508d:0:b0:362:4979:7f74 with SMTP id a13csp346180wrt; Thu, 20 Jun 2024 08:24:30 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWyGGySfdJG5TB6zVpFESSid0yGGYfssVr5xh0kz1FTks4avgN8uSF04VHmV2CMLVMI25NWZRA5igwwmL2JzXZK X-Google-Smtp-Source: AGHT+IEiwyvWEu6aDZTy56rG6DJK96y9bHdmaPKQIQIX97uRO8kG3KhRTZh+NIpwuU9pzINtCmL2 X-Received: by 2002:a05:620a:40c7:b0:797:a485:28e5 with SMTP id af79cd13be357-79bb3e120cdmr664192885a.7.1718897070695; Thu, 20 Jun 2024 08:24:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1718897070; cv=none; d=google.com; s=arc-20160816; b=rQTD+E29k+RxjpqkMmTPFQ7W4bXVfQYNX2lxPIP1TK4mKtkx2wX57BpGTUlAsns41G erm4cB9LqaW9yDOqiq1khdkTt4KLXVpcx+2S0Kvr9EhW7gnB3nLEmaj5vAOkhukjXlGg bugT1abDohYL6RIol/q9gA5/mJqtU1VIvIgCDw8r9fW2GMyQcg1o+FH5xJnAN3U05zi+ afTtbxbf5DHXeC8Zrx4DHHxdupHCuG6xzssuEyrbQyUllgPbg+iJQCC7R90IBoRcsb5P BNtYKW1VNSo7JUMhAxM1Qe7B1uCAqFOuh7lMlRYOYYtHTVxKC3GJHvl8OGAph13uCTgO P3ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=/X0IxOQD+UVox1iqgN/w4twKxD3yeUu+cfpZug2C5Oo=; fh=qYUyA+SSE+X3fQR5X1u+SwltJ/ArWqMeAeFp+rGIm4A=; b=TExKeZJ6rvr+3caqvEbrpaZN9Hf//uFv1B4F27X//0kEMUoV538eYDDcVQt0LMomhn THTO4zzdL/mDrZCh7K+9YOX52blobhQXPFbzOHfhwUUXEXRY/stuEi8N7RU8Xev6GVdo wOTretCfWKPfVMlC8+pQ1NxadsIwiK+c4awYC5bXa5NqHv2YtlUuh4Y8RdmF10HP+mLD Jypa0Yz5hrvd2sMViFZIZWcQLhkPnL9xfOpfnqXWOItEE9+xJ2WIDg/yCC+cnLCvbM6T YSGTgzIvSIMWTyjfUnQdUxMyJl8J6/s39emS7oGOfEZOpdVGEJmEYw0KosopYPnzF73R Z+aQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=H0tVDB9+; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-798aac9bd7esi1668320785a.148.2024.06.20.08.24.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Jun 2024 08:24:30 -0700 (PDT) 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=H0tVDB9+; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sKJcQ-0005qW-Fe; Thu, 20 Jun 2024 11:22:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sKJcO-0005p8-Te for qemu-devel@nongnu.org; Thu, 20 Jun 2024 11:22:32 -0400 Received: from mail-ed1-x531.google.com ([2a00:1450:4864:20::531]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sKJcM-0007xk-NE for qemu-devel@nongnu.org; Thu, 20 Jun 2024 11:22:32 -0400 Received: by mail-ed1-x531.google.com with SMTP id 4fb4d7f45d1cf-57d0eca877cso1157638a12.2 for ; Thu, 20 Jun 2024 08:22:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718896949; x=1719501749; 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=/X0IxOQD+UVox1iqgN/w4twKxD3yeUu+cfpZug2C5Oo=; b=H0tVDB9+7kuD8x7uXDZ79zkZgHFwKgo82FgNOgxBZ0KNBryUNvMD//aLkrmHsM2Gl+ jy3895wUQ5FBqREJ08qbmwCOJ0GHUL07CJltkP2wXov/mwms21hkCKNjJBcdlRJI1crL rbiHBDyrsQ+yhYPk1XAWIm6R96q8afNxeO8z7xjnzpHq0IBpbc5WcDLAIOSA0CxQWHD4 fLCPCAODeSJPPUhG/3OHXB8qg0TxRIzaH1XD9Xfq8pULYervLCMwt02JbUplf4Ncq02o nvsHjZ4elRNfcTbCtEM/BReGmLwFHCilOlLKiPmz80gP3Kj1xHDnx3yMcSykBmCnv+XH 4Ymg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718896949; x=1719501749; 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=/X0IxOQD+UVox1iqgN/w4twKxD3yeUu+cfpZug2C5Oo=; b=oi2T6ylKLsMOkO9Il0kANvyUEu6hyYLcEtBfMK5Sfi4umYByHKodYFeoDS0j9xYVp3 7jEvwnQZkkpaNTIs89Rfd6AeNkIDMyzYploM64y0nyQ38CNT7fycRsvW7D3ODS2/hdKf jZJwnfxLS3iNAUDYY0c2Ryb4uqYB+Z6dBl/qHA8gMsGkkpL9QOhzS13IZm3Y0yH5sB58 hSfreoW7hzq24L/2w3749Kb69oq4dt2wFfSW94GEbvjkIV42E4DciOx9NM3aw6ilsRj+ d/CfsiNPwXA/7LADzq0rQ/BeF+lT7LTwmVKgftAMtio76nzb/jiH38MIWPz+BBPHvFnZ wlWA== X-Gm-Message-State: AOJu0YwzTYFCvcAVQlJjoFsrfBSLXWqtFYW8Xc5pdW15dQEAWD8Uq0f/ r0Qd4THc31wuXD4GJknFWCqo5BsdvbbaEZy31ww0qVXJlt0kLgcGkrfAiCHOegw= X-Received: by 2002:a50:ccca:0:b0:57a:2475:6a16 with SMTP id 4fb4d7f45d1cf-57d07e7bc1bmr5166576a12.11.1718896948929; Thu, 20 Jun 2024 08:22:28 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-57cb72e9943sm9855578a12.51.2024.06.20.08.22.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jun 2024 08:22:22 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 6C5285F9FB; Thu, 20 Jun 2024 16:22:21 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Peter Maydell , kvm@vger.kernel.org, qemu-ppc@nongnu.org, Christian Borntraeger , Paolo Bonzini , Jamie Iles , David Hildenbrand , =?utf-8?q?Alex_Benn=C3=A9e?= , Pierrick Bouvier , Mark Burton , Daniel Henrique Barboza , qemu-arm@nongnu.org, Laurent Vivier , Alexander Graf , Ilya Leoshkevich , Richard Henderson , Marco Liebel , Halil Pasic , Thomas Huth , qemu-s390x@nongnu.org, Cameron Esfahani , Alexandre Iooss , Nicholas Piggin , Roman Bolshakov , "Dr. David Alan Gilbert" , Marcelo Tosatti , Mahmoud Mandour , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PATCH v2 04/12] sysemu: add set_virtual_time to accel ops Date: Thu, 20 Jun 2024 16:22:12 +0100 Message-Id: <20240620152220.2192768-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240620152220.2192768-1-alex.bennee@linaro.org> References: <20240620152220.2192768-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::531; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-x531.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org We are about to remove direct calls to individual accelerators for this information and will need a central point for plugins to hook into time changes. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Pierrick Bouvier Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson Message-Id: <20240530220610.1245424-2-pierrick.bouvier@linaro.org> --- include/sysemu/accel-ops.h | 18 +++++++++++++++++- include/sysemu/cpu-timers.h | 3 ++- ...et-virtual-clock.c => cpus-virtual-clock.c} | 5 +++++ system/cpus.c | 11 +++++++++++ stubs/meson.build | 2 +- 5 files changed, 36 insertions(+), 3 deletions(-) rename stubs/{cpus-get-virtual-clock.c => cpus-virtual-clock.c} (68%) diff --git a/include/sysemu/accel-ops.h b/include/sysemu/accel-ops.h index ef91fc28bb..a088672230 100644 --- a/include/sysemu/accel-ops.h +++ b/include/sysemu/accel-ops.h @@ -20,7 +20,12 @@ typedef struct AccelOpsClass AccelOpsClass; DECLARE_CLASS_CHECKERS(AccelOpsClass, ACCEL_OPS, TYPE_ACCEL_OPS) -/* cpus.c operations interface */ +/** + * struct AccelOpsClass - accelerator interfaces + * + * This structure is used to abstract accelerator differences from the + * core CPU code. Not all have to be implemented. + */ struct AccelOpsClass { /*< private >*/ ObjectClass parent_class; @@ -44,7 +49,18 @@ struct AccelOpsClass { void (*handle_interrupt)(CPUState *cpu, int mask); + /** + * @get_virtual_clock: fetch virtual clock + * @set_virtual_clock: set virtual clock + * + * These allow the timer subsystem to defer to the accelerator to + * fetch time. The set function is needed if the accelerator wants + * to track the changes to time as the timer is warped through + * various timer events. + */ int64_t (*get_virtual_clock)(void); + void (*set_virtual_clock)(int64_t time); + int64_t (*get_elapsed_ticks)(void); /* gdbstub hooks */ diff --git a/include/sysemu/cpu-timers.h b/include/sysemu/cpu-timers.h index d86738a378..7bfa960fbd 100644 --- a/include/sysemu/cpu-timers.h +++ b/include/sysemu/cpu-timers.h @@ -96,8 +96,9 @@ int64_t cpu_get_clock(void); void qemu_timer_notify_cb(void *opaque, QEMUClockType type); -/* get the VIRTUAL clock and VM elapsed ticks via the cpus accel interface */ +/* get/set VIRTUAL clock and VM elapsed ticks via the cpus accel interface */ int64_t cpus_get_virtual_clock(void); +void cpus_set_virtual_clock(int64_t new_time); int64_t cpus_get_elapsed_ticks(void); #endif /* SYSEMU_CPU_TIMERS_H */ diff --git a/stubs/cpus-get-virtual-clock.c b/stubs/cpus-virtual-clock.c similarity index 68% rename from stubs/cpus-get-virtual-clock.c rename to stubs/cpus-virtual-clock.c index fd447d53f3..af7c1a1d40 100644 --- a/stubs/cpus-get-virtual-clock.c +++ b/stubs/cpus-virtual-clock.c @@ -6,3 +6,8 @@ int64_t cpus_get_virtual_clock(void) { return cpu_get_clock(); } + +void cpus_set_virtual_clock(int64_t new_time) +{ + /* do nothing */ +} diff --git a/system/cpus.c b/system/cpus.c index f8fa78f33d..d3640c9503 100644 --- a/system/cpus.c +++ b/system/cpus.c @@ -229,6 +229,17 @@ int64_t cpus_get_virtual_clock(void) return cpu_get_clock(); } +/* + * Signal the new virtual time to the accelerator. This is only needed + * by accelerators that need to track the changes as we warp time. + */ +void cpus_set_virtual_clock(int64_t new_time) +{ + if (cpus_accel && cpus_accel->set_virtual_clock) { + cpus_accel->set_virtual_clock(new_time); + } +} + /* * return the time elapsed in VM between vm_start and vm_stop. Unless * icount is active, cpus_get_elapsed_ticks() uses units of the host CPU cycle diff --git a/stubs/meson.build b/stubs/meson.build index f15b48d01f..772a3e817d 100644 --- a/stubs/meson.build +++ b/stubs/meson.build @@ -29,7 +29,7 @@ endif if have_block or have_ga stub_ss.add(files('replay-tools.c')) # stubs for hooks in util/main-loop.c, util/async.c etc. - stub_ss.add(files('cpus-get-virtual-clock.c')) + stub_ss.add(files('cpus-virtual-clock.c')) stub_ss.add(files('icount.c')) stub_ss.add(files('graph-lock.c')) if linux_io_uring.found() From patchwork Thu Jun 20 15:22:13 2024 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: 805990 Delivered-To: patch@linaro.org Received: by 2002:a5d:508d:0:b0:362:4979:7f74 with SMTP id a13csp346382wrt; Thu, 20 Jun 2024 08:24:56 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV2JQbYUfwy6j6rQjny1Fu6S3difoDkdGKaK8tkohSOLaiB9fd1tYxCotusv/BWtTqGoGIKIfpTY8D/5qWbmNsN X-Google-Smtp-Source: AGHT+IEOMN0NAHz/c83dUCPq5s2csTMgKuxmFb4RKPfto0yLiQ3iKbo0JSD0PlwjIn6F1TMnn7Ct X-Received: by 2002:a05:6870:6487:b0:254:c777:6327 with SMTP id 586e51a60fabf-25c94d01db8mr6578517fac.36.1718897096634; Thu, 20 Jun 2024 08:24:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1718897096; cv=none; d=google.com; s=arc-20160816; b=aLzXLRFDD8SRAGg8id7iNdyWw5AXoRSiRyS09ctSPfkKY0MhnEL7asTniTJ30vJEtf D7KLan+m0KWRPCG6m/55Z2cJZeC9YU5ms+8Qmgpda/KNEYYHm6VypMWqwoKZ0QivvQzQ ZNlL+Q4+EwbqvRCt1YEC9vm1GSI6Wh5UiIjtFtyFZ8XtjDAzbu3nnYMEDOturwauTANj XtGYkkdjoPsCn/XtCFO33MdMErxDjM0eabBnKxJZ+sT6phW6aQZw8NX3e+DYsbgaJQPp o/7cHh8OVDZZBGUNNpUmMk9SvfOkNtWVl9/0gi4yN6UhrI7WQiGN3KsglR7yUVpW5DQU /Ktg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=bRGnfZngJdWMgOcvZ7TtStbP9AmubDNWr9Hu5lfqXOc=; fh=qYUyA+SSE+X3fQR5X1u+SwltJ/ArWqMeAeFp+rGIm4A=; b=nq9Xrdw6XJ4+rT0xaWgC4H+lHAKSxWLmdzGvxwvMnTOmmjcsh/n6FZl41rk5hsEKfn epSChDgOhlxniZqLZTbczX7GIvbNz2hsIIAPB2B0vY/ksReyOpWlJpBk4XHF1PE5a+MG Iiou/rO/0/ID2yqUbqx/8QFFbyfY7djctX25pD9GNKREvJhA5ds9YkO178JKHUr3cPFP ZFNaNUntGqpDOu27VwXijjUpBVR0c3abbDZg6fs9B6ZJ2uFexN7n/RyzL2M5ymN20s7o 4thRyGnLj9rfXr/fKRaf4hDWHDRCKTrtuQ7FRFy1fn5WNb7VEZKBfqd2K15AYx975+lA rpWQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TQfrIIcM; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-798ab90315dsi1673855885a.299.2024.06.20.08.24.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Jun 2024 08:24:56 -0700 (PDT) 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=TQfrIIcM; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sKJcX-00060c-Ua; Thu, 20 Jun 2024 11:22:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sKJcW-0005xF-1M for qemu-devel@nongnu.org; Thu, 20 Jun 2024 11:22:40 -0400 Received: from mail-ed1-x52b.google.com ([2a00:1450:4864:20::52b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sKJcS-000808-56 for qemu-devel@nongnu.org; Thu, 20 Jun 2024 11:22:39 -0400 Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-57d1d45ba34so1111732a12.3 for ; Thu, 20 Jun 2024 08:22:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718896954; x=1719501754; 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=bRGnfZngJdWMgOcvZ7TtStbP9AmubDNWr9Hu5lfqXOc=; b=TQfrIIcMPQNzMrq1HAoou3OeloPIpZ5lqYyD8XbTptKRd7iLdzYAiDaNqRhMNXt/hD GV0OXTr1wtO8GfAuApDxq8hKCmMkif+Ilbs/HsnU1A6+vRoMOONwrHa500sD0B0/WK+y FHqal7HmCQ0ckUi1GR+Kms1vsQTp6V5Xxw/qz8xoDvvLr6LPmluwvtgpYGSmSf16bM3Y Re5NFwcrX+1Z7QucGMx+BBKxnRWBKqRx2F+C+SsTu0bGd9i0jtdsm0nSWHj+VSyzKIvU ZfOh11SY7ws0xImkXRpfl11mgK5iVGz0KnhZ0IiNl+sOfZzSuJCC8+7zqYocX9RJIFED WfmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718896954; x=1719501754; 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=bRGnfZngJdWMgOcvZ7TtStbP9AmubDNWr9Hu5lfqXOc=; b=TdbBRAxrkaXs9Wfc6zOlH3jRDqbLtRiRLlkxnIvqyPmCNQNdgqGt7TynPDcRANMyIS jqj8Hc1quvfRTrAiitPFY5yoe23TgPPRd/ETyfoRX819tvCs/wsD5K5EdGZ3wldQQfb+ YzZyfn+ll7yZnWQqry5gu37j1k/JRhbTsgUlsL2bj7g0wwEwMZIfOHE3ytX2Ivwcq59F qXODwVMk/pdyxqglWQ51F661Lab8E+og48Q7WyDQFzLsEJg+A4he9dE995yQQ72RQwht ggOfX5n92PVgP/U+9F2vtCH3A58KVTG85Iu4dHP39KYokaWg8Jg00GC2h1Lm6DJctUDT SPnw== X-Gm-Message-State: AOJu0Yy+Edq06lxh2lDFqQrorBHP3VFHmnY0H9zRAzugmOBbp3YpGfmy eMcn5R0zUCztktCApo68Za7lSpOAu5GROvvAvr4tO1EtsXODj9c8tdNCAKB71c4= X-Received: by 2002:a50:9f4a:0:b0:57d:5ac:7426 with SMTP id 4fb4d7f45d1cf-57d07e66c47mr3246096a12.9.1718896954416; Thu, 20 Jun 2024 08:22:34 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-57cb72e9115sm9869605a12.46.2024.06.20.08.22.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jun 2024 08:22:28 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 81C2E5F9FF; Thu, 20 Jun 2024 16:22:21 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Peter Maydell , kvm@vger.kernel.org, qemu-ppc@nongnu.org, Christian Borntraeger , Paolo Bonzini , Jamie Iles , David Hildenbrand , =?utf-8?q?Alex_Benn=C3=A9e?= , Pierrick Bouvier , Mark Burton , Daniel Henrique Barboza , qemu-arm@nongnu.org, Laurent Vivier , Alexander Graf , Ilya Leoshkevich , Richard Henderson , Marco Liebel , Halil Pasic , Thomas Huth , qemu-s390x@nongnu.org, Cameron Esfahani , Alexandre Iooss , Nicholas Piggin , Roman Bolshakov , "Dr. David Alan Gilbert" , Marcelo Tosatti , Mahmoud Mandour , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PATCH v2 05/12] qtest: use cpu interface in qtest_clock_warp Date: Thu, 20 Jun 2024 16:22:13 +0100 Message-Id: <20240620152220.2192768-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240620152220.2192768-1-alex.bennee@linaro.org> References: <20240620152220.2192768-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::52b; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-x52b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=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 generalises the qtest_clock_warp code to use the AccelOps handlers for updating its own sense of time. This will make the next patch which moves the warp code closer to pure code motion. From: Alex Bennée Acked-by: Thomas Huth Signed-off-by: Pierrick Bouvier Signed-off-by: Alex Bennée Message-Id: <20240530220610.1245424-3-pierrick.bouvier@linaro.org> --- include/sysemu/qtest.h | 1 + accel/qtest/qtest.c | 1 + system/qtest.c | 6 +++--- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/sysemu/qtest.h b/include/sysemu/qtest.h index b5d5fd3463..45f3b7e1df 100644 --- a/include/sysemu/qtest.h +++ b/include/sysemu/qtest.h @@ -36,6 +36,7 @@ void qtest_server_set_send_handler(void (*send)(void *, const char *), void qtest_server_inproc_recv(void *opaque, const char *buf); int64_t qtest_get_virtual_clock(void); +void qtest_set_virtual_clock(int64_t count); #endif #endif diff --git a/accel/qtest/qtest.c b/accel/qtest/qtest.c index f6056ac836..53182e6c2a 100644 --- a/accel/qtest/qtest.c +++ b/accel/qtest/qtest.c @@ -52,6 +52,7 @@ static void qtest_accel_ops_class_init(ObjectClass *oc, void *data) ops->create_vcpu_thread = dummy_start_vcpu_thread; ops->get_virtual_clock = qtest_get_virtual_clock; + ops->set_virtual_clock = qtest_set_virtual_clock; }; static const TypeInfo qtest_accel_ops_type = { diff --git a/system/qtest.c b/system/qtest.c index 507a358f3b..5be66b0140 100644 --- a/system/qtest.c +++ b/system/qtest.c @@ -332,14 +332,14 @@ int64_t qtest_get_virtual_clock(void) return qatomic_read_i64(&qtest_clock_counter); } -static void qtest_set_virtual_clock(int64_t count) +void qtest_set_virtual_clock(int64_t count) { qatomic_set_i64(&qtest_clock_counter, count); } static void qtest_clock_warp(int64_t dest) { - int64_t clock = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); + int64_t clock = cpus_get_virtual_clock(); AioContext *aio_context; assert(qtest_enabled()); aio_context = qemu_get_aio_context(); @@ -348,7 +348,7 @@ static void qtest_clock_warp(int64_t dest) QEMU_TIMER_ATTR_ALL); int64_t warp = qemu_soonest_timeout(dest - clock, deadline); - qtest_set_virtual_clock(qtest_get_virtual_clock() + warp); + cpus_set_virtual_clock(cpus_get_virtual_clock() + warp); qemu_clock_run_timers(QEMU_CLOCK_VIRTUAL); timerlist_run_timers(aio_context->tlg.tl[QEMU_CLOCK_VIRTUAL]); From patchwork Thu Jun 20 15:22:14 2024 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: 805981 Delivered-To: patch@linaro.org Received: by 2002:a5d:508d:0:b0:362:4979:7f74 with SMTP id a13csp345737wrt; Thu, 20 Jun 2024 08:23:34 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXJK99TY6TANiMJJ4iMrBmiL36+grpPB5+Vt4BJ8fie/k3T7vqAQIj7N0k7Xo/gLMxy2mZ8KKRrGFIyI1nZm2Lt X-Google-Smtp-Source: AGHT+IHYv37yaZYZYZeTozPEK3EkpUjRbjT/N9Z138PCVonx4XyNqvkQEcuTT5+y8Z7jl+5nkHIP X-Received: by 2002:ac8:5ac5:0:b0:444:9b62:7304 with SMTP id d75a77b69052e-444a79a9cb0mr73242521cf.11.1718897014611; Thu, 20 Jun 2024 08:23:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1718897014; cv=none; d=google.com; s=arc-20160816; b=FFRfXOI+l4qIsCEGuCSZRRHqz8Y39+NRRd3f7354SXoeO3jqodjQb7A1vmhBgFYg4z 2VWVsXtYBu1UU2ca4nEHY3hhWuNJ1tG4kyHjekFUfSve8ZwwXRYoc+H354zwajAkUXup aV2wYkhyDmSFp4i/XjbkPv5mXCfRYyn9kE+EOyiQau0otyBfwvtqTFKla4lxEOyJivBR ZhFDTE8hfPUkrINkP0bI4cJV5P1mkkAB5LiqdFTIfSdYg7a1Vd3cCTtUgN5wOdw/jZAq FAH89/4OgfgLKnsvMgjpjjQ71YSKR4izHL5ns0SW3f+an9yau+533EY6QomLnOi1Rili xPTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=oUsmThce/MAXtT1TzjuV9l3/1dXmfT3EJ/fU+1YA9l4=; fh=qYUyA+SSE+X3fQR5X1u+SwltJ/ArWqMeAeFp+rGIm4A=; b=zVm+IevnFDxwFLmRL+Or4+9W3JgSkniwWnUmCLa0BDMtf4dMNnvUjWJZJHRscDdG+1 uwVn2YWPrAs342NtxOO6RNZ7bFYgMJl0d8+Qme8Q6nP9ceqMkOy/oD3thiPYjwzfBsFg AGJEbkWBKFOtQt+y724C10IJ2a973e5Sdla60qsl5UMVnjUgWgDJRC4qRrGGPxNvxAY3 d1oU9se+wX/iQnvkvNkbMA1yW7kInhpJRniQy9B3DL2ZR4ddHzrU3b0gKtyYXfiN1dzy Ff/h1/y3stWmAW1gCfDh56cHhvhyR8hgqVgQ1xUqfQSBoGyflyP+LSvj9yRgm+f3HASw lHyA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RFAuZ3eW; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-441f2ea8a74si167398661cf.327.2024.06.20.08.23.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Jun 2024 08:23:34 -0700 (PDT) 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=RFAuZ3eW; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sKJcU-0005uJ-Kg; Thu, 20 Jun 2024 11:22:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sKJcS-0005s6-Ae for qemu-devel@nongnu.org; Thu, 20 Jun 2024 11:22:36 -0400 Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sKJcP-0007yi-It for qemu-devel@nongnu.org; Thu, 20 Jun 2024 11:22:36 -0400 Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-57d1679ee6eso2487694a12.1 for ; Thu, 20 Jun 2024 08:22:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718896951; x=1719501751; 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=oUsmThce/MAXtT1TzjuV9l3/1dXmfT3EJ/fU+1YA9l4=; b=RFAuZ3eWKqjn4fiw2U7sdeS3BZEAGFXH83pDLo1prJFt9wgbTctkCDRgkzQhXbOf8i 8R+SrFIk433e7IlZDaQaxFjJJPD8wFMEvysdggm/PdpNZgLle+T/Qv/nCs9yyeXUiHCr jrZF/mWrUyvRmgdaHtebHOixXWGCqyCSuU0Uk3sCEe4AMVWLwIkkBO5BwW9OUC+eKJon N8WQg5S5uRNsi17dtOLmBmlfJRaIdXiXmq7iLaOe9jftcUzjalinMEHwxWC+TrnGOMDH g5QbHnqyG68XkRm7KflCBxHTtaSQz4jof/GGIuwIxNmvn23y72WhV31yCHukjdwrTok/ DO0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718896951; x=1719501751; 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=oUsmThce/MAXtT1TzjuV9l3/1dXmfT3EJ/fU+1YA9l4=; b=QdZ0KoHykGWeXamgYxBNM429xKyDFqeTxXmICOr8SBMQD2tYI7/UdqT7qv/6oEoIUe pN0kn+uOF16LODltJ+3HC2DJqf3ZVR9CqG8qF3XFNiIAjofAJTZWbe8zBmWNwi5gC6ic VNTScnEVToj4m9G16DVZZZYNDqZ/jq5KJTcSZ/XMs3Yb8LxYzN17d02B/1j2JQXlWxys D0QCq/rYbRGKJ1vUbaDYmGHTgFDtHMETpsSjbyNSjq96u/ts27PiEB6WuxBjQO3pTG1o 49z2CkSIWJO7ttNkRRkCulcsc8Kx41EheX95mdvFzxf0C8DsfdIkh3t0GVi2AEsXtZ3t IFnw== X-Gm-Message-State: AOJu0YxZoUJYpPlxfC+1+bbv4AdGG2U6x3zo2DONLf4fJLNPOSSRvUfE +7am9T5wvtU/QiUZFJOsIn1i2LG1k3JommtLB3uE4EAx9btZ7HAJBeGHoqqlfnk= X-Received: by 2002:a17:907:d042:b0:a6f:9550:c0ee with SMTP id a640c23a62f3a-a6fa430f3f1mr452004166b.18.1718896950979; Thu, 20 Jun 2024 08:22:30 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a6f56f416dfsm775943366b.164.2024.06.20.08.22.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jun 2024 08:22:28 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 9CFFA5FA01; Thu, 20 Jun 2024 16:22:21 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Peter Maydell , kvm@vger.kernel.org, qemu-ppc@nongnu.org, Christian Borntraeger , Paolo Bonzini , Jamie Iles , David Hildenbrand , =?utf-8?q?Alex_Benn=C3=A9e?= , Pierrick Bouvier , Mark Burton , Daniel Henrique Barboza , qemu-arm@nongnu.org, Laurent Vivier , Alexander Graf , Ilya Leoshkevich , Richard Henderson , Marco Liebel , Halil Pasic , Thomas Huth , qemu-s390x@nongnu.org, Cameron Esfahani , Alexandre Iooss , Nicholas Piggin , Roman Bolshakov , "Dr. David Alan Gilbert" , Marcelo Tosatti , Mahmoud Mandour , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PATCH v2 06/12] sysemu: generalise qtest_warp_clock as qemu_clock_advance_virtual_time Date: Thu, 20 Jun 2024 16:22:14 +0100 Message-Id: <20240620152220.2192768-7-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240620152220.2192768-1-alex.bennee@linaro.org> References: <20240620152220.2192768-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::530; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-x530.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Move the key functionality of moving time forward into the clock sub-system itself. This will allow us to plumb in time control into plugins. Signed-off-by: Pierrick Bouvier Signed-off-by: Alex Bennée Message-Id: <20240530220610.1245424-4-pierrick.bouvier@linaro.org> --- v2 - use target_ns in docs and signature --- include/qemu/timer.h | 15 +++++++++++++++ system/qtest.c | 25 +++---------------------- util/qemu-timer.c | 26 ++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 22 deletions(-) diff --git a/include/qemu/timer.h b/include/qemu/timer.h index 9a366e551f..5ce83c7911 100644 --- a/include/qemu/timer.h +++ b/include/qemu/timer.h @@ -245,6 +245,21 @@ bool qemu_clock_run_timers(QEMUClockType type); */ bool qemu_clock_run_all_timers(void); +/** + * qemu_clock_advance_virtual_time(): advance the virtual time tick + * @target_ns: target time in nanoseconds + * + * This function is used where the control of the flow of time has + * been delegated to outside the clock subsystem (be it qtest, icount + * or some other external source). You can ask the clock system to + * return @early at the first expired timer. + * + * Time can only move forward, attempts to reverse time would lead to + * an error. + * + * Returns: new virtual time. + */ +int64_t qemu_clock_advance_virtual_time(int64_t target_ns); /* * QEMUTimerList diff --git a/system/qtest.c b/system/qtest.c index 5be66b0140..8cb98966b4 100644 --- a/system/qtest.c +++ b/system/qtest.c @@ -337,26 +337,6 @@ void qtest_set_virtual_clock(int64_t count) qatomic_set_i64(&qtest_clock_counter, count); } -static void qtest_clock_warp(int64_t dest) -{ - int64_t clock = cpus_get_virtual_clock(); - AioContext *aio_context; - assert(qtest_enabled()); - aio_context = qemu_get_aio_context(); - 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); - - cpus_set_virtual_clock(cpus_get_virtual_clock() + warp); - - 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); - } - qemu_clock_notify(QEMU_CLOCK_VIRTUAL); -} - static bool (*process_command_cb)(CharBackend *chr, gchar **words); void qtest_set_command_cb(bool (*pc_cb)(CharBackend *chr, gchar **words)) @@ -751,7 +731,8 @@ static void qtest_process_command(CharBackend *chr, gchar **words) ns = qemu_clock_deadline_ns_all(QEMU_CLOCK_VIRTUAL, QEMU_TIMER_ATTR_ALL); } - qtest_clock_warp(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + ns); + qemu_clock_advance_virtual_time( + qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + ns); qtest_send_prefix(chr); qtest_sendf(chr, "OK %"PRIi64"\n", (int64_t)qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL)); @@ -777,7 +758,7 @@ static void qtest_process_command(CharBackend *chr, gchar **words) g_assert(words[1]); ret = qemu_strtoi64(words[1], NULL, 0, &ns); g_assert(ret == 0); - qtest_clock_warp(ns); + qemu_clock_advance_virtual_time(ns); qtest_send_prefix(chr); qtest_sendf(chr, "OK %"PRIi64"\n", (int64_t)qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL)); diff --git a/util/qemu-timer.c b/util/qemu-timer.c index 6a0de33dd2..213114be68 100644 --- a/util/qemu-timer.c +++ b/util/qemu-timer.c @@ -645,6 +645,11 @@ int64_t qemu_clock_get_ns(QEMUClockType type) } } +static void qemu_virtual_clock_set_ns(int64_t time) +{ + return cpus_set_virtual_clock(time); +} + void init_clocks(QEMUTimerListNotifyCB *notify_cb) { QEMUClockType type; @@ -675,3 +680,24 @@ bool qemu_clock_run_all_timers(void) return progress; } + +int64_t qemu_clock_advance_virtual_time(int64_t dest) +{ + int64_t clock = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); + AioContext *aio_context; + aio_context = qemu_get_aio_context(); + 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); + + 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); + } + qemu_clock_notify(QEMU_CLOCK_VIRTUAL); + + return clock; +} From patchwork Thu Jun 20 15:22:15 2024 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: 805986 Delivered-To: patch@linaro.org Received: by 2002:a5d:508d:0:b0:362:4979:7f74 with SMTP id a13csp346174wrt; Thu, 20 Jun 2024 08:24:30 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVKYbypxPR/AbMKh9owclzVnUW5cRcBRORzKcMzVI5yURqWfYa8xmjp+BimIjimnvTdqwgRDRRWDvm08yD8NIPP X-Google-Smtp-Source: AGHT+IHm+KMNM7/CARyC3ULZISShk0qXyarTtDb9+YOKsxvxqKihOJQ/Vv3H9O4MAJ554lWymOk3 X-Received: by 2002:a05:6871:10b:b0:259:89fc:db65 with SMTP id 586e51a60fabf-25c94d70a63mr5820280fac.50.1718897070020; Thu, 20 Jun 2024 08:24:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1718897069; cv=none; d=google.com; s=arc-20160816; b=X+TucNKAGe/5jIFNgeaiSbmUDg6Nniz4tB5nAdTlwQvVpcqX6OAH3WxAijwPt4+0+d Oy7wUU5jhTpxfMwN+ZyTZ8S83w3wx/nH6w28kGYeIC5nRkmD1iYjbQGOjioTH0s0zeJz O0yhtY0Bms3GHaQcxsHilpzEUs5+tuWqji8TRA+d7rsQvx6XNBpA48UgRTD6Y2eGvWBO s1gH9hwDC069AQmFqAV9O3igxwQVp1TlRpZHEpr8qqK7Eo8gPcvXAExMatBFBPAr3RXo vnx0Ngub7Fg4x9wuZ/48kyfJgjjaAiiMA/fSD5EGzn9rOfAYmFQlrKz1LD9eFzL9pW6m LhbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=a0NIpkhyGGYgnbxSmBPfzzcGZB9GrmkEzQVe5cCnoVc=; fh=qYUyA+SSE+X3fQR5X1u+SwltJ/ArWqMeAeFp+rGIm4A=; b=qhUzN6cVii0vxz22VwPOBirMKb37JnJivD5vfvB3m8O8nArVRsva0gvetf25L9wzdX deCl+t0hBQ5ZPrqkcux5VxPVJghXRzG3n1QuahNr0atfpyxyvYlfcyUmwXlPthrj2VND 0Nkjj1xoKlqUqsEZPE3p0jsXFSgqpX6lm1HAgIi3S6j7RiRV1c/mG89cvCiND7h8cSQg +ykenUEEaokqPS935MV2ca1Gl2fs4rigbX6ob7K2xJz9D9nDmn/Si32C2yDLBNDpPx9s L94SbGIUzpsvdCW0MFKOnQFTzj5RZwOmGKlOyg2U/ipdKe3Gs8sJAOl74heWm9xeES7E iblg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=p9TrWohc; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-798abe5beb6si1697341885a.619.2024.06.20.08.24.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Jun 2024 08:24:29 -0700 (PDT) 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=p9TrWohc; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sKJcV-0005uy-1v; Thu, 20 Jun 2024 11:22:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sKJcT-0005t9-8e for qemu-devel@nongnu.org; Thu, 20 Jun 2024 11:22:37 -0400 Received: from mail-lf1-x136.google.com ([2a00:1450:4864:20::136]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sKJcP-0007yW-IG for qemu-devel@nongnu.org; Thu, 20 Jun 2024 11:22:36 -0400 Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-52cc14815c3so1063507e87.0 for ; Thu, 20 Jun 2024 08:22:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718896952; x=1719501752; 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=a0NIpkhyGGYgnbxSmBPfzzcGZB9GrmkEzQVe5cCnoVc=; b=p9TrWohcr0ofM0C0tvh8djX/Ijp5UfvKqp+rLMhEnmfAW8mjqiamcyXWvG4PVh/i3n pGr4viTQGv+6lUoJcE8yGTgF7z5+9fMs0MzkG9AqMxPI1EFGxUPum6ksgQl0ZePQZUhG 7YnpnLLTCe4jP0XuR41PgAi5qYouJo4yRXa4Jp6WbmKx+0mCmf5tSYQFgQ6zMccsBorQ Lqj/D+d8QEAyITPyiiDULFNeGrSJtuzhxsPvU1wXtBp6Hv0SlwW3q3pLrztJ8UIcl5t8 zyk+Wpr2W6Er+98RmRgeZ9a9jaJ8rQ2ZIQr7b2dU3oajF+92lVLnMIrmlMj1jvPEWind xnFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718896952; x=1719501752; 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=a0NIpkhyGGYgnbxSmBPfzzcGZB9GrmkEzQVe5cCnoVc=; b=ugQFj5KT3XYtgmt9SbFzOvuLXL5ZsDonk3arWk5g79RAif9Vl8pDLMuo8gdy+WhjHo qZNSkFCvyF2RGoJOHwsC4bJj20dTi6la5o9xf0CenXUIUVoqgIIpkw7XhOOAPqTuQmke iHwL4JFjNX+OGLRifQygII6+s4EbBb3bLRPybigpSKQl6hzQ6UAVUHC63+VBBNnfkaUa 5p9tt0ko626h1JHijR+mmBjTPAQWKQ8Lhobkplu+5RGOrhk2u3dnF+bajvDAxCkJy3Wy IAnAdATB6qLNSYkbxrexZ2N1vGHUftOuCFM3Rvtf4g1p4kGVnRyNndN1SvQxCtqSHtWA unXg== X-Gm-Message-State: AOJu0YzZOsmjK3HJgGLz1sNBW80mtu4/8iLOcuCE4KJuwTkOr6yt5dt1 +hJ8E5+e89xZZ7Fucj0gDgFyKprDmMTNofU/LSRPrswnqCgm4wy5mkEuF4GmTsE= X-Received: by 2002:a05:6512:6d3:b0:52c:7f7f:dc1f with SMTP id 2adb3069b0e04-52ccaa5c755mr4114734e87.61.1718896951767; Thu, 20 Jun 2024 08:22:31 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a6f56ed0f2asm783454366b.131.2024.06.20.08.22.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jun 2024 08:22:28 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id B3C945FA03; Thu, 20 Jun 2024 16:22:21 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Peter Maydell , kvm@vger.kernel.org, qemu-ppc@nongnu.org, Christian Borntraeger , Paolo Bonzini , Jamie Iles , David Hildenbrand , =?utf-8?q?Alex_Benn=C3=A9e?= , Pierrick Bouvier , Mark Burton , Daniel Henrique Barboza , qemu-arm@nongnu.org, Laurent Vivier , Alexander Graf , Ilya Leoshkevich , Richard Henderson , Marco Liebel , Halil Pasic , Thomas Huth , qemu-s390x@nongnu.org, Cameron Esfahani , Alexandre Iooss , Nicholas Piggin , Roman Bolshakov , "Dr. David Alan Gilbert" , Marcelo Tosatti , Mahmoud Mandour , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PATCH v2 07/12] qtest: move qtest_{get, set}_virtual_clock to accel/qtest/qtest.c Date: Thu, 20 Jun 2024 16:22:15 +0100 Message-Id: <20240620152220.2192768-8-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240620152220.2192768-1-alex.bennee@linaro.org> References: <20240620152220.2192768-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::136; envelope-from=alex.bennee@linaro.org; helo=mail-lf1-x136.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=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: Pierrick Bouvier Signed-off-by: Pierrick Bouvier Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20240530220610.1245424-5-pierrick.bouvier@linaro.org> --- include/sysemu/qtest.h | 3 --- accel/qtest/qtest.c | 12 ++++++++++++ system/qtest.c | 12 ------------ 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/include/sysemu/qtest.h b/include/sysemu/qtest.h index 45f3b7e1df..c161d75165 100644 --- a/include/sysemu/qtest.h +++ b/include/sysemu/qtest.h @@ -34,9 +34,6 @@ void qtest_server_init(const char *qtest_chrdev, const char *qtest_log, Error ** void qtest_server_set_send_handler(void (*send)(void *, const char *), void *opaque); void qtest_server_inproc_recv(void *opaque, const char *buf); - -int64_t qtest_get_virtual_clock(void); -void qtest_set_virtual_clock(int64_t count); #endif #endif diff --git a/accel/qtest/qtest.c b/accel/qtest/qtest.c index 53182e6c2a..bf14032d29 100644 --- a/accel/qtest/qtest.c +++ b/accel/qtest/qtest.c @@ -24,6 +24,18 @@ #include "qemu/main-loop.h" #include "hw/core/cpu.h" +static int64_t qtest_clock_counter; + +static int64_t qtest_get_virtual_clock(void) +{ + return qatomic_read_i64(&qtest_clock_counter); +} + +static void qtest_set_virtual_clock(int64_t count) +{ + qatomic_set_i64(&qtest_clock_counter, count); +} + static int qtest_init_accel(MachineState *ms) { return 0; diff --git a/system/qtest.c b/system/qtest.c index 8cb98966b4..12703a2045 100644 --- a/system/qtest.c +++ b/system/qtest.c @@ -325,18 +325,6 @@ static void qtest_irq_handler(void *opaque, int n, int level) } } -static int64_t qtest_clock_counter; - -int64_t qtest_get_virtual_clock(void) -{ - return qatomic_read_i64(&qtest_clock_counter); -} - -void qtest_set_virtual_clock(int64_t count) -{ - qatomic_set_i64(&qtest_clock_counter, count); -} - static bool (*process_command_cb)(CharBackend *chr, gchar **words); void qtest_set_command_cb(bool (*pc_cb)(CharBackend *chr, gchar **words)) From patchwork Thu Jun 20 15:22:16 2024 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: 805989 Delivered-To: patch@linaro.org Received: by 2002:a5d:508d:0:b0:362:4979:7f74 with SMTP id a13csp346340wrt; Thu, 20 Jun 2024 08:24:51 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCX+F0IAkbiZ22pyWKGbxuehyq5x7iAZtx72Tms+w66Q1mFXWGri9Tfr62ynXfS6HK0ft+vLsJW3mx9yxCDwOSNB X-Google-Smtp-Source: AGHT+IFNHPSqGHogKSumc4NKtZFt3VlBYaII+lGdcv5p4FPMaRKVojZRyv3WY8xR0BaUomW4MB1L X-Received: by 2002:a05:620a:4046:b0:79b:c0bb:1f1b with SMTP id af79cd13be357-79bc0bb2200mr367068985a.37.1718897091629; Thu, 20 Jun 2024 08:24:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1718897091; cv=none; d=google.com; s=arc-20160816; b=TvPR3JKfNn+mn86tI8dtHAIWjjyB3y8UsqNh7Xs6akfFLlk7dEP1LMmCj+GmFlhjcE ZJf2LQCeB6UazIdOJQAQjT7VSjMW7fiD/2VTjsONckpmnJ9V50GV1RbP6Nb222GmXTtQ HLeQa5calQnKrkIbiJo8IvuTpTStfF4Rv4C7tx1ju45LdfkLAQttT2/0CPFRK5BIeyBL 6kygcXB+ouhP+uNinWUCch3nOQdgv4yGubcvlV7O6BQBHgLerpnKcxwdJICXomAb3j3V vJXxpFkxmG1NxOJA3CE+/dUH7w0ppHXKYbYHo68UHg4r/rDNvZhoCSkK1nEGpqQhN91n Wp9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=6bnw8wtrxQn8og2FDwWWp7AmT3nbEagSCExx0Sw+yVA=; fh=qYUyA+SSE+X3fQR5X1u+SwltJ/ArWqMeAeFp+rGIm4A=; b=XJeRZ05j91xMBLSAT4zk9keGKJEqLkuCzShksO//rfFJxzG+7eE0IxGZFNRwYg7dTI XplrdJlZ2nL9+eeRgvpVKjUPC70BNbfyA7bzWyePVV49qbmJrFj4+3SzqOeFo5c1M3Z7 s7Di2+0uTQu6zrGVoikg0pwahiX5+opvQ1BGgeOOYhwpFz+qXvWXB3N6X2uS2+XZ8qzg fD/tZCAtr/ee3mold8UxvaatgenOj7uvgSHL0rM3QQMlu+mG/EHycsD43qdnXX0g9bJR 1WhLbBDV1i0rL9r25a8Jv6DCk5EcUX489eiAPSdkRpDTFTYPsLAnEkfXlByTbAcYoAJr i8eg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ukhJ2k9n; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-798abe5a4e5si1858947385a.624.2024.06.20.08.24.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Jun 2024 08:24:51 -0700 (PDT) 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=ukhJ2k9n; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sKJcW-0005xI-3b; Thu, 20 Jun 2024 11:22:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sKJcU-0005uc-PC for qemu-devel@nongnu.org; Thu, 20 Jun 2024 11:22:38 -0400 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 1sKJcR-000801-Kf for qemu-devel@nongnu.org; Thu, 20 Jun 2024 11:22:38 -0400 Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-a6f1da33826so130637966b.0 for ; Thu, 20 Jun 2024 08:22:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718896954; x=1719501754; 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=6bnw8wtrxQn8og2FDwWWp7AmT3nbEagSCExx0Sw+yVA=; b=ukhJ2k9nXkE8KQXr1cJY6xkgU8hcFQKG7rpHvUtxqb0CjsxZVKybF6Z+LKvcYfU3FD qW8p1p6UFStWu/vhN4vVWd/uKbqEcazAyf937fBtmw6FVq6ARjFvsyMTuOj0k5sKmb/z TEqS+T12i9Vo33OC7oEJ9XUWLFxOYN6byY5aGkUlJqu4lx0Euw/Fo4pf/JzPs6nuQ94l sKD3ZO0yqmRNo8KVmBekoGYxIaephoTm0p2n5JmcUZGVpz+zsrlV4MXmzLqMcvnGy7il gRnLuXpIafgsHlvgyX3qXONbz5Fe4iJlAkuuMJ3EHTx8fxV5VNqHxRkEZKVg4vCfHRF3 ciBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718896954; x=1719501754; 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=6bnw8wtrxQn8og2FDwWWp7AmT3nbEagSCExx0Sw+yVA=; b=WXCxBSAk3rkCaeIRLAszZMdfzNuLQDPJNmDrrce/HLU+gulb0sYbkGXqVAMcZiE87m KttYaLxVvpkm/PlYMiVFMwF765W79oEpKa/TU9b+7UBjn5vFrRoKyqXPI30Z3NBUYx6J J51U7vgZ9UwhyaDjHdorsp/A218PQmhDMeRAEM1XqvaHKDY7krUt9L9fzszsCK7veX4d Owl6X2yzSN0PQx9TymM5Z3AUGMTt084RPFKOQWj4w/bB/x2CFr6+XejBYPPlgZ160xD0 gSW7kGm3+AH9J0/HSE8riKahudfX5cS2sT/Oo6vPqLfTtld7bgDfidxTDTe8UU7uIzMd 7UPg== X-Gm-Message-State: AOJu0YyohEur9KFhmQB5WIJWJKnOQrt1GFPuQRouXPI57TPyd8Rbc2N/ qCS7Ts52oGyhI6ksepF4/nVCCOujxUU05SEUJc25Cw9RvM4NvorqAIqUa/aHy74= X-Received: by 2002:a17:907:a787:b0:a6f:ad2f:ac4b with SMTP id a640c23a62f3a-a6fad2fad01mr374136066b.2.1718896953649; Thu, 20 Jun 2024 08:22:33 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a6f56db5b98sm774609266b.86.2024.06.20.08.22.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jun 2024 08:22:28 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id CDBB15FA06; Thu, 20 Jun 2024 16:22:21 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Peter Maydell , kvm@vger.kernel.org, qemu-ppc@nongnu.org, Christian Borntraeger , Paolo Bonzini , Jamie Iles , David Hildenbrand , =?utf-8?q?Alex_Benn=C3=A9e?= , Pierrick Bouvier , Mark Burton , Daniel Henrique Barboza , qemu-arm@nongnu.org, Laurent Vivier , Alexander Graf , Ilya Leoshkevich , Richard Henderson , Marco Liebel , Halil Pasic , Thomas Huth , qemu-s390x@nongnu.org, Cameron Esfahani , Alexandre Iooss , Nicholas Piggin , Roman Bolshakov , "Dr. David Alan Gilbert" , Marcelo Tosatti , Mahmoud Mandour , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PATCH v2 08/12] plugins: add time control API Date: Thu, 20 Jun 2024 16:22:16 +0100 Message-Id: <20240620152220.2192768-9-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240620152220.2192768-1-alex.bennee@linaro.org> References: <20240620152220.2192768-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, T_SCC_BODY_TEXT_LINE=-0.01 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 Expose the ability to control time through the plugin API. Only one plugin can control time so it has to request control when loaded. There are probably more corner cases to catch here. Signed-off-by: Pierrick Bouvier [AJB: tweaked user-mode handling, merged QEMU_PLUGIN_API fix] Signed-off-by: Alex Bennée Message-Id: <20240530220610.1245424-6-pierrick.bouvier@linaro.org> Reviewed-by: Alwalid Salama --- plugins/next - make qemu_plugin_update_ns a NOP in user-mode v2 - remove From: header - merged in plugins: missing QEMU_PLUGIN_API for time control --- include/qemu/qemu-plugin.h | 27 +++++++++++++++++++++++++++ plugins/api.c | 35 +++++++++++++++++++++++++++++++++++ plugins/qemu-plugins.symbols | 2 ++ 3 files changed, 64 insertions(+) diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h index 95703d8fec..c71c705b69 100644 --- a/include/qemu/qemu-plugin.h +++ b/include/qemu/qemu-plugin.h @@ -661,6 +661,33 @@ void qemu_plugin_register_vcpu_mem_inline_per_vcpu( qemu_plugin_u64 entry, uint64_t imm); +/** + * qemu_plugin_request_time_control() - request the ability to control time + * + * This grants the plugin the ability to control system time. Only one + * plugin can control time so if multiple plugins request the ability + * all but the first will fail. + * + * Returns an opaque handle or NULL if fails + */ +QEMU_PLUGIN_API +const void *qemu_plugin_request_time_control(void); + +/** + * qemu_plugin_update_ns() - update system emulation time + * @handle: opaque handle returned by qemu_plugin_request_time_control() + * @time: time in nanoseconds + * + * This allows an appropriately authorised plugin (i.e. holding the + * time control handle) to move system time forward to @time. For + * user-mode emulation the time is not changed by this as all reported + * time comes from the host kernel. + * + * Start time is 0. + */ +QEMU_PLUGIN_API +void qemu_plugin_update_ns(const void *handle, int64_t time); + typedef void (*qemu_plugin_vcpu_syscall_cb_t)(qemu_plugin_id_t id, unsigned int vcpu_index, int64_t num, uint64_t a1, uint64_t a2, diff --git a/plugins/api.c b/plugins/api.c index 6bdb26bbe3..4431a0ea7e 100644 --- a/plugins/api.c +++ b/plugins/api.c @@ -39,6 +39,7 @@ #include "qemu/main-loop.h" #include "qemu/plugin.h" #include "qemu/log.h" +#include "qemu/timer.h" #include "tcg/tcg.h" #include "exec/exec-all.h" #include "exec/gdbstub.h" @@ -583,3 +584,37 @@ uint64_t qemu_plugin_u64_sum(qemu_plugin_u64 entry) } return total; } + +/* + * Time control + */ +static bool has_control; + +const void *qemu_plugin_request_time_control(void) +{ + if (!has_control) { + has_control = true; + return &has_control; + } + return NULL; +} + +#ifdef CONFIG_SOFTMMU +static void advance_virtual_time__async(CPUState *cpu, run_on_cpu_data data) +{ + int64_t new_time = data.host_ulong; + qemu_clock_advance_virtual_time(new_time); +} +#endif + +void qemu_plugin_update_ns(const void *handle, int64_t new_time) +{ +#ifdef CONFIG_SOFTMMU + if (handle == &has_control) { + /* Need to execute out of cpu_exec, so bql can be locked. */ + async_run_on_cpu(current_cpu, + advance_virtual_time__async, + RUN_ON_CPU_HOST_ULONG(new_time)); + } +#endif +} diff --git a/plugins/qemu-plugins.symbols b/plugins/qemu-plugins.symbols index aa0a77a319..ca773d8d9f 100644 --- a/plugins/qemu-plugins.symbols +++ b/plugins/qemu-plugins.symbols @@ -38,6 +38,7 @@ qemu_plugin_register_vcpu_tb_exec_cond_cb; qemu_plugin_register_vcpu_tb_exec_inline_per_vcpu; qemu_plugin_register_vcpu_tb_trans_cb; + qemu_plugin_request_time_control; qemu_plugin_reset; qemu_plugin_scoreboard_free; qemu_plugin_scoreboard_find; @@ -51,5 +52,6 @@ qemu_plugin_u64_set; qemu_plugin_u64_sum; qemu_plugin_uninstall; + qemu_plugin_update_ns; qemu_plugin_vcpu_for_each; }; From patchwork Thu Jun 20 15:22:17 2024 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: 805985 Delivered-To: patch@linaro.org Received: by 2002:a5d:508d:0:b0:362:4979:7f74 with SMTP id a13csp345985wrt; Thu, 20 Jun 2024 08:24:05 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWhyI0z9Sfrclbrxj/oXanF/plbQgtGaICRfXlmsN1QoujmLvOY2+AOL7zAdprpVDevvwIP+MMJSysm5iyU45AC X-Google-Smtp-Source: AGHT+IE1EndobiZd0OeqY8Hig0j/aRpx3q/6xzlGk7SEUuUDZjAb/XPaEcngfq18da7ZbkzXByS8 X-Received: by 2002:a81:9303:0:b0:617:c383:42ac with SMTP id 00721157ae682-63a8faf1da8mr52993387b3.51.1718897044151; Thu, 20 Jun 2024 08:24:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1718897044; cv=none; d=google.com; s=arc-20160816; b=a239lIWSuOkERygCPJ6vdMKNMN+2QFngSmuFGFvD1Kvv43FL0xDzwB6NTnwKjFTCmE Hs3e+rLHBtTyEPGO7IQ/3HKFtPrIVajj/eakHg7WrKhZf+2JsqTna7WV8ygFN4IdOHL6 zhGUAO68yEILw9LPMMqepuedAx/AGFOn9WOAVMrsyI3GzpbfmE1e/xhHESOax6pCn70v 7Xwk9XCT32K060y6b63Y/ySbIbqpgxoSUWU1nJBh+K3138crAzKmCZ+3mRiVY6kzQijJ RKZEl1YJlMw50ndfyxG0PpC6MyLS/XVuBnr9T0TRly66KJBWF+IXvIIFfPNuTa98wLfI jgwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=ZQ8CEbgFXQ50Jx+/zMrlpDCus+bU22jqqVwm5sZfxvc=; fh=qYUyA+SSE+X3fQR5X1u+SwltJ/ArWqMeAeFp+rGIm4A=; b=Fxdq0+rQ7qDI2U5ke7+SmXgFoSde80u+oxyLDRABhDXKl/rYnyBz5TZLzrogsaIYPe i+iCXcdd1vqkK9GZCghcg+xK+NWVeYnCzSZgn/9GhzJLFq9Q+25RSntG1N6G7kBXqngL +iHpgZhvpjI1RsoCC9RLyDcwxrfvbThF4zxrs9GHhO8giozhOophV7q9J/PuSMKpOChV bvO2TeolRFnMnmMZsf4jQ52s/J2lM07o5MLZHB1KSRtcYWbibdCfqtfyOOT6t/cNOMwP G5qlM6xOTCTriu+q42b7uACh3dvuRUlalUAH+/8b7KYVbsb75PwUYe3CcW6y1/fBuTfQ h7zw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qyTwHgqY; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-441f2fb79besi169425951cf.429.2024.06.20.08.24.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Jun 2024 08:24:04 -0700 (PDT) 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=qyTwHgqY; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sKJcZ-00064M-Ro; Thu, 20 Jun 2024 11:22:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sKJcX-0005zm-Iv for qemu-devel@nongnu.org; Thu, 20 Jun 2024 11:22:41 -0400 Received: from mail-ej1-x634.google.com ([2a00:1450:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sKJcU-00081J-BT for qemu-devel@nongnu.org; Thu, 20 Jun 2024 11:22:41 -0400 Received: by mail-ej1-x634.google.com with SMTP id a640c23a62f3a-a6fb341a7f2so130464666b.1 for ; Thu, 20 Jun 2024 08:22:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718896957; x=1719501757; 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=ZQ8CEbgFXQ50Jx+/zMrlpDCus+bU22jqqVwm5sZfxvc=; b=qyTwHgqYX6E3DfIN8VEFe6Y71TU8F1nmaGduFYVpRCLkMoaXz96+iyyJkslvLOpOp4 FF6nJjLkfCfRa7E5aEdJXHH95U5DYD6cvHa66P5t8rvUYTnjJdfet2SCynF4UBXXDYrZ aS5zd96v3Qof9gigW6Q12xT7tEmM/oQj5zBEgRdzFaWC3zk0f6hOzm3tBEP0dDX67vnl 40vEMer0v09Z2vn0AykHjiuKoAvdFl6rUPv+eeAUx1kkFTQMI/MZBleEKSTKoakEWBZc WRpE7epu6uFMgu1urh9ZHM2zVTyFA8m0y+UVGgrk7y8rg9QqS698kAzlu8JF3WbXcV5q AGhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718896957; x=1719501757; 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=ZQ8CEbgFXQ50Jx+/zMrlpDCus+bU22jqqVwm5sZfxvc=; b=aX8Ogj4VUdPP+PB/m7GkaOvtt8q4vBey5l22sRYE9RCbc+j/bHDMc15enMG8vOYeK5 DK3jzI58h2sQdYHE5AyiWPadC+15EqT/tcykGYBymAuaUg6hOZcCvYUaxYRYJ+BwzvAL 6fd6TPaJMDcnEq6y6Bc/lMsmecUOAtnd/xNoHWl6Ci4hosZNZ+0vTedhNZfFiecgTZTN UJTaA4qbxjI+y1O1meMOR9nbmFEnpipfnPV1I0XVckFgqsMnTMCiOLV86rN9/FWbZiIU xqhjBRDLbQsLH52BGWsT3gS/iwTHvxFGJkhvZPHn+3FQshkNw8+PieQH+OhhqP0tY1U3 7HZw== X-Gm-Message-State: AOJu0YyOzbB/+Q9UBDURMXIuBJuscHLHL5mW+9zzwNYCFc2wx2rXhF3B 6fS3ZSYuog7wV/4/n7mt3MqLCKR3Sf49QlC5BgqRNjdTm/ZkSDYo4G0bCU4hXtk= X-Received: by 2002:a17:907:a092:b0:a6f:4ae3:5327 with SMTP id a640c23a62f3a-a6fab609e5dmr478736466b.15.1718896956518; Thu, 20 Jun 2024 08:22:36 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a6f56ed3590sm782032166b.98.2024.06.20.08.22.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jun 2024 08:22:29 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id E6E735FA08; Thu, 20 Jun 2024 16:22:21 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Peter Maydell , kvm@vger.kernel.org, qemu-ppc@nongnu.org, Christian Borntraeger , Paolo Bonzini , Jamie Iles , David Hildenbrand , =?utf-8?q?Alex_Benn=C3=A9e?= , Pierrick Bouvier , Mark Burton , Daniel Henrique Barboza , qemu-arm@nongnu.org, Laurent Vivier , Alexander Graf , Ilya Leoshkevich , Richard Henderson , Marco Liebel , Halil Pasic , Thomas Huth , qemu-s390x@nongnu.org, Cameron Esfahani , Alexandre Iooss , Nicholas Piggin , Roman Bolshakov , "Dr. David Alan Gilbert" , Marcelo Tosatti , Mahmoud Mandour , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PATCH v2 09/12] plugins: add migration blocker Date: Thu, 20 Jun 2024 16:22:17 +0100 Message-Id: <20240620152220.2192768-10-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240620152220.2192768-1-alex.bennee@linaro.org> References: <20240620152220.2192768-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::634; envelope-from=alex.bennee@linaro.org; helo=mail-ej1-x634.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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 If the plugin in controlling time there is some state that might be missing from the plugin tracking it. Migration is unlikely to work in this case so lets put a migration blocker in to let the user know if they try. Signed-off-by: Alex Bennée Suggested-by: "Dr. David Alan Gilbert" Reviewed-by: Thomas Huth Reviewed-by: Richard Henderson Reviewed-by: Alwalid Salama --- plugins/api.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugins/api.c b/plugins/api.c index 4431a0ea7e..c4239153af 100644 --- a/plugins/api.c +++ b/plugins/api.c @@ -47,6 +47,8 @@ #include "disas/disas.h" #include "plugin.h" #ifndef CONFIG_USER_ONLY +#include "qapi/error.h" +#include "migration/blocker.h" #include "exec/ram_addr.h" #include "qemu/plugin-memory.h" #include "hw/boards.h" @@ -589,11 +591,17 @@ uint64_t qemu_plugin_u64_sum(qemu_plugin_u64 entry) * Time control */ static bool has_control; +Error *migration_blocker; const void *qemu_plugin_request_time_control(void) { if (!has_control) { has_control = true; +#ifdef CONFIG_SOFTMMU + error_setg(&migration_blocker, + "TCG plugin time control does not support migration"); + migrate_add_blocker(&migration_blocker, NULL); +#endif return &has_control; } return NULL; From patchwork Thu Jun 20 15:22:18 2024 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: 805980 Delivered-To: patch@linaro.org Received: by 2002:a5d:508d:0:b0:362:4979:7f74 with SMTP id a13csp345569wrt; Thu, 20 Jun 2024 08:23:13 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXC7RYcKADHq/1okDSuQUa4GoKrbwAMK4leE7+PM27t7DXodnCXvXsBklMzJ3Lh5QiEQ164fAwFoMy0hUafH0Sk X-Google-Smtp-Source: AGHT+IGCfiex/dxq6FCDqNteGcySt+zOl7USdRQS6X+dyL5hhnDaJpgoAY4tf6OsMRG+ntwhzGSB X-Received: by 2002:ad4:4bb0:0:b0:6b4:ee84:905e with SMTP id 6a1803df08f44-6b501ea4245mr53422566d6.43.1718896993210; Thu, 20 Jun 2024 08:23:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1718896993; cv=none; d=google.com; s=arc-20160816; b=zk45upkcglDNLm2YFbWVx9I3HUr6k+2/TXbhfpQUUhpS3k+INzQaTBaRgruwZiYX4D jpCTYu3c8NrkgtMq7IeKQyR3KVVMM2g4K74+SYyAS9hUwR3ES3f53ivGx8aCl2GskqJf v7ro1yCz2kb4dwClNGxe0EX52C73q9sdAd55Xf4T6xvhWQbLCbqee6o3TJPWfeQh+sEX kCB/lDtmSu/w37MiUPfzFu3+mEx8QIZTSjhB27SnRbz+gu5DwrmtEa1JpZnevMCVnBQs RN2BmDe1Q49I1TRDPjUQ5BbrHuHKCk463sRtX0KpHA5NKz+kyjxNXSawiJM0FU5cq1tc lEcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=aTqVMPQXWo8mkGU1ZZQCTroEdUrbxvLcJ6ei12/57OI=; fh=qYUyA+SSE+X3fQR5X1u+SwltJ/ArWqMeAeFp+rGIm4A=; b=TW5uc61hHPw/ULA1xtnxI6m6M022XQPiaDtxprevkhmDfJ8VVWr/2QxbPmVupbe1Pa Qk0DPqLfjShI3/b9KbqQ6loZO+5m79zqxvvp2+uu/9VtVLK8UwV/KuFMR61/B9c6NY23 BI29DS0zs+ejIIKmVlvNeEBei63JFyDzG6TvXzgfSsLrtnKF9EJ9xa2diXvVHEpoSNw7 nyU8BTKMlcd4yRps835iaatsbfXaepZynbaxOn6Oz4i21EAMyc6qzheb0mEYua+WWUCO 2qsAxTpa52wfbQ2pNEIdck8zvdTrZ95x4uBbyPMmBlwfr0XvGETwIG8lqHSvAfH6fzVF zkLA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=d5uksvkY; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6b4f7bb6c4esi63076026d6.289.2024.06.20.08.23.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Jun 2024 08:23:13 -0700 (PDT) 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=d5uksvkY; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sKJca-00065r-JL; Thu, 20 Jun 2024 11:22:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sKJcZ-00063Y-6X for qemu-devel@nongnu.org; Thu, 20 Jun 2024 11:22:43 -0400 Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sKJcV-00081d-41 for qemu-devel@nongnu.org; Thu, 20 Jun 2024 11:22:42 -0400 Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-52bc27cfb14so1407221e87.0 for ; Thu, 20 Jun 2024 08:22:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718896957; x=1719501757; 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=aTqVMPQXWo8mkGU1ZZQCTroEdUrbxvLcJ6ei12/57OI=; b=d5uksvkY3FBaCKVQz4bZ0+EHZEK+yup7oPLybmPtY8AfpExGc4lfiJCw6jhQ7ChbRk +fpwnJPRI3tudfvZtnZnen7hrZRSR+tjkbTEKS4kzJ0ogR8IgSbznrZO5I5R5oA3ZGs/ xZWO8TLp3bxJgDF0AFJ4QI6xLCWCbYNQFaHECGP42+kwSKJtGSGPtPpN3cFEyLwLvQRy oF/XJYyc+z+PJ3UsPpvcJhmRBL1uYZglEH1B7UDG8yHpSKm+PVs0mBxwkoLLydb7EKSo fRkKzelUFTrtBlR9JBiq7UO8oas218dacl+1X+xTtmR5P6HPlnTvhkXzfOF7o1CHCL41 Ri1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718896957; x=1719501757; 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=aTqVMPQXWo8mkGU1ZZQCTroEdUrbxvLcJ6ei12/57OI=; b=V4xfOuyYSQwxryRIIK5uMMXjjhBCFMQUjT4KEu2Lt8cQeieVtcK9ps+KK8II/Qr+Lp iVmZvz0yzk5PqtiAdgBTtc5jOOSW/Nx8qpGE3Ne/kAK7UJ4an/tC0R4XL6aICELvk9+e Vl/1Pg5H0uHO5yPbEWaaQaAUyCMBGfHOikVm1EE45NT8sb66lkleb0rYTiHeRGsmHBHZ UjhAbXWP39W8DgE/SUqNIdSaB7H/g6B1hLsB6gGFsPAEDNO0aJvTa8N83bcUatyvJHlu PPo5JUmn4/9NC+cA6NUVO2vM+jLlDy/hA4HGu8NZxScJJNpAuZcAqx94kaX0+TVuLqru 3w2A== X-Gm-Message-State: AOJu0YzKofaMvpTyO8Q5EkObvGcgdziKqOZbRHcooHonIthF4I8vicCi XNIRLsZHR64IwaBht+HQYcg3DPwseSQ5YYGvLtfRO6TO2mNbmzaHXmjgB10LmpQ= X-Received: by 2002:a05:6512:3994:b0:52c:cb8d:637d with SMTP id 2adb3069b0e04-52ccb8d6426mr5442380e87.5.1718896957381; Thu, 20 Jun 2024 08:22:37 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a6f756ee325sm552818766b.90.2024.06.20.08.22.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jun 2024 08:22:34 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 0C60D5FA0A; Thu, 20 Jun 2024 16:22:22 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Peter Maydell , kvm@vger.kernel.org, qemu-ppc@nongnu.org, Christian Borntraeger , Paolo Bonzini , Jamie Iles , David Hildenbrand , =?utf-8?q?Alex_Benn=C3=A9e?= , Pierrick Bouvier , Mark Burton , Daniel Henrique Barboza , qemu-arm@nongnu.org, Laurent Vivier , Alexander Graf , Ilya Leoshkevich , Richard Henderson , Marco Liebel , Halil Pasic , Thomas Huth , qemu-s390x@nongnu.org, Cameron Esfahani , Alexandre Iooss , Nicholas Piggin , Roman Bolshakov , "Dr. David Alan Gilbert" , Marcelo Tosatti , Mahmoud Mandour , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PATCH v2 10/12] contrib/plugins: add Instructions Per Second (IPS) example for cost modeling Date: Thu, 20 Jun 2024 16:22:18 +0100 Message-Id: <20240620152220.2192768-11-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240620152220.2192768-1-alex.bennee@linaro.org> References: <20240620152220.2192768-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::133; envelope-from=alex.bennee@linaro.org; helo=mail-lf1-x133.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=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: Pierrick Bouvier This plugin uses the new time control interface to make decisions about the state of time during the emulation. The algorithm is currently very simple. The user specifies an ips rate which applies per core. If the core runs ahead of its allocated execution time the plugin sleeps for a bit to let real time catch up. Either way time is updated for the emulation as a function of total executed instructions with some adjustments for cores that idle. Examples -------- Slow down execution of /bin/true: $ num_insn=$(./build/qemu-x86_64 -plugin ./build/tests/plugin/libinsn.so -d plugin /bin/true |& grep total | sed -e 's/.*: //') $ time ./build/qemu-x86_64 -plugin ./build/contrib/plugins/libips.so,ips=$(($num_insn/4)) /bin/true real 4.000s Boot a Linux kernel simulating a 250MHz cpu: $ /build/qemu-system-x86_64 -kernel /boot/vmlinuz-6.1.0-21-amd64 -append "console=ttyS0" -plugin ./build/contrib/plugins/libips.so,ips=$((250*1000*1000)) -smp 1 -m 512 check time until kernel panic on serial0 Tested in system mode by booting a full debian system, and using: $ sysbench cpu run Performance decrease linearly with the given number of ips. Signed-off-by: Pierrick Bouvier Signed-off-by: Alex Bennée Message-Id: <20240530220610.1245424-7-pierrick.bouvier@linaro.org> Reviewed-by: Alwalid Salama --- v2 - more explicit Instructions Per Second (IPS)! --- contrib/plugins/ips.c | 164 +++++++++++++++++++++++++++++++++++++++ contrib/plugins/Makefile | 1 + 2 files changed, 165 insertions(+) create mode 100644 contrib/plugins/ips.c diff --git a/contrib/plugins/ips.c b/contrib/plugins/ips.c new file mode 100644 index 0000000000..29fa556d0f --- /dev/null +++ b/contrib/plugins/ips.c @@ -0,0 +1,164 @@ +/* + * Instructions Per Second (IPS) rate limiting plugin. + * + * This plugin can be used to restrict the execution of a system to a + * particular number of Instructions Per Second (IPS). This controls + * time as seen by the guest so while wall-clock time may be longer + * from the guests point of view time will pass at the normal rate. + * + * This uses the new plugin API which allows the plugin to control + * system time. + * + * Copyright (c) 2023 Linaro Ltd + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include +#include +#include + +QEMU_PLUGIN_EXPORT int qemu_plugin_version = QEMU_PLUGIN_VERSION; + +/* how many times do we update time per sec */ +#define NUM_TIME_UPDATE_PER_SEC 10 +#define NSEC_IN_ONE_SEC (1000 * 1000 * 1000) + +static GMutex global_state_lock; + +static uint64_t max_insn_per_second = 1000 * 1000 * 1000; /* ips per core, per second */ +static uint64_t max_insn_per_quantum; /* trap every N instructions */ +static int64_t virtual_time_ns; /* last set virtual time */ + +static const void *time_handle; + +typedef struct { + uint64_t total_insn; + uint64_t quantum_insn; /* insn in last quantum */ + int64_t last_quantum_time; /* time when last quantum started */ +} vCPUTime; + +struct qemu_plugin_scoreboard *vcpus; + +/* return epoch time in ns */ +static int64_t now_ns(void) +{ + return g_get_real_time() * 1000; +} + +static uint64_t num_insn_during(int64_t elapsed_ns) +{ + double num_secs = elapsed_ns / (double) NSEC_IN_ONE_SEC; + return num_secs * (double) max_insn_per_second; +} + +static int64_t time_for_insn(uint64_t num_insn) +{ + double num_secs = (double) num_insn / (double) max_insn_per_second; + return num_secs * (double) NSEC_IN_ONE_SEC; +} + +static void update_system_time(vCPUTime *vcpu) +{ + int64_t elapsed_ns = now_ns() - vcpu->last_quantum_time; + uint64_t max_insn = num_insn_during(elapsed_ns); + + if (vcpu->quantum_insn >= max_insn) { + /* this vcpu ran faster than expected, so it has to sleep */ + uint64_t insn_advance = vcpu->quantum_insn - max_insn; + uint64_t time_advance_ns = time_for_insn(insn_advance); + int64_t sleep_us = time_advance_ns / 1000; + g_usleep(sleep_us); + } + + vcpu->total_insn += vcpu->quantum_insn; + vcpu->quantum_insn = 0; + vcpu->last_quantum_time = now_ns(); + + /* based on total number of instructions, what should be the new time? */ + int64_t new_virtual_time = time_for_insn(vcpu->total_insn); + + g_mutex_lock(&global_state_lock); + + /* Time only moves forward. Another vcpu might have updated it already. */ + if (new_virtual_time > virtual_time_ns) { + qemu_plugin_update_ns(time_handle, new_virtual_time); + virtual_time_ns = new_virtual_time; + } + + g_mutex_unlock(&global_state_lock); +} + +static void vcpu_init(qemu_plugin_id_t id, unsigned int cpu_index) +{ + vCPUTime *vcpu = qemu_plugin_scoreboard_find(vcpus, cpu_index); + vcpu->total_insn = 0; + vcpu->quantum_insn = 0; + vcpu->last_quantum_time = now_ns(); +} + +static void vcpu_exit(qemu_plugin_id_t id, unsigned int cpu_index) +{ + vCPUTime *vcpu = qemu_plugin_scoreboard_find(vcpus, cpu_index); + update_system_time(vcpu); +} + +static void every_quantum_insn(unsigned int cpu_index, void *udata) +{ + vCPUTime *vcpu = qemu_plugin_scoreboard_find(vcpus, cpu_index); + g_assert(vcpu->quantum_insn >= max_insn_per_quantum); + update_system_time(vcpu); +} + +static void vcpu_tb_trans(qemu_plugin_id_t id, struct qemu_plugin_tb *tb) +{ + size_t n_insns = qemu_plugin_tb_n_insns(tb); + qemu_plugin_u64 quantum_insn = + qemu_plugin_scoreboard_u64_in_struct(vcpus, vCPUTime, quantum_insn); + /* count (and eventually trap) once per tb */ + qemu_plugin_register_vcpu_tb_exec_inline_per_vcpu( + tb, QEMU_PLUGIN_INLINE_ADD_U64, quantum_insn, n_insns); + qemu_plugin_register_vcpu_tb_exec_cond_cb( + tb, every_quantum_insn, + QEMU_PLUGIN_CB_NO_REGS, QEMU_PLUGIN_COND_GE, + quantum_insn, max_insn_per_quantum, NULL); +} + +static void plugin_exit(qemu_plugin_id_t id, void *udata) +{ + qemu_plugin_scoreboard_free(vcpus); +} + +QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin_id_t id, + const qemu_info_t *info, int argc, + char **argv) +{ + for (int i = 0; i < argc; i++) { + char *opt = argv[i]; + g_auto(GStrv) tokens = g_strsplit(opt, "=", 2); + if (g_strcmp0(tokens[0], "ips") == 0) { + max_insn_per_second = g_ascii_strtoull(tokens[1], NULL, 10); + if (!max_insn_per_second && errno) { + fprintf(stderr, "%s: couldn't parse %s (%s)\n", + __func__, tokens[1], g_strerror(errno)); + return -1; + } + } else { + fprintf(stderr, "option parsing failed: %s\n", opt); + return -1; + } + } + + vcpus = qemu_plugin_scoreboard_new(sizeof(vCPUTime)); + max_insn_per_quantum = max_insn_per_second / NUM_TIME_UPDATE_PER_SEC; + + time_handle = qemu_plugin_request_time_control(); + g_assert(time_handle); + + qemu_plugin_register_vcpu_tb_trans_cb(id, vcpu_tb_trans); + qemu_plugin_register_vcpu_init_cb(id, vcpu_init); + qemu_plugin_register_vcpu_exit_cb(id, vcpu_exit); + qemu_plugin_register_atexit_cb(id, plugin_exit, NULL); + + return 0; +} diff --git a/contrib/plugins/Makefile b/contrib/plugins/Makefile index 0b64d2c1e3..449ead1130 100644 --- a/contrib/plugins/Makefile +++ b/contrib/plugins/Makefile @@ -27,6 +27,7 @@ endif NAMES += hwprofile NAMES += cache NAMES += drcov +NAMES += ips ifeq ($(CONFIG_WIN32),y) SO_SUFFIX := .dll From patchwork Thu Jun 20 15:22:19 2024 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: 805984 Delivered-To: patch@linaro.org Received: by 2002:a5d:508d:0:b0:362:4979:7f74 with SMTP id a13csp345925wrt; Thu, 20 Jun 2024 08:23:58 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU2ztCbGzDbQWUhIkv5W9fTBfe22R9+Fx/eBFUF67ainE55GzmJYidKj45ZnL3FkgkhvQ5RABYTGfe1TYIqS9Eq X-Google-Smtp-Source: AGHT+IFG2esEsGZ6GFxS+VMTV6lrCLJMXqrABQxpZikap0eQzR2DJP1lXG47IVhfEKpBmC7H3XbV X-Received: by 2002:a05:6808:2221:b0:3d2:18fd:18d2 with SMTP id 5614622812f47-3d51ba24202mr6304056b6e.33.1718897038408; Thu, 20 Jun 2024 08:23:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1718897038; cv=none; d=google.com; s=arc-20160816; b=imTA04ilY+pGUCF+pk3wvoe9ch2Qa6WljYPvqHKSzzIGrzfKzdpRTYwCItExaI/nfc VIiFsejy2C/OkQtzDos8mJwc8IqpN1jNNyRpkwMbqElFe19kAFNQvpR7KM7wq6z1p2HU P908TCvqx5z0Mu/x68F+u5dmxWbroBu7zlM7+ZLyywsL2+2OO00nlrJO1ZjUkYxOOtjl oNb4DiBsKo1j124VW6FBkiVeL7WwJOYQzcf/4UX2JjiSZFq5aIjL8CFnUpasB57JTex6 oKPNFuDRKA2KRW4/RtKY4aC3gut4UL7AyqR77mcXa2WNhAOX603Nc8lvDO8Vq0pmTZG8 1a5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=97cycViE9OQK6SdY90/SywB1oI0H0vp7Y3hsl3HXbfM=; fh=qYUyA+SSE+X3fQR5X1u+SwltJ/ArWqMeAeFp+rGIm4A=; b=y0kMIAC2DFl1M9+7PitUH7uQo5nPxxHQ4qr3zKs7+nvUbZK+TNqHgKwGQX5n+2kQK4 VBOPLFJf8yoOp3NetKR2X5SODiICMR1fu3koXrwamaLKI8wrjjIADyCFoqppHA5bjstO e19+Cf1zbHbe17uPqvXwNVHvUSh4bA8WezbZUt5tYFXcWxn+Y52JLIM+BYkPEjxNbzZo q/KQ+3X6bH3DWq6+L/X79OPumu58VKoqjPgIbwos5cRaIkG6YwdvZONpXp5aGwEBGSrH cuem1XdLW9mlGNcoL+yypDuU8Yd3yIMhFods6g2ZSMPXs70xA54WSCuIoZS/7diQuMR1 TVWw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tRgGGgEo; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-798abe59706si1723161985a.616.2024.06.20.08.23.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Jun 2024 08:23:58 -0700 (PDT) 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=tRgGGgEo; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sKJci-0006B6-Br; Thu, 20 Jun 2024 11:22:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sKJca-00065z-QE for qemu-devel@nongnu.org; Thu, 20 Jun 2024 11:22:44 -0400 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 1sKJcX-00082t-M3 for qemu-devel@nongnu.org; Thu, 20 Jun 2024 11:22:44 -0400 Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-a6ef46d25efso118102966b.0 for ; Thu, 20 Jun 2024 08:22:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718896960; x=1719501760; 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=97cycViE9OQK6SdY90/SywB1oI0H0vp7Y3hsl3HXbfM=; b=tRgGGgEoQAPPranslMuJkrxERNVKM4LbFwoJjPjOGAyBDshZJOhoO1/t7YNLPbzkIs 71QE062moNcbGO+9BCSE6z2yC+VvpnSax30w38Kap1BOG6J6XGneKPwqREoQ3i4+1oXm eAq7d4nfO5RVhBNQvZVD/+n0NV1iDw4bNKTSi+uLJ9IQ33UzFK3cXUGlwfrYbfOaVC8G r3DFnwtzq0kicQX8JATzqreOIiVzZ373w4nN5j2vnDpRYU2Rxzzv2uxLlatJtvUDOhoa KfrYDDgAA5oemJBM1LN4U6O4px1rJ4TjbVfinHUyJOD8rn2EfUGj67SihAJZ7gVy6Ja1 h3aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718896960; x=1719501760; 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=97cycViE9OQK6SdY90/SywB1oI0H0vp7Y3hsl3HXbfM=; b=YZtKT+vaK6bUhibqv8FPc8ezIDTW2CuzOnKwoU+xZ7Ax2U9+LZRqHBfwQ39qywCFGB LmGV6U5JZGOWKSg8nNxZpV0YSmoYrWBa3QysJkCEWXsj6A8hwrelcMkfFqg7d24ewdzE +URaZHfb5Gj1xvuI5izkF0Ltqjsb5d/vAcn5Y+s0DwfcRbHmCXB+qukpbbvDfUX4Kgv1 n4hcMxCWQ7JeZr0X7yX+y7393b9MHxsXxdtrmCkDKOoY/NW0M/SUIUJ170h0nQxQ0OQN +pUSJnQ9tAohlsjnGHa77qytqEPDoqFVlsxDRZ8GVMfer+bhTivEoPzSZFwIK+/0B3Zt Evqw== X-Gm-Message-State: AOJu0YyKeg3wR0mDrdFQ7kVMJRG0htS5F2fuGO2xr9fAVmaSj5hf7DYX vW0nDD6q5AwvbhnWexFnJ5b2AWRfrxEUqSj/kKFT73m1JeZOKA1lZ2VElchB7zU= X-Received: by 2002:a17:906:c1d1:b0:a6f:b9d3:343a with SMTP id a640c23a62f3a-a6fb9d3383cmr198180066b.71.1718896960112; Thu, 20 Jun 2024 08:22:40 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a6f56ed369bsm771539666b.100.2024.06.20.08.22.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jun 2024 08:22:36 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 259085FA0C; Thu, 20 Jun 2024 16:22:22 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Peter Maydell , kvm@vger.kernel.org, qemu-ppc@nongnu.org, Christian Borntraeger , Paolo Bonzini , Jamie Iles , David Hildenbrand , =?utf-8?q?Alex_Benn=C3=A9e?= , Pierrick Bouvier , Mark Burton , Daniel Henrique Barboza , qemu-arm@nongnu.org, Laurent Vivier , Alexander Graf , Ilya Leoshkevich , Richard Henderson , Marco Liebel , Halil Pasic , Thomas Huth , qemu-s390x@nongnu.org, Cameron Esfahani , Alexandre Iooss , Nicholas Piggin , Roman Bolshakov , "Dr. David Alan Gilbert" , Marcelo Tosatti , Mahmoud Mandour , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PATCH v2 11/12] plugins: fix inject_mem_cb rw masking Date: Thu, 20 Jun 2024 16:22:19 +0100 Message-Id: <20240620152220.2192768-12-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240620152220.2192768-1-alex.bennee@linaro.org> References: <20240620152220.2192768-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, T_SCC_BODY_TEXT_LINE=-0.01 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: Pierrick Bouvier These are not booleans, but masks. Issue found by Richard Henderson. Fixes: f86fd4d8721 ("plugins: distinct types for callbacks") Signed-off-by: Richard Henderson Signed-off-by: Pierrick Bouvier Message-Id: <20240612195147.93121-3-pierrick.bouvier@linaro.org> Signed-off-by: Alex Bennée Reviewed-by: Alwalid Salama --- accel/tcg/plugin-gen.c | 4 ++-- plugins/core.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/accel/tcg/plugin-gen.c b/accel/tcg/plugin-gen.c index cc1634e7a6..b6bae32b99 100644 --- a/accel/tcg/plugin-gen.c +++ b/accel/tcg/plugin-gen.c @@ -240,13 +240,13 @@ static void inject_mem_cb(struct qemu_plugin_dyn_cb *cb, { switch (cb->type) { case PLUGIN_CB_MEM_REGULAR: - if (rw && cb->regular.rw) { + if (rw & cb->regular.rw) { gen_mem_cb(&cb->regular, meminfo, addr); } break; case PLUGIN_CB_INLINE_ADD_U64: case PLUGIN_CB_INLINE_STORE_U64: - if (rw && cb->inline_insn.rw) { + if (rw & cb->inline_insn.rw) { inject_cb(cb); } break; diff --git a/plugins/core.c b/plugins/core.c index badede28cf..9d737d8278 100644 --- a/plugins/core.c +++ b/plugins/core.c @@ -589,7 +589,7 @@ void qemu_plugin_vcpu_mem_cb(CPUState *cpu, uint64_t vaddr, switch (cb->type) { case PLUGIN_CB_MEM_REGULAR: - if (rw && cb->regular.rw) { + if (rw & cb->regular.rw) { cb->regular.f.vcpu_mem(cpu->cpu_index, make_plugin_meminfo(oi, rw), vaddr, cb->regular.userp); @@ -597,7 +597,7 @@ void qemu_plugin_vcpu_mem_cb(CPUState *cpu, uint64_t vaddr, break; case PLUGIN_CB_INLINE_ADD_U64: case PLUGIN_CB_INLINE_STORE_U64: - if (rw && cb->inline_insn.rw) { + if (rw & cb->inline_insn.rw) { exec_inline_op(cb->type, &cb->inline_insn, cpu->cpu_index); } break; From patchwork Thu Jun 20 15:22:20 2024 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: 805983 Delivered-To: patch@linaro.org Received: by 2002:a5d:508d:0:b0:362:4979:7f74 with SMTP id a13csp345922wrt; Thu, 20 Jun 2024 08:23:58 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWXpEK3Plzv7DmyhjIRGfCRwdVreDMjjiAZiY6xNV6FedOaFxZqPnwmOCG04jgXpQog0CF5kHIeBEuT4lsLrAjY X-Google-Smtp-Source: AGHT+IHC6+9XkjqvA//TZqEcYUNZxQgIqpeyQHA4GNzqcB7SOP1S8MGia4WD4cUCgPPiHhQ3d1HK X-Received: by 2002:a05:620a:448b:b0:794:cdc3:949a with SMTP id af79cd13be357-79bb3ef2243mr583117885a.78.1718897038403; Thu, 20 Jun 2024 08:23:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1718897038; cv=none; d=google.com; s=arc-20160816; b=p+ZOsa5ZwQmPA9CaminxhgAqU+7fFHP8prEn+Kf0R4+KydhgUAyE1vn0LdclTrxf2Q 1sxvgoMh0xMWhdW/PaO6W+CgpY6+XA7CvghJ633tsCNMP/21uQCZVG1ZUR3DFeVcwsG6 8dbovAUmFbxz3GDqAGmVKOTy1QMKorJ/PCEbf1tQJLQ5q25R7X2uXU3axLGVzQfEYMvV eI1KQJCteWfBJlpIpmMTaxNY6U+7VGZpRhuYzHEa5vlsqXGlA0ThRhSDGQI7RtSah+JN bGoJx5ZEzMYLl/wXL9I3gQsfkQc6J+NPXTWgBWfxVyxdu9AWP3FDf2Uf2NmI0npmMic/ 1eoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; 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=mk0X1Wnynj7dOIA6noc/XZNsTzvKKxUiDNUzj/HAsA8=; fh=CEeBJ9j+7gfqc88m1EJETjZ6l8ELDB2GcQ0qugDAp+o=; b=iXTK2YrrUG7xA6llj8+Uiq3HNQbYxvOBvnvmIxUzFA4OkN78JWxDQGhhwzbPKWY7rE BzcglbjEZ1nRGYGpUb6Qsbsl6sYHf4F5mww6jLbg+YHZr/xvlYYMxDARXUhPasy6MCi9 zPatfxk6viCPCnpuh65Wkhaga0uJzLr4K6BCpFMJH55wn9TNknCViOwgM9QwMe/bnS23 LDbQ8y2wmOb4hDlj2eRx/V0dcikFffuLKwKD8Z/uXhgit4ovPFK8EZGCJJQcLbEnYmTd NVCJzneYS+XZ0ZySVLxOAaBRdOc5DszxBXoXNR4KeRnR34cXeXykevm/D3LMpZAEpAA8 CNoA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZzvT2ZFa; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-79bb9a4a778si417742785a.747.2024.06.20.08.23.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Jun 2024 08:23:58 -0700 (PDT) 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=ZzvT2ZFa; 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 Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sKJcb-00067Q-Tz; Thu, 20 Jun 2024 11:22:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sKJcZ-00064R-Q1 for qemu-devel@nongnu.org; Thu, 20 Jun 2024 11:22:43 -0400 Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sKJcX-00082h-B7 for qemu-devel@nongnu.org; Thu, 20 Jun 2024 11:22:43 -0400 Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-57d1679ee83so1032100a12.2 for ; Thu, 20 Jun 2024 08:22:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718896960; x=1719501760; 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=mk0X1Wnynj7dOIA6noc/XZNsTzvKKxUiDNUzj/HAsA8=; b=ZzvT2ZFaSIK0esGkPGcp/rGrJMYSL1ju0zZyVgnEZDZxEykadTO9B4Whacak2AuT99 EeXn0/T8Ql3WS5h8tRongY7fc50CI2/+dxlgsz/qOP1seRnDIlL/71TIlYrxX2dwGHxo vrywgIuvMZ55iqy8uhL8VuHmSLNBB/Y38NmFbIKZAormTyIprZfov271xShdCLqJl1kA aOXvSGJVC84pVvcPPTPnvApRMxtYb2ZX1Mdte1OvApq74fh9iJtJidJWhHMFQO6heH9r 4wJJjyKJxcKwUdzdzmkI9n7BagHL/YItf079DQo11cH8vy1w3roOtikMEYiUdCuI8j74 siHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718896960; x=1719501760; 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=mk0X1Wnynj7dOIA6noc/XZNsTzvKKxUiDNUzj/HAsA8=; b=sMTaQdA7yWi2Ew+v33sWPNWA3ypVZIB9rShZ/GBK3ku0CWr53rwplA9X195nDDbozk m4HFKx+x3+LHQLS5GUWqfQANb+f9m6iCXLG4MtxIxjNlIBOtf0OaDv+qErL5F6Qf7JQ7 1ncWHrcKFZJTInzBgJgF0zkWGXnEQfXC9XwS1o/MnW5ZJVgMtO2e+dE/2rlIOLNqDolo RQhywpqW6hnJbuTYeXTwIdkSH+SdK9gYz3k6laos1F/mmW5DVv7kMfkymCId8wyITTLf 8ok3rtD+r+jK+c//ap9g2EsSafbzE8b038Dr0LiKAuxt01IwhKXdUeoPaB9tY5BBq8NQ Oojg== X-Gm-Message-State: AOJu0Yze3G1MRhcYXQzSKQxI7TFgGsX7AFilMXMl0cgC/RosHBKTw64/ GKDsOZrRJKNpGQwn8njD4HimS91kMIn6GSoctJ/OLbN052LBIgro6iwbe/kdiG0= X-Received: by 2002:a50:d595:0:b0:57c:5874:4f74 with SMTP id 4fb4d7f45d1cf-57d07ed24b8mr3437569a12.28.1718896959461; Thu, 20 Jun 2024 08:22:39 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-57cb72da156sm9758038a12.22.2024.06.20.08.22.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jun 2024 08:22:36 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 3BD7D5FA0E; Thu, 20 Jun 2024 16:22:22 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Peter Maydell , kvm@vger.kernel.org, qemu-ppc@nongnu.org, Christian Borntraeger , Paolo Bonzini , Jamie Iles , David Hildenbrand , =?utf-8?q?Alex_Benn=C3=A9e?= , Pierrick Bouvier , Mark Burton , Daniel Henrique Barboza , qemu-arm@nongnu.org, Laurent Vivier , Alexander Graf , Ilya Leoshkevich , Richard Henderson , Marco Liebel , Halil Pasic , Thomas Huth , qemu-s390x@nongnu.org, Cameron Esfahani , Alexandre Iooss , Nicholas Piggin , Roman Bolshakov , "Dr. David Alan Gilbert" , Marcelo Tosatti , Mahmoud Mandour , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Max Chou , Frank Chang Subject: [PATCH v2 12/12] accel/tcg: Avoid unnecessary call overhead from qemu_plugin_vcpu_mem_cb Date: Thu, 20 Jun 2024 16:22:20 +0100 Message-Id: <20240620152220.2192768-13-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240620152220.2192768-1-alex.bennee@linaro.org> References: <20240620152220.2192768-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::534; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-x534.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: Max Chou If there are not any QEMU plugin memory callback functions, checking before calling the qemu_plugin_vcpu_mem_cb function can reduce the function call overhead. Signed-off-by: Max Chou Reviewed-by: Richard Henderson Reviewed-by: Frank Chang Message-Id: <20240613175122.1299212-2-max.chou@sifive.com> Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Alwalid Salama --- accel/tcg/ldst_common.c.inc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/accel/tcg/ldst_common.c.inc b/accel/tcg/ldst_common.c.inc index c82048e377..87ceb95487 100644 --- a/accel/tcg/ldst_common.c.inc +++ b/accel/tcg/ldst_common.c.inc @@ -125,7 +125,9 @@ void helper_st_i128(CPUArchState *env, uint64_t addr, Int128 val, MemOpIdx oi) static void plugin_load_cb(CPUArchState *env, abi_ptr addr, MemOpIdx oi) { - qemu_plugin_vcpu_mem_cb(env_cpu(env), addr, oi, QEMU_PLUGIN_MEM_R); + if (cpu_plugin_mem_cbs_enabled(env_cpu(env))) { + qemu_plugin_vcpu_mem_cb(env_cpu(env), addr, oi, QEMU_PLUGIN_MEM_R); + } } uint8_t cpu_ldb_mmu(CPUArchState *env, abi_ptr addr, MemOpIdx oi, uintptr_t ra) @@ -188,7 +190,9 @@ Int128 cpu_ld16_mmu(CPUArchState *env, abi_ptr addr, static void plugin_store_cb(CPUArchState *env, abi_ptr addr, MemOpIdx oi) { - qemu_plugin_vcpu_mem_cb(env_cpu(env), addr, oi, QEMU_PLUGIN_MEM_W); + if (cpu_plugin_mem_cbs_enabled(env_cpu(env))) { + qemu_plugin_vcpu_mem_cb(env_cpu(env), addr, oi, QEMU_PLUGIN_MEM_W); + } } void cpu_stb_mmu(CPUArchState *env, abi_ptr addr, uint8_t val,