From nobody Mon Feb 9 21:01:33 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1649437059442466.6264403949709; Fri, 8 Apr 2022 09:57:39 -0700 (PDT) Received: from localhost ([::1]:43698 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ncrvW-0002EH-Fu for importer@patchew.org; Fri, 08 Apr 2022 12:57:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49934) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ncrmK-000787-T5 for qemu-devel@nongnu.org; Fri, 08 Apr 2022 12:48:08 -0400 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]:36567) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ncrmH-00031i-IC for qemu-devel@nongnu.org; Fri, 08 Apr 2022 12:48:08 -0400 Received: by mail-wm1-x334.google.com with SMTP id i6-20020a1c3b06000000b0038e710da2dcso8018078wma.1 for ; Fri, 08 Apr 2022 09:47:50 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id n20-20020a05600c4f9400b0038cbd13e06esm10932021wmq.2.2022.04.08.09.47.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Apr 2022 09:47:44 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id D701B1FFB8; Fri, 8 Apr 2022 17:47:42 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=BZbWPiXBtnz0VkzdX0DVcMc8Bcjhgo9EGKHKpmgZy9A=; b=JeFEVtdJriKS5wzkW05lhnTJb/USR5XG9IB6Lfe67H/7ByKWSoFuTQJa1QnDRZVUzd yUykSP3AwFFqHu4ZCpQ7mgpp1VnGDNOf8jt3pAMWjwz5C7sf2xE21U6+GVGWd7HjfSVC HkpdEy6X3VQQP9p9VjIpIs4A2rXLxIoJvIaWoly5headMDp7f0ECum5Av9UiIt6BlH/V mJVUDykpXCtYe7Y7hLQ/jEjuxfhZ1l5YhX5ACdZHeDTlbRsXSzvKSh/iMAOWChMihVSV +Ql8T3urJRQPhc/Hy/DLNuQaeOmCjAJ7GflU3KKwElVA2vJu3jbungpoGi34N8WI+9uW 63rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BZbWPiXBtnz0VkzdX0DVcMc8Bcjhgo9EGKHKpmgZy9A=; b=k6xZYXGyxtzbJVTFUnLPBdA1Tr3C6Pxxzbhgai85Lu5pi8DIW5wMuG8/vTLdfEXfXc kbTlGAPCWB6DW8NS9fQvkUy8hteoxt89YmqdlR2uR2WfmnUtAgH8pv9lCRwwKkH+/44v ixvTkgqG5osYpsznNOZWUAU9/qiHO3au0If5g1RILJyw9IjiUp28Y4Wt2pC2FsgI5tuW 2qZAIP6a7Bb7cWgSF76z3UzQ8CorOtUBLR04009NbikmIwL7nY8aAWkDSFVToYWo5iRt 6pl3J/dTfSBpAdXg0wjRu7HXRi5SNRC+Dq3YXVgYZZ3bsrbb9X39uoyf0TlQd5uQZMQx WeFg== X-Gm-Message-State: AOAM532XBrrqxJpyPWls3okYfohy0dunjXRyqxexO+FxIWXj8oCmMqRy 0PxVFETmQc0c5RyaaIAJ6c/7ug== X-Google-Smtp-Source: ABdhPJw7+Lg8PcMoL9IlvZoqgqTwlWI3gByU3kJO5GLIHu1vFpXK7ZSEPKZfi8w1qdOjMRMD/xV7lg== X-Received: by 2002:a05:600c:1e8d:b0:38e:6eb6:f18b with SMTP id be13-20020a05600c1e8d00b0038e6eb6f18bmr17595723wmb.125.1649436469594; Fri, 08 Apr 2022 09:47:49 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 01/15] tests/avocado: update aarch64_virt test to exercise -cpu max Date: Fri, 8 Apr 2022 17:47:28 +0100 Message-Id: <20220408164742.2844631-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220408164742.2844631-1-alex.bennee@linaro.org> References: <20220408164742.2844631-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x334.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: , Cc: fam@euphon.net, Peter Maydell , berrange@redhat.com, stefanha@redhat.com, "open list:Virt" , crosa@redhat.com, Richard Henderson , aaron@os.amperecomputing.com, robhenry@microsoft.com, f4bug@amsat.org, mahmoudabdalghany@outlook.com, minyihh@uci.edu, cota@braap.org, Wainer dos Santos Moschetta , Luke.Craig@ll.mit.edu, pbonzini@redhat.com, kuhn.chenqun@huawei.com, ma.mandourr@gmail.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= , aurelien@aurel32.net, Beraldo Leal Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1649437060241100001 The Fedora 29 kernel is quite old and importantly fails when running in LPA2 scenarios. As it's not really exercising much of the CPU space replace it with a custom 5.16.12 kernel with all the architecture options turned on. There is a minimal buildroot initramfs included in the kernel which has a few tools for stress testing the memory subsystem. The userspace also targets the Neoverse N1 processor so would fail with a v8.0 cpu like cortex-a53. While we are at it move the test into its own file so it can have an assigned maintainer. Signed-off-by: Alex Benn=C3=A9e Acked-by: Richard Henderson Tested-by: Richard Henderson Message-Id: <20220315121251.2280317-3-alex.bennee@linaro.org> --- v2 - move test into own machine file v3 - minor reword of commit, added tags --- MAINTAINERS | 1 + tests/avocado/boot_linux_console.py | 25 ------------- tests/avocado/machine_aarch64_virt.py | 51 +++++++++++++++++++++++++++ 3 files changed, 52 insertions(+), 25 deletions(-) create mode 100644 tests/avocado/machine_aarch64_virt.py diff --git a/MAINTAINERS b/MAINTAINERS index 4ad2451e03..dcedfaed1f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -942,6 +942,7 @@ S: Maintained F: hw/arm/virt* F: include/hw/arm/virt.h F: docs/system/arm/virt.rst +F: tests/avocado/machine_aarch64_virt.py =20 Xilinx Zynq M: Edgar E. Iglesias diff --git a/tests/avocado/boot_linux_console.py b/tests/avocado/boot_linux= _console.py index b40a3abc81..45a2ceda22 100644 --- a/tests/avocado/boot_linux_console.py +++ b/tests/avocado/boot_linux_console.py @@ -325,31 +325,6 @@ def test_mips_malta32el_nanomips_64k_dbg(self): kernel_hash =3D '18d1c68f2e23429e266ca39ba5349ccd0aeb7180' self.do_test_mips_malta32el_nanomips(kernel_url, kernel_hash) =20 - def test_aarch64_virt(self): - """ - :avocado: tags=3Darch:aarch64 - :avocado: tags=3Dmachine:virt - :avocado: tags=3Daccel:tcg - :avocado: tags=3Dcpu:cortex-a53 - """ - kernel_url =3D ('https://archives.fedoraproject.org/pub/archive/fe= dora' - '/linux/releases/29/Everything/aarch64/os/images/pxe= boot' - '/vmlinuz') - kernel_hash =3D '8c73e469fc6ea06a58dc83a628fc695b693b8493' - kernel_path =3D self.fetch_asset(kernel_url, asset_hash=3Dkernel_h= ash) - - self.vm.set_console() - kernel_command_line =3D (self.KERNEL_COMMON_COMMAND_LINE + - 'console=3DttyAMA0') - self.require_accelerator("tcg") - self.vm.add_args('-cpu', 'cortex-a53', - '-accel', 'tcg', - '-kernel', kernel_path, - '-append', kernel_command_line) - self.vm.launch() - console_pattern =3D 'Kernel command line: %s' % kernel_command_line - self.wait_for_console_pattern(console_pattern) - def test_aarch64_xlnx_versal_virt(self): """ :avocado: tags=3Darch:aarch64 diff --git a/tests/avocado/machine_aarch64_virt.py b/tests/avocado/machine_= aarch64_virt.py new file mode 100644 index 0000000000..21848cba70 --- /dev/null +++ b/tests/avocado/machine_aarch64_virt.py @@ -0,0 +1,51 @@ +# Functional test that boots a Linux kernel and checks the console +# +# Copyright (c) 2022 Linaro Ltd. +# +# Author: +# Alex Benn=C3=A9e +# +# SPDX-License-Identifier: GPL-2.0-or-later + +import time + +from avocado_qemu import QemuSystemTest +from avocado_qemu import wait_for_console_pattern +from avocado_qemu import exec_command + +class Aarch64VirtMachine(QemuSystemTest): + KERNEL_COMMON_COMMAND_LINE =3D 'printk.time=3D0 ' + + def wait_for_console_pattern(self, success_message, vm=3DNone): + wait_for_console_pattern(self, success_message, + failure_message=3D'Kernel panic - not syn= cing', + vm=3Dvm) + + def test_aarch64_virt(self): + """ + :avocado: tags=3Darch:aarch64 + :avocado: tags=3Dmachine:virt + :avocado: tags=3Daccel:tcg + :avocado: tags=3Dcpu:max + """ + kernel_url =3D ('https://fileserver.linaro.org/s/' + 'z6B2ARM7DQT3HWN/download') + + kernel_hash =3D 'ed11daab50c151dde0e1e9c9cb8b2d9bd3215347' + kernel_path =3D self.fetch_asset(kernel_url, asset_hash=3Dkernel_h= ash) + + self.vm.set_console() + kernel_command_line =3D (self.KERNEL_COMMON_COMMAND_LINE + + 'console=3DttyAMA0') + self.require_accelerator("tcg") + self.vm.add_args('-cpu', 'max,pauth-impdef=3Don', + '-accel', 'tcg', + '-kernel', kernel_path, + '-append', kernel_command_line) + self.vm.launch() + self.wait_for_console_pattern('Welcome to Buildroot') + time.sleep(0.1) + exec_command(self, 'root') + time.sleep(0.1) + exec_command(self, 'cat /proc/self/maps') + time.sleep(0.1) --=20 2.30.2 From nobody Mon Feb 9 21:01:33 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1649436673786173.93824121624232; Fri, 8 Apr 2022 09:51:13 -0700 (PDT) Received: from localhost ([::1]:57982 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ncrpI-00013L-O4 for importer@patchew.org; Fri, 08 Apr 2022 12:51:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49806) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ncrmH-00075U-UD for qemu-devel@nongnu.org; Fri, 08 Apr 2022 12:48:06 -0400 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]:42573) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ncrlz-00031D-HF for qemu-devel@nongnu.org; Fri, 08 Apr 2022 12:47:49 -0400 Received: by mail-wm1-x334.google.com with SMTP id n126-20020a1c2784000000b0038e8af3e788so4445836wmn.1 for ; Fri, 08 Apr 2022 09:47:46 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id p1-20020a5d59a1000000b002078c8b6dabsm5188076wrr.9.2022.04.08.09.47.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Apr 2022 09:47:44 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 0FE371FFBA; Fri, 8 Apr 2022 17:47:43 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nfyzv/itU9SEN9fxyUmMdmNwMeyB+oe9163CObc2A6g=; b=NzRFYbjOQGWCXWmTBUWB0x6HQ42WEqzv11MIO5CjyRK1LrFGCgtQU52Qt3l09zbRGz cPAh75ofRIc5mnPzP9Ih0Da+KGnEI6jJdSr3XlO1J15gkHBMdnNbEL9hdtZd8zzvY/w/ PQkeiknKdkBt1v2YUuKVkwvhqil+RANX7RgmIBQvdJXOkmgh1RS8HkqmrstqCXxMwjsT cDBvRkyFl0A4F6BFfPvjrQKXZHUzdSp8tlSxWkckAA3rD4/Vsa7IoanPId4xyshJqK05 IPlpVYPxU3GCF9QVxrzL+ikAiqjS3HkcIEk23EewHsfY7V6hJV4J/BFSUsq9xtx0wbuT Twiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nfyzv/itU9SEN9fxyUmMdmNwMeyB+oe9163CObc2A6g=; b=d7vgpuKPhJdBgSFKLWSzjiWmPRmg4jC8b6BW9g7gRQUasqASviDlmr3iDfm+oYBq2K iVe3m81SI+eFwukftiEI6aW7s+i/0HQw4lncr+DYVd+HZmJv/DuyZ6j/w7delqbl1CVP RrHlFcJhYep6moX/OTyIIATE3b1CT2AHq7j9IHZwTdZQOq/l/zeOxhMSrJxxYbhRvyVr EpMrts1D52xACtQDyNbob1pZhdm5XmXy10oKuBmnS5Uy2MU2tee4qnZs911FTjIqfahR rmqmftouaxT8O9YBQMr/E92uL/e0p5ahZsXm2TlGa6iJOgfFbe+sAiVUoeDYR+75vXZq Udmg== X-Gm-Message-State: AOAM531NJPsQm+BV466VORI4D1Imu/GLQJypjZkQUgvT7Ns3RVGyNqAx Fw65fyN4nUIbTVXxWVj/topS1Q== X-Google-Smtp-Source: ABdhPJxiKcZIr2yVVQI8QjH5tNzv1e3WqVKbk6nEbHPbKXDJ0cmpetRw1yUJwFkOljuq0NxZb7ZRbg== X-Received: by 2002:a7b:c77a:0:b0:38c:2c33:d8f1 with SMTP id x26-20020a7bc77a000000b0038c2c33d8f1mr17662018wmk.115.1649436465370; Fri, 08 Apr 2022 09:47:45 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 02/15] docs/devel: add some notes on the binfmt-image-debian targets Date: Fri, 8 Apr 2022 17:47:29 +0100 Message-Id: <20220408164742.2844631-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220408164742.2844631-1-alex.bennee@linaro.org> References: <20220408164742.2844631-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x334.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: , Cc: fam@euphon.net, berrange@redhat.com, stefanha@redhat.com, crosa@redhat.com, aaron@os.amperecomputing.com, robhenry@microsoft.com, f4bug@amsat.org, mahmoudabdalghany@outlook.com, minyihh@uci.edu, cota@braap.org, Luke.Craig@ll.mit.edu, pbonzini@redhat.com, kuhn.chenqun@huawei.com, ma.mandourr@gmail.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= , aurelien@aurel32.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1649437580919100001 We document some of this on the wiki but lets move it into our official developer notes documentation. Signed-off-by: Alex Benn=C3=A9e Cc: Paolo Bonzini --- v2 - fix some trailing ws --- docs/devel/testing.rst | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/docs/devel/testing.rst b/docs/devel/testing.rst index 92d40cdd19..5b60a31807 100644 --- a/docs/devel/testing.rst +++ b/docs/devel/testing.rst @@ -637,6 +637,44 @@ The full set of annotations can be found here: =20 https://github.com/llvm/llvm-project/blob/master/compiler-rt/lib/tsan/rtl/= tsan_interface_ann.cpp =20 +docker-binfmt-image-debian-% targets +------------------------------------ + +It is possible to combine Debian's bootstrap scripts with a configured +``binfmt_misc`` to bootstrap a number of Debian's distros including +experimental ports not yet supported by a released OS. This can +simplify setting up a rootfs by using docker to contain the foreign +rootfs rather than manually invoking chroot. + +Setting up ``binfmt_misc`` +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +You can use the script ``qemu-binfmt-conf.sh`` to configure a QEMU +user binary to automatically run binaries for the foreign +architecture. While the scripts will try their best to work with +dynamically linked QEMU's a statically linked one will present less +potential complications when copying into the docker image. Modern +kernels support the ``F`` (fix binary) flag which will open the QEMU +executable on setup and avoids the need to find and re-open in the +chroot environment. This is triggered with the ``--persistent`` flag. + +Example invocation +~~~~~~~~~~~~~~~~~~ + +For example to setup the HPPA ports builds of Debian:: + + make docker-binfmt-image-debian-sid-hppa \ + DEB_TYPE=3Dsid DEB_ARCH=3Dhppa \ + DEB_URL=3Dhttp://ftp.ports.debian.org/debian-ports/ \ + DEB_KEYRING=3D/usr/share/keyrings/debian-ports-archive-keyring.gpg \ + EXECUTABLE=3D(pwd)/qemu-hppa V=3D1 + +The ``DEB_`` variables are substitutions used by +``debian-boostrap.pre`` which is called to do the initial debootstrap +of the rootfs before it is copied into the container. The second stage +is run as part of the build. The final image will be tagged as +``qemu/debian-sid-hppa``. + VM testing ---------- =20 --=20 2.30.2 From nobody Mon Feb 9 21:01:33 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1649436869614410.8808960468374; Fri, 8 Apr 2022 09:54:29 -0700 (PDT) Received: from localhost ([::1]:37184 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ncrsS-00066j-L7 for importer@patchew.org; Fri, 08 Apr 2022 12:54:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49858) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ncrmJ-00076Q-Bz for qemu-devel@nongnu.org; Fri, 08 Apr 2022 12:48:07 -0400 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]:38651) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ncrmC-00031X-Pr for qemu-devel@nongnu.org; Fri, 08 Apr 2022 12:48:06 -0400 Received: by mail-wr1-x430.google.com with SMTP id a2so4524307wrh.5 for ; Fri, 08 Apr 2022 09:47:48 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id r16-20020a7bc090000000b0038e73023334sm9661463wmh.2.2022.04.08.09.47.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Apr 2022 09:47:44 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 53BFF1FFBB; Fri, 8 Apr 2022 17:47:43 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dvwLTF/YUpusucxnWfO5BDXCMNh2/WY9f2hzq1Kk0Rs=; b=UlROvWYmvYwvAXexnDDWV4lCQAc0F+rfz5pmb5lRhDA18oIrAisfVUkhqQKc+8pqJy ZELU+RM/ij5Nyl0YPkfWEp720ZMMoPMxaT0zFlwTDULrWaeELgUVrRUD0iFpNSZcx9T6 ljfOQo1T6mDtyUFoatbFR/RX+AYZXSF3ixSSgjUGQlkJjSwv8IAhcVLiUSbn+YVs7TUk 7NbA7POuLSWy5IXbJKYk5Ph1dEc7IAVhX+46M3T39SHEMvMvrOfIyt8J5AnA2zobxvV9 fk/lBiMEAmWSHxKgq9yfyjMMN//VsV8NNZfT+ZqKkT24kWnFFHyk9w60zQXuhHRYlvX4 Cu4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dvwLTF/YUpusucxnWfO5BDXCMNh2/WY9f2hzq1Kk0Rs=; b=FM8zqi259t5I1XXSAqjur3Wx7Gya2at493M5d63ol3eqZN98G4/0QvudM4q2+yX220 CUxWu6cOoMA6fQQ/Wvu42qzsvjqBnCAsIb/N+uG1xYuHCxFSbtAy5Gk4xh9A0dAeC66Y 5dWi5II5ltalWGCe0xW+IxwRdQXv1mRIXD8W4K9AWdyDGO3l1ytHs8/ZMrqYL7K2lg19 JRby1SjSe48lNNlSEjyYgEzogugBZjkmrkk7n14LxyuI/sxTmWRX6FdJ8HfesNdhZtUq mUHT5nVlxzvpBj/lsiLwwRyA0X8s0iUugM0J0tjwdvpJE9hZstqTrtlA2yEb9qoqNtTr 2Kcw== X-Gm-Message-State: AOAM531sQstDWw6qtggareEUfXZfkDyeD4Fbj4DPONGAlmo9kqQFKaaW aCRb6C7XVB/VlbPZ+gVzmYhChA== X-Google-Smtp-Source: ABdhPJwGeekeTskVfEMcENcwN9AHHmuQ0iMv0RMtpgsSh8c0Rb9PwcizA2LdHJ6bShgip3t1O5mQVA== X-Received: by 2002:a05:6000:154d:b0:207:9101:8f24 with SMTP id 13-20020a056000154d00b0020791018f24mr3949863wry.317.1649436467657; Fri, 08 Apr 2022 09:47:47 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 03/15] docs/devel: drop :hidden: and :includehidden: tags Date: Fri, 8 Apr 2022 17:47:30 +0100 Message-Id: <20220408164742.2844631-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220408164742.2844631-1-alex.bennee@linaro.org> References: <20220408164742.2844631-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x430.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: , Cc: fam@euphon.net, berrange@redhat.com, stefanha@redhat.com, crosa@redhat.com, aaron@os.amperecomputing.com, robhenry@microsoft.com, f4bug@amsat.org, mahmoudabdalghany@outlook.com, minyihh@uci.edu, cota@braap.org, Luke.Craig@ll.mit.edu, pbonzini@redhat.com, kuhn.chenqun@huawei.com, ma.mandourr@gmail.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= , aurelien@aurel32.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1649436870924100001 This was confusing and in the case of qtest was hiding the details of the qgraph sub-document in the qtest pages. Signed-off-by: Alex Benn=C3=A9e --- docs/devel/index-api.rst | 1 - docs/devel/index-build.rst | 3 +-- docs/devel/index-internals.rst | 1 - docs/devel/index-process.rst | 1 - docs/devel/index-tcg.rst | 1 - docs/devel/index.rst | 2 -- docs/devel/qtest.rst | 1 - 7 files changed, 1 insertion(+), 9 deletions(-) diff --git a/docs/devel/index-api.rst b/docs/devel/index-api.rst index b749240272..60c0d7459d 100644 --- a/docs/devel/index-api.rst +++ b/docs/devel/index-api.rst @@ -6,7 +6,6 @@ generated from in-code annotations to function prototypes. =20 .. toctree:: :maxdepth: 2 - :includehidden: =20 bitops loads-stores diff --git a/docs/devel/index-build.rst b/docs/devel/index-build.rst index d96894f07c..1002a533a6 100644 --- a/docs/devel/index-build.rst +++ b/docs/devel/index-build.rst @@ -6,8 +6,7 @@ into our testing infrastructure. You will need to understan= d some of the basics if you are adding new files and targets to the build. =20 .. toctree:: - :maxdepth: 2 - :includehidden: + :maxdepth: 3 =20 build-system kconfig diff --git a/docs/devel/index-internals.rst b/docs/devel/index-internals.rst index bb118b8eaf..a50889c556 100644 --- a/docs/devel/index-internals.rst +++ b/docs/devel/index-internals.rst @@ -5,7 +5,6 @@ Details about QEMU's various subsystems including how to ad= d features to them. =20 .. toctree:: :maxdepth: 2 - :includehidden: =20 qom atomics diff --git a/docs/devel/index-process.rst b/docs/devel/index-process.rst index 314e9e94cc..d0d7a200fd 100644 --- a/docs/devel/index-process.rst +++ b/docs/devel/index-process.rst @@ -5,7 +5,6 @@ Notes about how to interact with the community and how and = where to submit patch =20 .. toctree:: :maxdepth: 2 - :includehidden: =20 code-of-conduct conflict-resolution diff --git a/docs/devel/index-tcg.rst b/docs/devel/index-tcg.rst index 3acbd95d36..0b0ad12c22 100644 --- a/docs/devel/index-tcg.rst +++ b/docs/devel/index-tcg.rst @@ -7,7 +7,6 @@ are only implementing things for HW accelerated hypervisors. =20 .. toctree:: :maxdepth: 2 - :includehidden: =20 tcg decodetree diff --git a/docs/devel/index.rst b/docs/devel/index.rst index a68207052d..09cfb322be 100644 --- a/docs/devel/index.rst +++ b/docs/devel/index.rst @@ -8,8 +8,6 @@ modifying QEMU's source code. =20 .. toctree:: :maxdepth: 1 - :includehidden: - =20 index-process index-build diff --git a/docs/devel/qtest.rst b/docs/devel/qtest.rst index c3dceb6c8a..add293d397 100644 --- a/docs/devel/qtest.rst +++ b/docs/devel/qtest.rst @@ -3,7 +3,6 @@ QTest Device Emulation Testing Framework =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 .. toctree:: - :hidden: =20 qgraph =20 --=20 2.30.2 From nobody Mon Feb 9 21:01:33 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1649436833090306.96791349485727; Fri, 8 Apr 2022 09:53:53 -0700 (PDT) Received: from localhost ([::1]:35946 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ncrrr-0005IX-Li for importer@patchew.org; Fri, 08 Apr 2022 12:53:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49804) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ncrmH-00075S-TV for qemu-devel@nongnu.org; Fri, 08 Apr 2022 12:48:06 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]:45715) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ncrm0-00031O-Bb for qemu-devel@nongnu.org; Fri, 08 Apr 2022 12:47:49 -0400 Received: by mail-wr1-x42c.google.com with SMTP id w4so13737047wrg.12 for ; Fri, 08 Apr 2022 09:47:47 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id y7-20020adfdf07000000b0020609f6b386sm16365853wrl.37.2022.04.08.09.47.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Apr 2022 09:47:44 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 886F81FFBC; Fri, 8 Apr 2022 17:47:43 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cbfUhEdoXUFU1ImJHXBrosmpAlm+ZA5/z2VauZwOXbI=; b=BTOedRCyP62uDlxVSIJt/5B95PhUmE7OWJ9zSAig/yo6I5SivI+hQzJ48FcBZGA750 7rMgOV4r7zVOUSGF3xSQsxOWAnhg2LR2lArmIgrnoZC5hkpgZ9gsF3iK2mG+LcejNwnE qwJaZCDhIMjtqgfSy9YA7CcSybE+mils+Ah1MPjPZCLrG/WW5rCFCxmDQeDLhBBwOIOS n+ASqxt4zbDFXwAeXp+B4LsPzV+Lo+gsFvzOS4ri2wahhqQbBldV1n0NQLEzZ43z5Y+C e1WVq6UwyMhzI6MCqL20EU+OyFXj5k+CAFXuG/uyxtN2RNzwLls8IlXX+wtTUR9JFxTA EoAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cbfUhEdoXUFU1ImJHXBrosmpAlm+ZA5/z2VauZwOXbI=; b=B+mQfk5FVtcmEL2zvM5RFOEf7nXEgBJyAltpTKKhwBum8PeNPCt0v7sp2NCslrK5xs 8jnYH6GFIxRiGmsvGeIdRxBM6Vl32EymREamLUN4cyMypIuyyl9FFHfj/1gpbW7j1x4U g37xkhW+i0INBtSwgCUO1JupamIQa+/TfX8SaRZwvul7ah4iBeLIGBczPinBgztBYg6p bM9fwkLfxszl5SlBstY2MdAb3yeSO4wnK5tVy4CeWRW1i7CvCtGy590hzsOIGeLQ9Cug 3ThfUJsUl0BFSxMpDRe0YqQSnqcCCxafnLUiq8xHyYLwVfI01moVRR8zgFMMofDucxy6 D4cQ== X-Gm-Message-State: AOAM532vJWzJaLa9lFkJpBTWlnjuxDJA9B2YvD+gwQFmaqwaAgf4VvdH EKue1g9TGPDgNhpwRlegQepM4w== X-Google-Smtp-Source: ABdhPJxJMAkMBFYZaAGeR/u8Zw2J95W8oC9lNbf12tIU6HFd66B9+5rSe2vfrPYg1FSFF6jhSuJe4Q== X-Received: by 2002:a5d:4348:0:b0:206:1c79:fd57 with SMTP id u8-20020a5d4348000000b002061c79fd57mr15721266wrr.344.1649436467016; Fri, 08 Apr 2022 09:47:47 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 04/15] accel/tcg: move trace events to correct location Date: Fri, 8 Apr 2022 17:47:31 +0100 Message-Id: <20220408164742.2844631-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220408164742.2844631-1-alex.bennee@linaro.org> References: <20220408164742.2844631-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, 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: , Cc: fam@euphon.net, berrange@redhat.com, stefanha@redhat.com, crosa@redhat.com, Richard Henderson , aaron@os.amperecomputing.com, robhenry@microsoft.com, f4bug@amsat.org, mahmoudabdalghany@outlook.com, minyihh@uci.edu, cota@braap.org, Luke.Craig@ll.mit.edu, pbonzini@redhat.com, kuhn.chenqun@huawei.com, ma.mandourr@gmail.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= , aurelien@aurel32.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1649436835010100001 Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson --- accel/tcg/cputlb.c | 2 +- accel/tcg/trace-events | 4 ++++ trace-events | 4 ---- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index 2035b2ac0a..35797cea49 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -33,7 +33,7 @@ #include "qemu/atomic.h" #include "qemu/atomic128.h" #include "exec/translate-all.h" -#include "trace/trace-root.h" +#include "trace.h" #include "tb-hash.h" #include "internal.h" #ifdef CONFIG_PLUGIN diff --git a/accel/tcg/trace-events b/accel/tcg/trace-events index 59eab96f26..4e9b450520 100644 --- a/accel/tcg/trace-events +++ b/accel/tcg/trace-events @@ -6,5 +6,9 @@ exec_tb(void *tb, uintptr_t pc) "tb:%p pc=3D0x%"PRIxPTR exec_tb_nocache(void *tb, uintptr_t pc) "tb:%p pc=3D0x%"PRIxPTR exec_tb_exit(void *last_tb, unsigned int flags) "tb:%p flags=3D0x%x" =20 +# cputlb.c +memory_notdirty_write_access(uint64_t vaddr, uint64_t ram_addr, unsigned s= ize) "0x%" PRIx64 " ram_addr 0x%" PRIx64 " size %u" +memory_notdirty_set_dirty(uint64_t vaddr) "0x%" PRIx64 + # translate-all.c translate_block(void *tb, uintptr_t pc, const void *tb_code) "tb:%p, pc:0x= %"PRIxPTR", tb_code:%p" diff --git a/trace-events b/trace-events index bc71006675..841c2ca7c5 100644 --- a/trace-events +++ b/trace-events @@ -42,10 +42,6 @@ find_ram_offset(uint64_t size, uint64_t offset) "size: 0= x%" PRIx64 " @ 0x%" PRIx find_ram_offset_loop(uint64_t size, uint64_t candidate, uint64_t offset, u= int64_t next, uint64_t mingap) "trying size: 0x%" PRIx64 " @ 0x%" PRIx64 ",= offset: 0x%" PRIx64" next: 0x%" PRIx64 " mingap: 0x%" PRIx64 ram_block_discard_range(const char *rbname, void *hva, size_t length, bool= need_madvise, bool need_fallocate, int ret) "%s@%p + 0x%zx: madvise: %d fa= llocate: %d ret: %d" =20 -# accel/tcg/cputlb.c -memory_notdirty_write_access(uint64_t vaddr, uint64_t ram_addr, unsigned s= ize) "0x%" PRIx64 " ram_addr 0x%" PRIx64 " size %u" -memory_notdirty_set_dirty(uint64_t vaddr) "0x%" PRIx64 - # gdbstub.c gdbstub_op_start(const char *device) "Starting gdbstub using device %s" gdbstub_op_exiting(uint8_t code) "notifying exit with code=3D0x%02x" --=20 2.30.2 From nobody Mon Feb 9 21:01:33 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1649437415257578.3277773083533; Fri, 8 Apr 2022 10:03:35 -0700 (PDT) Received: from localhost ([::1]:56266 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ncs1F-0002Nu-RK for importer@patchew.org; Fri, 08 Apr 2022 13:03:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49970) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ncrmL-0007AN-R8 for qemu-devel@nongnu.org; Fri, 08 Apr 2022 12:48:10 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]:45586) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ncrmJ-00031y-3c for qemu-devel@nongnu.org; Fri, 08 Apr 2022 12:48:09 -0400 Received: by mail-wm1-x32c.google.com with SMTP id 123-20020a1c1981000000b0038b3616a71aso5979211wmz.4 for ; Fri, 08 Apr 2022 09:47:53 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id bd27-20020a05600c1f1b00b0038ea3ead086sm1914029wmb.32.2022.04.08.09.47.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Apr 2022 09:47:49 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id BADBC1FFBD; Fri, 8 Apr 2022 17:47:43 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=q/M3SIRLq1wHJgDuF/NudSRgd4ibV/jQ9bygCh3f7Fk=; b=iEFWTm3pV+mWFXfY0ir7BjI/l8jOzYdMPFy7ydJHZkMRJUhMDt0zxpN0FdAygv67rw Um5dC536w/fGqhtvfoutFBCgYHsF5USj3+1IAYRE03Hq9GD3XUnQfiXpvx+tkKIF6JEu XmEhb2qNina6xkq91vb2SkmPgN0fzs6DKWClbJsDzqCJp1nl7Od9zlzhZqoQUmPBHgSZ icBrhJqJUXWuISI31qifzSpKkMzUjSB6TvA7NJB3gRSw2SJ01hTVLMxUVXp6QTV/SqJ0 TQaSRZOHbRq4vXi7JmVuhXMvKeuUfqT2nYg4b4TjIqmTgn/Pj7+3zSLdQX09i/GZcVrE J85g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=q/M3SIRLq1wHJgDuF/NudSRgd4ibV/jQ9bygCh3f7Fk=; b=W93RP1kdhWQMraP55XssWAkW5vjqfummri0JmwdYMOF1XrMp8vMTQsMq9g8VdRpfDR iqJHrmipgP8cNC+4PLfgdhs9llDEl/nZx1Mi6g3EbGpONobY6Fv+wnbLKgNMjfi5WHAc vWSA5PCL2Sw1wH0XX/huuaA6tDj0bSYaQWQFbUcorhZCK3kPQxQmHNV7Bj3t2uWC6e7a tR/L4f2ZsWwPQnGkgxPyfw+UlZj1hekTiuHexs7VhbNRoVmgm6F3ERQMcMXx6+OxGsvg uLZkiWgHoc60OKIhGu8YMYSA20vdFLaEy0SQ8HjT0ETiApaMo6DEzhSnrk44CiWgjqEM 5Crg== X-Gm-Message-State: AOAM533L9Oai6sVMK8N7WMkRPmbAEfR8vIrAglE5Sf5WkLJI7MfnS3ly 5in/eb/VhWMzuetwB5/AMV9zJQ== X-Google-Smtp-Source: ABdhPJz1Yz8wiCyMCjAJfd/ziXaEKDjxctPbhAHrOHShn6YZzCv4TSPZD3HB+DYvFOCK6vohgjFyKg== X-Received: by 2002:a7b:cb83:0:b0:37e:bc50:3c6b with SMTP id m3-20020a7bcb83000000b0037ebc503c6bmr18249558wmi.67.1649436472304; Fri, 08 Apr 2022 09:47:52 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 05/15] accel/tcg: add tb_invalidate_phy_pages_fast tracepoint Date: Fri, 8 Apr 2022 17:47:32 +0100 Message-Id: <20220408164742.2844631-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220408164742.2844631-1-alex.bennee@linaro.org> References: <20220408164742.2844631-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x32c.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: , Cc: fam@euphon.net, berrange@redhat.com, stefanha@redhat.com, crosa@redhat.com, Richard Henderson , aaron@os.amperecomputing.com, robhenry@microsoft.com, f4bug@amsat.org, mahmoudabdalghany@outlook.com, minyihh@uci.edu, cota@braap.org, Luke.Craig@ll.mit.edu, pbonzini@redhat.com, kuhn.chenqun@huawei.com, ma.mandourr@gmail.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= , aurelien@aurel32.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1649437416121100001 These events can be very expensive for the translator so lets add a tracepoint to help with debugging what might be causing them. Clean up the comments while we are at it. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson --- accel/tcg/translate-all.c | 15 +++++++++++---- accel/tcg/trace-events | 1 + 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 5971cd53ab..e9f1cc179d 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -1807,21 +1807,28 @@ void tb_invalidate_phys_range(target_ulong start, t= arget_ulong end) } =20 #ifdef CONFIG_SOFTMMU -/* len must be <=3D 8 and start must be a multiple of len. +/* + * len must be <=3D 8 and start must be a multiple of len. * Called via softmmu_template.h when code areas are written to with * iothread mutex not held. * - * Call with all @pages in the range [@start, @start + len[ locked. + * Call with all @pages in the range [@start, @start + len] locked. */ void tb_invalidate_phys_page_fast(struct page_collection *pages, tb_page_addr_t start, int len, uintptr_t retaddr) { - PageDesc *p; + PageDesc *p =3D page_find(start >> TARGET_PAGE_BITS); + + if (trace_event_get_state_backends(TRACE_TB_INVALIDATE_PHYS_PAGE_FAST)= ) { + TranslationBlock *tb =3D tcg_tb_lookup(retaddr); + g_assert(tb); + trace_tb_invalidate_phys_page_fast(start, len, tb->pc, + p->code_write_count, p->code_bi= tmap); + } =20 assert_memory_lock(); =20 - p =3D page_find(start >> TARGET_PAGE_BITS); if (!p) { return; } diff --git a/accel/tcg/trace-events b/accel/tcg/trace-events index 4e9b450520..f4d1321b1b 100644 --- a/accel/tcg/trace-events +++ b/accel/tcg/trace-events @@ -11,4 +11,5 @@ memory_notdirty_write_access(uint64_t vaddr, uint64_t ram= _addr, unsigned size) " memory_notdirty_set_dirty(uint64_t vaddr) "0x%" PRIx64 =20 # translate-all.c +tb_invalidate_phys_page_fast(uint64_t page_start, int len, uint64_t ret, i= nt wc, void *bmap) "addr:0x%" PRIx64 "/%d pc:0x%" PRIx64" wc:%d/%p" translate_block(void *tb, uintptr_t pc, const void *tb_code) "tb:%p, pc:0x= %"PRIxPTR", tb_code:%p" --=20 2.30.2 From nobody Mon Feb 9 21:01:33 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1649437034880474.2607225855968; Fri, 8 Apr 2022 09:57:14 -0700 (PDT) Received: from localhost ([::1]:42386 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ncrv7-0001In-AZ for importer@patchew.org; Fri, 08 Apr 2022 12:57:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49922) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ncrmK-00077b-IU for qemu-devel@nongnu.org; Fri, 08 Apr 2022 12:48:08 -0400 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]:40769) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ncrmH-000324-IP for qemu-devel@nongnu.org; Fri, 08 Apr 2022 12:48:08 -0400 Received: by mail-wr1-x42e.google.com with SMTP id d3so13789265wrb.7 for ; Fri, 08 Apr 2022 09:47:54 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id p5-20020adff205000000b0020614a499fbsm17049106wro.90.2022.04.08.09.47.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Apr 2022 09:47:49 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 0D7031FFBE; Fri, 8 Apr 2022 17:47:44 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4NTszvMqpo5kXDPKuOt5Qa+p4D0vEgJ4d0rxv9/sMM8=; b=cXR0BLDLld+OnrAYrhZHtjyNrW/BTXHYGGNvP0E5P00A2FxOt7tb8GHf0T7MEEz6PG 8csc4FAFRc22mR2dF289dfdCZ01NP66ws1FUz/TQzTfFMmKPxEz3kYEyNpIcTzpnfxcO Njw1Z6JDCBxtmlhJrN1fvi2AUeVCNGTFuXgHPkcZjNuRrSulzUrJ7d9oehYIPmTtiWvr 8AXcwFQ5KX1yvGiAfltyMXH/P04GX6ADvLKO/HTb7T+grf9uQ7cpqYW9Cs1VQHUlxiFk lXQsZE1kY5bQicjY0QM7QnENaZznP8QUFbaI4+841ArPh9jIhQde6ZTw83XoGw495VGo 68XQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4NTszvMqpo5kXDPKuOt5Qa+p4D0vEgJ4d0rxv9/sMM8=; b=z4YOEwL6jtP9V0NoGD9RI3tPzJZlZVMeFpHmdiNNxyvXQZ0D6vFsgvTobHC0b3rRhZ T+gZM66ik/Ae6TmNGEoZN8TfmvXw/i6kdaYU3fqY9QoPZbaAXbZFJZXfYWU8OAdgMrem Rt89qkZ5c26xvdnf42oRHvAezLzPxA0ABuU/c2bL2VceGwgvKBHHKWO38/80Dmhf+82o wr0oNFGLYUwQVX3FbE7VtYPD5CdyJ1mdvISztNbGieV52/wHUKhqj8TTLmusijAY7A/c u2f2x4ZSPku4wXVniyakTVVHj7jcU+2h7P/N/pIFubBTcHGcxHs244V8iuJYLkf8Qv87 30qQ== X-Gm-Message-State: AOAM530QGD/yw7uenGLHhr99/eZkC/7QWJMPaFGPsmUjIlli20wreUcU pkRc2SVztaegOoG8ZpF7XG/Lww== X-Google-Smtp-Source: ABdhPJwn5rM+HEzmFT575xjEXxTaQO+iHeJVqIVCSVd5q92al05IWlD4qCpPK75eGt8T6Si1qvYjVw== X-Received: by 2002:a05:6000:178d:b0:206:134e:49c6 with SMTP id e13-20020a056000178d00b00206134e49c6mr15200621wrg.225.1649436473922; Fri, 08 Apr 2022 09:47:53 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 06/15] monitor: expose monitor_puts to rest of code Date: Fri, 8 Apr 2022 17:47:33 +0100 Message-Id: <20220408164742.2844631-7-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220408164742.2844631-1-alex.bennee@linaro.org> References: <20220408164742.2844631-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x42e.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: , Cc: fam@euphon.net, berrange@redhat.com, stefanha@redhat.com, Markus Armbruster , crosa@redhat.com, aaron@os.amperecomputing.com, robhenry@microsoft.com, f4bug@amsat.org, mahmoudabdalghany@outlook.com, minyihh@uci.edu, cota@braap.org, "Dr. David Alan Gilbert" , Luke.Craig@ll.mit.edu, pbonzini@redhat.com, kuhn.chenqun@huawei.com, ma.mandourr@gmail.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= , aurelien@aurel32.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1649437036119100001 This helps us construct strings elsewhere before echoing to the monitor. It avoids having to jump through hoops like: monitor_printf(mon, "%s", s->str); Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson --- include/monitor/monitor.h | 1 + monitor/monitor-internal.h | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h index cc4cc6c6ad..8e291a2588 100644 --- a/include/monitor/monitor.h +++ b/include/monitor/monitor.h @@ -31,6 +31,7 @@ void monitor_resume(Monitor *mon); int monitor_get_fd(Monitor *mon, const char *fdname, Error **errp); int monitor_fd_param(Monitor *mon, const char *fdname, Error **errp); =20 +int monitor_puts(Monitor *mon, const char *str); int monitor_vprintf(Monitor *mon, const char *fmt, va_list ap) G_GNUC_PRINTF(2, 0); int monitor_printf(Monitor *mon, const char *fmt, ...) G_GNUC_PRINTF(2, 3); diff --git a/monitor/monitor-internal.h b/monitor/monitor-internal.h index caa2e90ef2..a2cdbbf646 100644 --- a/monitor/monitor-internal.h +++ b/monitor/monitor-internal.h @@ -174,7 +174,6 @@ extern int mon_refcount; =20 extern HMPCommand hmp_cmds[]; =20 -int monitor_puts(Monitor *mon, const char *str); void monitor_data_init(Monitor *mon, bool is_qmp, bool skip_flush, bool use_io_thread); void monitor_data_destroy(Monitor *mon); --=20 2.30.2 From nobody Mon Feb 9 21:01:33 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1649436674483476.12504259670266; Fri, 8 Apr 2022 09:51:14 -0700 (PDT) Received: from localhost ([::1]:58020 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ncrpJ-00014r-HS for importer@patchew.org; Fri, 08 Apr 2022 12:51:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49932) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ncrmK-000786-R0 for qemu-devel@nongnu.org; Fri, 08 Apr 2022 12:48:08 -0400 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]:46802) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ncrmI-00032I-HT for qemu-devel@nongnu.org; Fri, 08 Apr 2022 12:48:08 -0400 Received: by mail-wr1-x433.google.com with SMTP id i20so685344wrb.13 for ; Fri, 08 Apr 2022 09:47:57 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id r14-20020a0560001b8e00b00205918bd86esm19694439wru.78.2022.04.08.09.47.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Apr 2022 09:47:49 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 30B501FFBF; Fri, 8 Apr 2022 17:47:44 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=T2K0RiSpFnjP2SPW78zxgqkyT920bbP6nlXCBG7skz0=; b=d9gzI9h7ehjTtg2PFriyt9B/IYiBeK+7Lk5iR7wL72W/dIIHtBilq1P+rMN99nnjGB SssKFzQux2hDyy3xvLe7Rm78Q/Ox4Y4KCsWk6ratUJ9Sx9NPzP8EGjQVsVrBiuawsDCT 0BNjJXcCOn/JhYbEie9UvWTD9Lqq0aSeJ0XDqsaytrOyIAukFvLi+L4GVCfkb+ADgpia vl7kAHNviudIU5MESkfGNnmUetIQ9jD70z5vWNKRrIUoencOylNcuz8XQovq3WjMQaT8 h/z04U9xWV8SI2Ji7BuKjPniucgkvMaABUh1hPc7XNLuuN8iwBOF4X15l5QsCyIa7gbh kOSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=T2K0RiSpFnjP2SPW78zxgqkyT920bbP6nlXCBG7skz0=; b=F0Jt6Y6qTEb4sMCXkFBMNaCHhTgl+NnX2Me8LihrtLnQ9cBVMdvcwgKGJF1fXHh/sD y5A3ny1T7IHQrDwcx2SdZq+9oIh071SaIWrHAxtziMaG7oXLFn1W4vr+h40LL3oGuEAb /zcwGC7SPJsyHXujZXvavpYvMachtS7WqlSlJy6usPC/06joF5OPwoZy/12TvtOVPlnt 8NmHNBmESfNTTfWf4kJAwrKSZvLy+y6u9XxxirjKsFMhV+8HTDnqnaFN24VZYnK3ENsk 77aFb5XoJmvhUW4qcoiDLYilcBuu114+c/IsayTtfF3glSkBVmWoQRHbWAE7vE+957Uz V7Kw== X-Gm-Message-State: AOAM531vXVTpp45b9kd33bIdsFdK7Ne9JSpcVwAZwOVKQUf9EUWxGPqN 1+yabnU8Fo/dpXO+n3OFxngizA== X-Google-Smtp-Source: ABdhPJwcW4E7Ohens5k6nTxWjbFH0uy1MO2SWiW95IMFv4F7kUs2vFfCNAxIAh5eYulaNe8tdJZdwg== X-Received: by 2002:a5d:64a7:0:b0:205:fb7a:50ee with SMTP id m7-20020a5d64a7000000b00205fb7a50eemr15306727wrp.185.1649436476505; Fri, 08 Apr 2022 09:47:56 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 07/15] disas: generalise plugin_printf and use for monitor_disas Date: Fri, 8 Apr 2022 17:47:34 +0100 Message-Id: <20220408164742.2844631-8-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220408164742.2844631-1-alex.bennee@linaro.org> References: <20220408164742.2844631-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::433; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x433.google.com X-Spam_score_int: 0 X-Spam_score: -0.1 X-Spam_bar: / X-Spam_report: (-0.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, PDS_OTHER_BAD_TLD=1.997, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: , Cc: fam@euphon.net, berrange@redhat.com, stefanha@redhat.com, crosa@redhat.com, aaron@os.amperecomputing.com, robhenry@microsoft.com, f4bug@amsat.org, mahmoudabdalghany@outlook.com, minyihh@uci.edu, cota@braap.org, Luke.Craig@ll.mit.edu, pbonzini@redhat.com, kuhn.chenqun@huawei.com, ma.mandourr@gmail.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= , aurelien@aurel32.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1649436678502100001 Rather than assembling our output piecemeal lets use the same approach as the plugin disas interface to build the disassembly string before printing it. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson --- disas.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/disas.c b/disas.c index 3dab4482d1..9b52b2fa93 100644 --- a/disas.c +++ b/disas.c @@ -248,7 +248,7 @@ void target_disas(FILE *out, CPUState *cpu, target_ulon= g code, } } =20 -static int plugin_printf(FILE *stream, const char *fmt, ...) +static int gstring_printf(FILE *stream, const char *fmt, ...) { /* We abuse the FILE parameter to pass a GString. */ GString *s =3D (GString *)stream; @@ -279,7 +279,7 @@ char *plugin_disas(CPUState *cpu, uint64_t addr, size_t= size) GString *ds =3D g_string_new(NULL); =20 initialize_debug_target(&s, cpu); - s.info.fprintf_func =3D plugin_printf; + s.info.fprintf_func =3D gstring_printf; s.info.stream =3D (FILE *)ds; /* abuse this slot */ s.info.buffer_vma =3D addr; s.info.buffer_length =3D size; @@ -367,15 +367,19 @@ void monitor_disas(Monitor *mon, CPUState *cpu, { int count, i; CPUDebug s; + g_autoptr(GString) ds =3D g_string_new(""); =20 initialize_debug_target(&s, cpu); - s.info.fprintf_func =3D qemu_fprintf; + s.info.fprintf_func =3D gstring_printf; + s.info.stream =3D (FILE *)ds; /* abuse this slot */ + if (is_physical) { s.info.read_memory_func =3D physical_read_memory; } s.info.buffer_vma =3D pc; =20 if (s.info.cap_arch >=3D 0 && cap_disas_monitor(&s.info, pc, nb_insn))= { + monitor_puts(mon, ds->str); return; } =20 @@ -385,13 +389,16 @@ void monitor_disas(Monitor *mon, CPUState *cpu, return; } =20 - for(i =3D 0; i < nb_insn; i++) { - monitor_printf(mon, "0x" TARGET_FMT_lx ": ", pc); + for (i =3D 0; i < nb_insn; i++) { + g_string_append_printf(ds, "0x" TARGET_FMT_lx ": ", pc); count =3D s.info.print_insn(pc, &s.info); - monitor_printf(mon, "\n"); - if (count < 0) - break; + g_string_append_c(ds, '\n'); + if (count < 0) { + break; + } pc +=3D count; } + + monitor_puts(mon, ds->str); } #endif --=20 2.30.2 From nobody Mon Feb 9 21:01:33 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1649436838281987.6375238190398; Fri, 8 Apr 2022 09:53:58 -0700 (PDT) Received: from localhost ([::1]:36280 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ncrrx-0005Vn-8i for importer@patchew.org; Fri, 08 Apr 2022 12:53:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49974) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ncrmM-0007Ao-A3 for qemu-devel@nongnu.org; Fri, 08 Apr 2022 12:48:10 -0400 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]:45593) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ncrmJ-00032N-9r for qemu-devel@nongnu.org; Fri, 08 Apr 2022 12:48:10 -0400 Received: by mail-wm1-x333.google.com with SMTP id 123-20020a1c1981000000b0038b3616a71aso5979330wmz.4 for ; Fri, 08 Apr 2022 09:47:58 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id p8-20020a5d59a8000000b00204178688d3sm22961446wrr.100.2022.04.08.09.47.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Apr 2022 09:47:49 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 624231FFB7; Fri, 8 Apr 2022 17:47:44 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ubCqK51gYtJJDCrG/hEyxYZ9EfsVm0Z8CHCmeeA6FEk=; b=dARvqjpDhtGfCPvMid4GkAnwEvF+2Bo7ZNPEBM86YCHkx/S3XIp2wQAWSUd+bJLgsf su60hybV6dXHfB/UevbNjRCoWVqrU2og5y+hkk4UpFyn8DKgOtISLm8kXDVR3LImehS4 NsmgGM1WgNJHOPiW2AXVbzIrqGgB8vpao5wIpozOLNvZW7A6f3oKPSSGY3Dk3YeoRy9V dbJdPzZdI2KxS1sTGvuIaZC0h331zdd162mn8E8Su+F5aREUT0PRiSEyncrn+jZjfre7 NwD5zmKdnjQdRYHLGwtNoSbPySsjwu0y4xaeE/m7/nt25DpnzuzdDcQizxM/Zpt+7PsE Uqig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ubCqK51gYtJJDCrG/hEyxYZ9EfsVm0Z8CHCmeeA6FEk=; b=bVox7MxiCP8uV+fdnd49BS2USRBjDPfr62nBO7jGnZ9LprGMMlrbpnzXjtbeI5EJxL +5AbEkFRyTtsoNYAXcAx68tpP+ClgqZjAccUgHWKt+FE/U6+jSc/mgq6XQBnIM17SufF maXCUWaVjdn7R75Pw6QjiV0X3rmbDID/B5DhGZnwZuDotrJe/7I/6Xq4gx0UMI+9b2mE 4mq3Gl/Lys41/JDGntJNsgVbQAgkJ6NCUKun4BzfaTij5/TSJx1D2C/Pu8PwTY4j5WXN PGLvBZ2fyqxbLlxuhSyfmK+Y1J66mpganhHSai/5Ro9NRea4JAIDZWddfZR04nXo+37J fsNw== X-Gm-Message-State: AOAM531bisvEC8avaRXKywYkBIwzODWSXmGWNTexOLr65TIXVE5DQcXc 3lqgTcaUaAH46zrM7tiDBcuwWA== X-Google-Smtp-Source: ABdhPJxJ5kM7u1En3/kjqIc2/4kgaVgVsV0kh9Wn8j8fLzAdcjTbWrkwH9i92s3Byb6wTVYH7eiYvg== X-Received: by 2002:a05:600c:19cf:b0:38c:b1fd:1fc9 with SMTP id u15-20020a05600c19cf00b0038cb1fd1fc9mr17610060wmq.103.1649436477242; Fri, 08 Apr 2022 09:47:57 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 08/15] disas: use result of ->read_memory_func Date: Fri, 8 Apr 2022 17:47:35 +0100 Message-Id: <20220408164742.2844631-9-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220408164742.2844631-1-alex.bennee@linaro.org> References: <20220408164742.2844631-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x333.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: , Cc: fam@euphon.net, berrange@redhat.com, stefanha@redhat.com, crosa@redhat.com, aaron@os.amperecomputing.com, robhenry@microsoft.com, f4bug@amsat.org, mahmoudabdalghany@outlook.com, minyihh@uci.edu, cota@braap.org, Luke.Craig@ll.mit.edu, pbonzini@redhat.com, kuhn.chenqun@huawei.com, ma.mandourr@gmail.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= , aurelien@aurel32.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1649436838863100001 This gets especially confusing if you start plugging in host addresses from a trace and you wonder why the output keeps changing. Report when read_memory_func fails instead of blindly disassembling the buffer contents. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson --- disas.c | 20 ++++++------- disas/capstone.c | 73 ++++++++++++++++++++++++++++-------------------- 2 files changed, 53 insertions(+), 40 deletions(-) diff --git a/disas.c b/disas.c index 9b52b2fa93..04329aae36 100644 --- a/disas.c +++ b/disas.c @@ -83,18 +83,18 @@ static int print_insn_objdump(bfd_vma pc, disassemble_i= nfo *info, const char *prefix) { int i, n =3D info->buffer_length; - uint8_t *buf =3D g_malloc(n); - - info->read_memory_func(pc, buf, n, info); - - for (i =3D 0; i < n; ++i) { - if (i % 32 =3D=3D 0) { - info->fprintf_func(info->stream, "\n%s: ", prefix); + g_autofree uint8_t *buf =3D g_malloc(n); + + if (info->read_memory_func(pc, buf, n, info) =3D=3D 0) { + for (i =3D 0; i < n; ++i) { + if (i % 32 =3D=3D 0) { + info->fprintf_func(info->stream, "\n%s: ", prefix); + } + info->fprintf_func(info->stream, "%02x", buf[i]); } - info->fprintf_func(info->stream, "%02x", buf[i]); + } else { + info->fprintf_func(info->stream, "unable to read memory"); } - - g_free(buf); return n; } =20 diff --git a/disas/capstone.c b/disas/capstone.c index 20bc8f9669..fe3efb0d3c 100644 --- a/disas/capstone.c +++ b/disas/capstone.c @@ -191,37 +191,43 @@ bool cap_disas_target(disassemble_info *info, uint64_= t pc, size_t size) size_t tsize =3D MIN(sizeof(cap_buf) - csize, size); const uint8_t *cbuf =3D cap_buf; =20 - info->read_memory_func(pc + csize, cap_buf + csize, tsize, info); - csize +=3D tsize; - size -=3D tsize; + if (info->read_memory_func(pc + csize, cap_buf + csize, tsize, inf= o) =3D=3D 0) { + csize +=3D tsize; + size -=3D tsize; =20 - while (cs_disasm_iter(handle, &cbuf, &csize, &pc, insn)) { - cap_dump_insn(info, insn); - } + while (cs_disasm_iter(handle, &cbuf, &csize, &pc, insn)) { + cap_dump_insn(info, insn); + } + + /* If the target memory is not consumed, go back for more... */ + if (size !=3D 0) { + /* + * ... taking care to move any remaining fractional insn + * to the beginning of the buffer. + */ + if (csize !=3D 0) { + memmove(cap_buf, cbuf, csize); + } + continue; + } =20 - /* If the target memory is not consumed, go back for more... */ - if (size !=3D 0) { /* - * ... taking care to move any remaining fractional insn - * to the beginning of the buffer. + * Since the target memory is consumed, we should not have + * a remaining fractional insn. */ if (csize !=3D 0) { - memmove(cap_buf, cbuf, csize); + info->fprintf_func(info->stream, + "Disassembler disagrees with translator= " + "over instruction decoding\n" + "Please report this to qemu-devel@nongn= u.org\n"); } - continue; - } + break; =20 - /* - * Since the target memory is consumed, we should not have - * a remaining fractional insn. - */ - if (csize !=3D 0) { + } else { info->fprintf_func(info->stream, - "Disassembler disagrees with translator " - "over instruction decoding\n" - "Please report this to qemu-devel@nongnu.org\n"); + "0x%08" PRIx64 ": unable to read memory\n",= pc); + break; } - break; } =20 cs_close(&handle); @@ -286,16 +292,23 @@ bool cap_disas_monitor(disassemble_info *info, uint64= _t pc, int count) =20 /* Make certain that we can make progress. */ assert(tsize !=3D 0); - info->read_memory_func(pc + csize, cap_buf + csize, tsize, info); - csize +=3D tsize; - - if (cs_disasm_iter(handle, &cbuf, &csize, &pc, insn)) { - cap_dump_insn(info, insn); - if (--count <=3D 0) { - break; + if (info->read_memory_func(pc + csize, cap_buf + csize, + tsize, info) =3D=3D 0) + { + csize +=3D tsize; + + if (cs_disasm_iter(handle, &cbuf, &csize, &pc, insn)) { + cap_dump_insn(info, insn); + if (--count <=3D 0) { + break; + } } + memmove(cap_buf, cbuf, csize); + } else { + info->fprintf_func(info->stream, + "0x%08" PRIx64 ": unable to read memory\n",= pc); + break; } - memmove(cap_buf, cbuf, csize); } =20 cs_close(&handle); --=20 2.30.2 From nobody Mon Feb 9 21:01:33 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1649437271170228.445660600295; Fri, 8 Apr 2022 10:01:11 -0700 (PDT) Received: from localhost ([::1]:50212 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ncryv-0006Yw-Ol for importer@patchew.org; Fri, 08 Apr 2022 13:01:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49924) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ncrmK-00077n-LB for qemu-devel@nongnu.org; Fri, 08 Apr 2022 12:48:08 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]:44706) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ncrmH-000329-IU for qemu-devel@nongnu.org; Fri, 08 Apr 2022 12:48:08 -0400 Received: by mail-wm1-x335.google.com with SMTP id v20-20020a05600c15d400b0038e9a88aee7so2832603wmf.3 for ; Fri, 08 Apr 2022 09:47:55 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id l28-20020a05600c1d1c00b0038e72a95ec4sm12128194wms.13.2022.04.08.09.47.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Apr 2022 09:47:49 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 9B3201FFC0; Fri, 8 Apr 2022 17:47:44 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5QMnRBg+xsQZXK1fOjdgSZIM6gbUBuP2/PqplwQya4U=; b=envHThycnfrlKgSxI3LryjAquBJUq/K8cjQyjamVpUXlCCbI4A/y90tNcWMlydh2xK Sqa2fLzx/+A4yzwwULjum4jx9a87PpPMvVo/RgKq+3clNPWCgZwcFSsnnG0Y0B0khz/G 8gwiLeJ/vSaDjV0Hcf0oWMr9ahxvvTIFFDPmvFs53sMedteY/JCS2VpDY3sV6Ix3kDey QEEvtwKAZGo1fd1hNmn6bNFgqjdxIeAqScAtPPvb3Jr8AWeYKRUSbjNQvDs5HGK5/sAX oYlvS6AVnNhHc3DpYkIu5KK68L6CEo1/9mDIiCCkkNWXuuJybiXC6UnJYq0AFqQ9OTRz QUsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5QMnRBg+xsQZXK1fOjdgSZIM6gbUBuP2/PqplwQya4U=; b=t09FUwAOK70a9SFiFHXQPtaY62Ln+uPa2HvxE4wRX6dm0ym67NIhMGUp1sNy4Zwj4W Y0lehSxQZeYy0xMc9JGCCOw0b3tA05iQSAU5B3lZS5Z8yFv1J8S0+waFmzBUxVH7VkVS 2mv2qNhUFElu9MdfHFtwo3wR89COdY2Z9+n7uYlazslj4KwtEr+AV2oInXTueDQM7cul aSsdP/L10N88l8GV81XDQgZD7zF5DDIjGBdc7ozozUbMQQkQn5lWc2n6LtFUa97JQSok YpPKLE7gPaGN50HBtrLSf1BfruneAT8H+KqGZ404w2gqnj7qAOuKlMMOPC48zZtw4Cw8 BIhA== X-Gm-Message-State: AOAM531qUUkH2uypZDXjsRNzdnZ13F9LezRf4Lo3hI6uIAOOypiDkDFX FCXOcJbR2GvyhikI89tpsly9Hg== X-Google-Smtp-Source: ABdhPJwLqQbwec3sGbs//MzwQVH/HJZvSk0CsLO4dBL25IVQU5LGWiYAMfAfJS9ePa+qdzf3TT050A== X-Received: by 2002:a05:600c:3b99:b0:38e:aa31:a864 with SMTP id n25-20020a05600c3b9900b0038eaa31a864mr2264200wms.108.1649436474820; Fri, 08 Apr 2022 09:47:54 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 09/15] cputlb: add tracepoints for the protect/unprotect helpers Date: Fri, 8 Apr 2022 17:47:36 +0100 Message-Id: <20220408164742.2844631-10-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220408164742.2844631-1-alex.bennee@linaro.org> References: <20220408164742.2844631-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x335.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: , Cc: fam@euphon.net, berrange@redhat.com, stefanha@redhat.com, crosa@redhat.com, Richard Henderson , aaron@os.amperecomputing.com, robhenry@microsoft.com, f4bug@amsat.org, mahmoudabdalghany@outlook.com, minyihh@uci.edu, cota@braap.org, Luke.Craig@ll.mit.edu, pbonzini@redhat.com, kuhn.chenqun@huawei.com, ma.mandourr@gmail.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= , aurelien@aurel32.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1649437271423100001 This helps track when pages are tagged for detecting code changes. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson --- accel/tcg/cputlb.c | 14 ++++++++++---- accel/tcg/trace-events | 3 +++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index 35797cea49..f2983cb2fc 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -947,18 +947,24 @@ void tlb_flush_page_bits_by_mmuidx_all_cpus_synced(CP= UState *src_cpu, idxmap, bits); } =20 -/* update the TLBs so that writes to code in the virtual page 'addr' - can be detected */ +/* + * Update the TLBs so that writes to code in the virtual page 'ram_addr' + * can be detected. + */ void tlb_protect_code(ram_addr_t ram_addr) { + trace_tlb_protect_code(ram_addr); cpu_physical_memory_test_and_clear_dirty(ram_addr, TARGET_PAGE_SIZE, DIRTY_MEMORY_CODE); } =20 -/* update the TLB so that writes in physical page 'phys_addr' are no longer - tested for self modifying code */ +/* + * Update the TLB so that writes in physical page 'ram_addr' are no longer + * tested for self modifying code + */ void tlb_unprotect_code(ram_addr_t ram_addr) { + trace_tlb_unprotect_code(ram_addr); cpu_physical_memory_set_dirty_flag(ram_addr, DIRTY_MEMORY_CODE); } =20 diff --git a/accel/tcg/trace-events b/accel/tcg/trace-events index f4d1321b1b..e11e59492f 100644 --- a/accel/tcg/trace-events +++ b/accel/tcg/trace-events @@ -7,6 +7,9 @@ exec_tb_nocache(void *tb, uintptr_t pc) "tb:%p pc=3D0x%"PRI= xPTR exec_tb_exit(void *last_tb, unsigned int flags) "tb:%p flags=3D0x%x" =20 # cputlb.c +tlb_protect_code(uint64_t ram_addr) "0x%" PRIx64"" +tlb_unprotect_code(uint64_t ram_addr) "0x%" PRIx64"" + memory_notdirty_write_access(uint64_t vaddr, uint64_t ram_addr, unsigned s= ize) "0x%" PRIx64 " ram_addr 0x%" PRIx64 " size %u" memory_notdirty_set_dirty(uint64_t vaddr) "0x%" PRIx64 =20 --=20 2.30.2 From nobody Mon Feb 9 21:01:33 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1649437852665478.9111955286454; Fri, 8 Apr 2022 10:10:52 -0700 (PDT) Received: from localhost ([::1]:43830 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ncs8I-00052d-9u for importer@patchew.org; Fri, 08 Apr 2022 13:10:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51304) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ncrsl-00084L-CN for qemu-devel@nongnu.org; Fri, 08 Apr 2022 12:54:47 -0400 Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]:44584) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ncrsj-0003tJ-Tp for qemu-devel@nongnu.org; Fri, 08 Apr 2022 12:54:47 -0400 Received: by mail-ed1-x534.google.com with SMTP id d7so10709873edn.11 for ; Fri, 08 Apr 2022 09:54:45 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id z11-20020a50e68b000000b00412ec8b2180sm10614237edm.90.2022.04.08.09.54.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Apr 2022 09:54:43 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id C396F1FFC1; Fri, 8 Apr 2022 17:47:44 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=BMis61C8omQYYseV7MGnkVBUiKXffiRK6pjvcW205Rg=; b=JxkhP0+fU7ua0h1hkpmIU5X6+bXjFlsqJckyalU7djWibnUIH92bqeAACfEy2/jV1u uNFm1BQq24YpMA1lwRp/UCHHS6xJU1p5cd/CM14bOIrbiZ8x0lI4Y7JqSUYYHKT59zzR kZsDtIl3ZOdNu4ngSpzpHXYNn1JfvInC7TSDlJdm/t6lNzY1iV4BQ5XQwaVWMLZxH55C M/3/X5rDtdvr988MIMfJlVZ1Ze9J+lltb5OPfCKXxxyeF+lUZXP9pNpL9GpKTWeXn7ey wKi9WFtcP/+6iuWhgCi/Jo9XTIkjd8W0xlLKqHojz3000T7J6dY1CV8bc/s50lOGG5b/ bLpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BMis61C8omQYYseV7MGnkVBUiKXffiRK6pjvcW205Rg=; b=t7ujHsaEuT/jibIJzdhJzfl8+GVGPDQbO1Oh5L9PSQWU8UNqseUSMzK5QQxEYJErDH IMGs/5owoebsfA0PCzNcqnvkuyxBxAj37WupDIvMk0O5cBGaWwi8vedHRPgc79Fb3M8T s+BL+BxDTGnePbKYMTesKDSbakYVaolaxIV9tLT8REM+hrMTMsPfaGyXb2BiLIEf9w0e b3Rh2mFYqWB0mnjntqkmj/5nCEhh+Q8h5r1Qsz7tNVccYvcqPsG9qdXq9beUnQLuXmwn ut0XG8m9qD3VZnrnFXKA66NuzAjc6F8GllpLp1nBQb8yCguHB3mRaqoLahghJE4Z2TCx zmYw== X-Gm-Message-State: AOAM532PN2DFINXL87DWdjvgPOyPeZttpAXxn8YWmj3eVKPUXYR9r6p+ /f37v91mrVSmtx7+rwpPeWr8Fg== X-Google-Smtp-Source: ABdhPJzOpXYzyjAGmZj9PWUCu2ZUIjtKjG5WERAFN6QaKRg0hmYsVP5mSRZFpT8NfI0UUoqDXhclvQ== X-Received: by 2002:a50:c3cf:0:b0:41d:5fc4:7931 with SMTP id i15-20020a50c3cf000000b0041d5fc47931mr1088212edf.244.1649436884406; Fri, 08 Apr 2022 09:54:44 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 10/15] cputlb: add tracepoints for TB invalidation Date: Fri, 8 Apr 2022 17:47:37 +0100 Message-Id: <20220408164742.2844631-11-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220408164742.2844631-1-alex.bennee@linaro.org> References: <20220408164742.2844631-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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=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: , Cc: fam@euphon.net, berrange@redhat.com, stefanha@redhat.com, crosa@redhat.com, Richard Henderson , aaron@os.amperecomputing.com, robhenry@microsoft.com, f4bug@amsat.org, mahmoudabdalghany@outlook.com, minyihh@uci.edu, cota@braap.org, Luke.Craig@ll.mit.edu, pbonzini@redhat.com, kuhn.chenqun@huawei.com, ma.mandourr@gmail.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= , aurelien@aurel32.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1649437854902100001 Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Richard Henderson --- accel/tcg/translate-all.c | 2 ++ accel/tcg/trace-events | 1 + 2 files changed, 3 insertions(+) diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index e9f1cc179d..b0009177b9 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -1180,6 +1180,8 @@ static void do_tb_phys_invalidate(TranslationBlock *t= b, bool rm_from_page_list) =20 assert_memory_lock(); =20 + trace_tb_phys_invalidate(tb, tb->pc); + /* make sure no further incoming jumps will be chained to this TB */ qemu_spin_lock(&tb->jmp_lock); qatomic_set(&tb->cflags, tb->cflags | CF_INVALID); diff --git a/accel/tcg/trace-events b/accel/tcg/trace-events index e11e59492f..c034649dc2 100644 --- a/accel/tcg/trace-events +++ b/accel/tcg/trace-events @@ -14,5 +14,6 @@ memory_notdirty_write_access(uint64_t vaddr, uint64_t ram= _addr, unsigned size) " memory_notdirty_set_dirty(uint64_t vaddr) "0x%" PRIx64 =20 # translate-all.c +tb_phys_invalidate(void *tb, uintptr_t pc) "tb:%p, pc:0x%"PRIxPTR"" tb_invalidate_phys_page_fast(uint64_t page_start, int len, uint64_t ret, i= nt wc, void *bmap) "addr:0x%" PRIx64 "/%d pc:0x%" PRIx64" wc:%d/%p" translate_block(void *tb, uintptr_t pc, const void *tb_code) "tb:%p, pc:0x= %"PRIxPTR", tb_code:%p" --=20 2.30.2 From nobody Mon Feb 9 21:01:33 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1649437056365339.7530966674925; Fri, 8 Apr 2022 09:57:36 -0700 (PDT) Received: from localhost ([::1]:43400 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ncrvT-0001zv-E2 for importer@patchew.org; Fri, 08 Apr 2022 12:57:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51358) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ncrsp-0008Dx-0w for qemu-devel@nongnu.org; Fri, 08 Apr 2022 12:54:51 -0400 Received: from mail-ed1-x533.google.com ([2a00:1450:4864:20::533]:34555) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ncrsn-0003uE-BU for qemu-devel@nongnu.org; Fri, 08 Apr 2022 12:54:50 -0400 Received: by mail-ed1-x533.google.com with SMTP id r10so10746110eda.1 for ; Fri, 08 Apr 2022 09:54:48 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id bn3-20020a170906c0c300b006e50416e24bsm8096427ejb.98.2022.04.08.09.54.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Apr 2022 09:54:43 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 06F221FFC2; Fri, 8 Apr 2022 17:47:45 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=r/12QGg4Jo7kjR+PCLlJKZD8+ovapbNWGqrPOplat00=; b=LvR6ZJNoGESME2JakDF94tMpKKkCIzJ1zVKl0QvVcnHPHEZgW/WohecNmiTQh/pKZY 0sodehDTqRtL4nZreFuJfG6Lu8JnqQpPiGQ+RSR0gvupBk29XzRItKiPJHL28lYwqcxL VxpwQtLiYQWeR//+GpUMhfSXMqk0JeiZ0NejeGdsMtW4lE3ouu3K+0VHD6PuY5KB9jYm cIXdLyTNGvbVCnWxGea7AHmsJgP0iZt58Wdb07Ns9lDDPrtmZj4+5t8tyEcd3kbOnW26 Jciau6OuzbCMYxTJSiSP2kWPh84iAuV0ANHFDz6Bi0OHEoE5rU5+pfGssswhOxK1xXJJ IMcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=r/12QGg4Jo7kjR+PCLlJKZD8+ovapbNWGqrPOplat00=; b=Iyjc0DCXPQpTYNma1q6c9f4ienNmdjf3j9f7ZUZDJKdkLyk+JLCOZPMRLeb8jMtP9M u+ko6kghJQDj7r+YEL42vMP5MB+V4mtTG29c4s6+avw+zdwqhzB3ZrOdWxM6IeC9arit adH1OxF1P1ZssR3iH2jratJgxwp1RtcWTUrUsweNpYKo1lPBkiEGUpDXLt5+kZxG2zEb uPo8raxBI3gC2is/ENsFyJGhp0qvFSm6SR8CF+0uqjUSkTug9019PF6U3Of5v0qxnhLG fjTSFTYQReHViLznBRsaVJeM757gacb3cI73zJKEmN05oUgl/Olf3CotFEV0Y8TNt/yz iWCQ== X-Gm-Message-State: AOAM531BSoRyVBxrH0axt5GYgG1eE7BhrfB0M0wgCHZURIaCiAnO34I2 tS8CzhrUBCxuf34NThJ3XiBTFQ== X-Google-Smtp-Source: ABdhPJyjcbxUjuOZfZHuIw3FlzPr/CgOM8L0fwvC4wvmMa5x0msoq22XUv2XtWVl2qxj2H+Ww1fJfA== X-Received: by 2002:a05:6402:42c6:b0:41c:ded2:6d5 with SMTP id i6-20020a05640242c600b0041cded206d5mr20671726edc.41.1649436888031; Fri, 08 Apr 2022 09:54:48 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 11/15] accel/tcg: add tb_invalidate_phys_page_range tracepoint Date: Fri, 8 Apr 2022 17:47:38 +0100 Message-Id: <20220408164742.2844631-12-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220408164742.2844631-1-alex.bennee@linaro.org> References: <20220408164742.2844631-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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=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: , Cc: fam@euphon.net, berrange@redhat.com, stefanha@redhat.com, crosa@redhat.com, Richard Henderson , aaron@os.amperecomputing.com, robhenry@microsoft.com, f4bug@amsat.org, mahmoudabdalghany@outlook.com, minyihh@uci.edu, cota@braap.org, Luke.Craig@ll.mit.edu, pbonzini@redhat.com, kuhn.chenqun@huawei.com, ma.mandourr@gmail.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= , aurelien@aurel32.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1649437058075100001 This gives a little more insight into what is going on as we invalidate a range of TBs. Signed-off-by: Alex Benn=C3=A9e --- accel/tcg/translate-all.c | 9 +++++++++ accel/tcg/trace-events | 1 + 2 files changed, 10 insertions(+) diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index b0009177b9..625c46dd9b 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -1671,6 +1671,7 @@ tb_invalidate_phys_page_range__locked(struct page_col= lection *pages, TranslationBlock *tb; tb_page_addr_t tb_start, tb_end; int n; + int checked =3D 0, removed =3D 0; #ifdef TARGET_HAS_PRECISE_SMC CPUState *cpu =3D current_cpu; CPUArchState *env =3D NULL; @@ -1695,6 +1696,7 @@ tb_invalidate_phys_page_range__locked(struct page_col= lection *pages, the code */ PAGE_FOR_EACH_TB(p, tb, n) { assert_page_locked(p); + checked++; /* NOTE: this is subtle as a TB may span two physical pages */ if (n =3D=3D 0) { /* NOTE: tb_end may be after the end of the page, but @@ -1728,13 +1730,20 @@ tb_invalidate_phys_page_range__locked(struct page_c= ollection *pages, } #endif /* TARGET_HAS_PRECISE_SMC */ tb_phys_invalidate__locked(tb); + removed++; } } + + #if !defined(CONFIG_USER_ONLY) /* if no code remaining, no need to continue to use slow writes */ if (!p->first_tb) { invalidate_page_bitmap(p); tlb_unprotect_code(start); + trace_tb_invalidate_phys_page_range(checked, removed, 0); + } else { + TranslationBlock *tb =3D (TranslationBlock *) p->first_tb; + trace_tb_invalidate_phys_page_range(checked, removed, tb->pc); } #endif #ifdef TARGET_HAS_PRECISE_SMC diff --git a/accel/tcg/trace-events b/accel/tcg/trace-events index c034649dc2..fdc64e1423 100644 --- a/accel/tcg/trace-events +++ b/accel/tcg/trace-events @@ -15,5 +15,6 @@ memory_notdirty_set_dirty(uint64_t vaddr) "0x%" PRIx64 =20 # translate-all.c tb_phys_invalidate(void *tb, uintptr_t pc) "tb:%p, pc:0x%"PRIxPTR"" +tb_invalidate_phys_page_range(int checked, int removed, uintptr_t ftb_pc) = "checked:%d removed:%d first_tb_pc:0x%"PRIxPTR"" tb_invalidate_phys_page_fast(uint64_t page_start, int len, uint64_t ret, i= nt wc, void *bmap) "addr:0x%" PRIx64 "/%d pc:0x%" PRIx64" wc:%d/%p" translate_block(void *tb, uintptr_t pc, const void *tb_code) "tb:%p, pc:0x= %"PRIxPTR", tb_code:%p" --=20 2.30.2 From nobody Mon Feb 9 21:01:33 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1649437182321303.3162186607592; Fri, 8 Apr 2022 09:59:42 -0700 (PDT) Received: from localhost ([::1]:48968 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ncrxV-0005kz-4X for importer@patchew.org; Fri, 08 Apr 2022 12:59:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49938) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ncrmK-000788-Up for qemu-devel@nongnu.org; Fri, 08 Apr 2022 12:48:09 -0400 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:38646) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ncrmI-00031p-HR for qemu-devel@nongnu.org; Fri, 08 Apr 2022 12:48:08 -0400 Received: by mail-wr1-x429.google.com with SMTP id a2so4524527wrh.5 for ; Fri, 08 Apr 2022 09:47:52 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id bg8-20020a05600c3c8800b0038e4c5967besm11003039wmb.3.2022.04.08.09.47.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Apr 2022 09:47:49 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 37B641FFC3; Fri, 8 Apr 2022 17:47:45 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Gs6DhXXH3OheiODrWMr7bw7KN+vJ8pkDZF2hBYggHlU=; b=G/7GqOFOyj9b10vXROCsAbFk/AZyoR84IitX7+YHykcxem7Jgpsn+qK0XkRr4QfIpt Ky6w4cA4pSCz8La+9WIVX7mR+VXu2oc0i1LwnZcHBS0+UoA6GiqztSfuvhf+JxyltLDZ Ap0PPNpdqyO/ivIWtLSQOqGiwWYAT5kq7yxD5a1JpO/QU6835GxS3ydvrLZXfCS2PbY9 Kc698Fs4nVQdJhr+wOeD3fs55CoB1Wo+1OpgftPrHQqLcoXIZd35YTp7YuXpr7yEuI2J WO1Bt9or+FzRsQiYIMUgBtCqhn14HuO7P4yCjoAWTUJzMb9xZn1uVmrhSEcsXl3zP3ml DUdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Gs6DhXXH3OheiODrWMr7bw7KN+vJ8pkDZF2hBYggHlU=; b=o27JO5SCxjNBpC0e1hWwDEvRAAeo7fURsqzamp9hR4vCEvF7LH/Pp0TbpIdeCvqqA7 1azBAvJFcmZxo5VvtFutL95hWFkLS7ymrLX/epbN9eYCQkF+UqUw4l0VU3onT2zoV3UM OYVaRvSB+wqlkoke9VIq7FJj7WjHQcHCkSjSCZxJpIGR/fR46DEd3beiBy4Bb3is3aVV rRv8gEixXAcycZsFz2E8946q8YW7XYV6nR5EOW5K0YUzZ5PGVHvJqGrIR57K2+Zfb66a rZXLv1zC9mEV6Re4H4jbVy++A+e+LXD7jgaGRsRRq1ufSniFSDJYMlP1F3BBgjJWBWsg 6m8w== X-Gm-Message-State: AOAM532WMiTFvy9Ru1oVQ2zb46hqWcR26HwkUxA8Dlw4b7mdmHyy/aU6 7lBWfXEMGyq5x1omqC3isOP/3fWeaGUc8w== X-Google-Smtp-Source: ABdhPJzXovumMTc9TKCJZhxZiLgp70uaJe4Qrth+cAUf+UB4dehZIFy6TBfnkI5FbHn0lafFA/VfRQ== X-Received: by 2002:adf:a1cd:0:b0:206:168c:1c7e with SMTP id v13-20020adfa1cd000000b00206168c1c7emr15521853wrv.209.1649436471385; Fri, 08 Apr 2022 09:47:51 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 12/15] tests/tcg: add memory-sve test for aarch64 Date: Fri, 8 Apr 2022 17:47:39 +0100 Message-Id: <20220408164742.2844631-13-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220408164742.2844631-1-alex.bennee@linaro.org> References: <20220408164742.2844631-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x429.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: , Cc: fam@euphon.net, Peter Maydell , berrange@redhat.com, stefanha@redhat.com, "open list:ARM TCG CPUs" , crosa@redhat.com, aaron@os.amperecomputing.com, robhenry@microsoft.com, f4bug@amsat.org, mahmoudabdalghany@outlook.com, minyihh@uci.edu, cota@braap.org, Luke.Craig@ll.mit.edu, pbonzini@redhat.com, kuhn.chenqun@huawei.com, ma.mandourr@gmail.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= , aurelien@aurel32.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1649437183073100001 This will be helpful in debugging problems with tracking SVE memory accesses via the TCG plugins system. Signed-off-by: Alex Benn=C3=A9e Cc: Robert Henry Cc: Aaron Lindsay --- tests/tcg/aarch64/Makefile.softmmu-target | 7 +++++++ tests/tcg/aarch64/system/boot.S | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/tcg/aarch64/Makefile.softmmu-target b/tests/tcg/aarch64/= Makefile.softmmu-target index a7286ac295..cc02814065 100644 --- a/tests/tcg/aarch64/Makefile.softmmu-target +++ b/tests/tcg/aarch64/Makefile.softmmu-target @@ -31,6 +31,13 @@ LDFLAGS+=3D-static -nostdlib $(CRT_OBJS) $(MINILIB_OBJS)= -lgcc =20 memory: CFLAGS+=3D-DCHECK_UNALIGNED=3D1 =20 +memory-sve: memory.c $(LINK_SCRIPT) $(CRT_OBJS) $(MINILIB_OBJS) + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS) + +memory-sve: CFLAGS+=3D-DCHECK_UNALIGNED=3D1 -march=3Darmv8.1-a+sve -O3 -fn= o-tree-loop-distribute-patterns + +TESTS+=3Dmemory-sve + # Running QEMU_BASE_MACHINE=3D-M virt -cpu max -display none QEMU_OPTS+=3D$(QEMU_BASE_MACHINE) -semihosting-config enable=3Don,target= =3Dnative,chardev=3Doutput -kernel diff --git a/tests/tcg/aarch64/system/boot.S b/tests/tcg/aarch64/system/boo= t.S index e190b1efa6..f136363d2a 100644 --- a/tests/tcg/aarch64/system/boot.S +++ b/tests/tcg/aarch64/system/boot.S @@ -179,12 +179,13 @@ __start: isb =20 /* - * Enable FP registers. The standard C pre-amble will be + * Enable FP/SVE registers. The standard C pre-amble will be * saving these and A-profile compilers will use AdvSIMD * registers unless we tell it not to. */ mrs x0, cpacr_el1 orr x0, x0, #(3 << 20) + orr x0, x0, #(3 << 16) msr cpacr_el1, x0 =20 /* Setup some stack space and enter the test code. --=20 2.30.2 From nobody Mon Feb 9 21:01:33 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1649438020563747.3028518636263; Fri, 8 Apr 2022 10:13:40 -0700 (PDT) Received: from localhost ([::1]:49832 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ncsB1-00016d-FR for importer@patchew.org; Fri, 08 Apr 2022 13:13:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51330) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ncrsm-00088X-SQ for qemu-devel@nongnu.org; Fri, 08 Apr 2022 12:54:48 -0400 Received: from mail-ej1-x633.google.com ([2a00:1450:4864:20::633]:36820) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ncrsk-0003tk-Js for qemu-devel@nongnu.org; Fri, 08 Apr 2022 12:54:48 -0400 Received: by mail-ej1-x633.google.com with SMTP id k23so18505450ejd.3 for ; Fri, 08 Apr 2022 09:54:46 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id p17-20020aa7d311000000b00419449b00e9sm10657021edq.64.2022.04.08.09.54.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Apr 2022 09:54:43 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 6614B1FFC4; Fri, 8 Apr 2022 17:47:45 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lTvGAjUBHokhz47gGcffyY4wlijj7lVsJzRf6BwegRA=; b=xGDf7hmiNFTexqfTcIIkpU3WyMyDqDg9c0GoNmaFVZOvpDi9cR0uLeSVzIWH2uhjzB bntFNpPzVG+KUgmY9xFmLGFQ/7v5e67vpY1Nvp8J313Z3hrqumJlfxZ1OJaVpRATV599 8al9yB0crLGUAAGEFySYPLFdumj9LMDvMZ4ConiK/a2jB87ZaWM2gs39FyTOmxrZe7DQ odqmCu4QREhBf1Nq64Mpem7hQpe1w3svrN3+Q4Xmf9EFmCwzEBX9piiPaHMHTQegVUTk qYEJ/usj+f/hC0qYNakKLjsayuUAbHJ6xAc3m1FkX0hF/YqLs/Wfh6kRU7uvNrzgQ/RJ PSZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lTvGAjUBHokhz47gGcffyY4wlijj7lVsJzRf6BwegRA=; b=EnLVrBMu7mssy9pjxXmwJj457VwFm1NBZGxPXUqvgrzFcaiciOA80Ox0caG3+tQKcD 4nFfbn/SSbRKiIuZ8+6mJG9cjCzFFGMQR2sAIk/6NrVABlcGPaohhz96FF4LmFfXqHfq ywEbFvdi9cpAwTDv5Kebf1BokK1JcTX3wt+vlGHAbxpWrq//emXemoHMiXMFrveO20Mu r4+wOORsAib7svVlEUPvea1IlcnofxbtC5FxyPFJWkr0Um/1gaoF6XQxRKGxSMslr4Ah qsL3iW3Q+fpljlm2TOq6CrtE0lEulPj3CAy2/UQmrL9R90N787gR/xLxZTN+004wSf9d dz6Q== X-Gm-Message-State: AOAM531tB8a2xZB86Actz/9He2ZcllUmEiz+mZSx40jkRpOEDqhC5qpY 7GHnVaCqGkvxomuCAAGrws++TQ== X-Google-Smtp-Source: ABdhPJx5Aj+16vlurZ+LgsqippVMmNpb8qsMxSzay9SlYo7CXcIg3xCzgEclrEj6YIMDs/TY0AF3DQ== X-Received: by 2002:a17:906:2991:b0:6cf:6b24:e92f with SMTP id x17-20020a170906299100b006cf6b24e92fmr18985833eje.748.1649436885195; Fri, 08 Apr 2022 09:54:45 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 13/15] plugins: extend execlog to filter matches Date: Fri, 8 Apr 2022 17:47:40 +0100 Message-Id: <20220408164742.2844631-14-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220408164742.2844631-1-alex.bennee@linaro.org> References: <20220408164742.2844631-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::633; envelope-from=alex.bennee@linaro.org; helo=mail-ej1-x633.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, 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: , Cc: fam@euphon.net, berrange@redhat.com, stefanha@redhat.com, crosa@redhat.com, aaron@os.amperecomputing.com, robhenry@microsoft.com, f4bug@amsat.org, mahmoudabdalghany@outlook.com, minyihh@uci.edu, cota@braap.org, Luke.Craig@ll.mit.edu, pbonzini@redhat.com, kuhn.chenqun@huawei.com, ma.mandourr@gmail.com, Alexandre Iooss , =?UTF-8?q?Alex=20Benn=C3=A9e?= , aurelien@aurel32.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1649438021837100001 Sometimes the whole execlog is just two much so add the ability to filter by instruction opcode or address. [AJB: this shows for example .qemu-system-aarch64 -display none -serial mon:stdio \ -M virt -cpu max \ -semihosting-config enable=3Don \ -kernel ./tests/tcg/aarch64-softmmu/memory-sve \ -plugin ./contrib/plugins/libexeclog.so,ifilter=3Dst1w,afilter=3D0x40001= 808 -d plugin -D plugin.out the st1w SVE instruction is not instrumenting its stores.] Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Alexandre Iooss Cc: Robert Henry Cc: Aaron Lindsay --- docs/devel/tcg-plugins.rst | 9 +++- contrib/plugins/execlog.c | 96 ++++++++++++++++++++++++++++++++------ 2 files changed, 90 insertions(+), 15 deletions(-) diff --git a/docs/devel/tcg-plugins.rst b/docs/devel/tcg-plugins.rst index a7cc44aa20..a503d44cee 100644 --- a/docs/devel/tcg-plugins.rst +++ b/docs/devel/tcg-plugins.rst @@ -346,7 +346,7 @@ The execlog tool traces executed instructions with memo= ry access. It can be used for debugging and security analysis purposes. Please be aware that this will generate a lot of output. =20 -The plugin takes no argument:: +The plugin needs default argument:: =20 qemu-system-arm $(QEMU_ARGS) \ -plugin ./contrib/plugins/libexeclog.so -d plugin @@ -364,6 +364,13 @@ which will output an execution trace following this st= ructure:: 0, 0xd34, 0xf9c8f000, "bl #0x10c8" 0, 0x10c8, 0xfff96c43, "ldr r3, [r0, #0x44]", load, 0x200000e4, RAM =20 +the output can be filtered to only track certain instructions or +addresses using the `ifilter` or `afilter` options. You can stack the +arguments if required:: + + qemu-system-arm $(QEMU_ARGS) \ + -plugin ./contrib/plugins/libexeclog.so,ifilter=3Dst1w,afilter=3D0x400= 01808 -d plugin + - contrib/plugins/cache.c =20 Cache modelling plugin that measures the performance of a given L1 cache diff --git a/contrib/plugins/execlog.c b/contrib/plugins/execlog.c index a5275dcc15..e659ac9cbb 100644 --- a/contrib/plugins/execlog.c +++ b/contrib/plugins/execlog.c @@ -20,6 +20,9 @@ QEMU_PLUGIN_EXPORT int qemu_plugin_version =3D QEMU_PLUGI= N_VERSION; /* Store last executed instruction on each vCPU as a GString */ GArray *last_exec; =20 +static GPtrArray *imatches; +static GArray *amatches; + /** * Add memory read or write information to current instruction log */ @@ -85,12 +88,13 @@ static void vcpu_insn_exec(unsigned int cpu_index, void= *udata) static void vcpu_tb_trans(qemu_plugin_id_t id, struct qemu_plugin_tb *tb) { struct qemu_plugin_insn *insn; - uint64_t insn_vaddr; - uint32_t insn_opcode; - char *insn_disas; + bool skip =3D (imatches || amatches) ? true : false; =20 size_t n =3D qemu_plugin_tb_n_insns(tb); for (size_t i =3D 0; i < n; i++) { + char *insn_disas; + uint64_t insn_vaddr; + /* * `insn` is shared between translations in QEMU, copy needed data= here. * `output` is never freed as it might be used multiple times duri= ng @@ -99,20 +103,52 @@ static void vcpu_tb_trans(qemu_plugin_id_t id, struct = qemu_plugin_tb *tb) * a limitation for CISC architectures. */ insn =3D qemu_plugin_tb_get_insn(tb, i); - insn_vaddr =3D qemu_plugin_insn_vaddr(insn); - insn_opcode =3D *((uint32_t *)qemu_plugin_insn_data(insn)); insn_disas =3D qemu_plugin_insn_disas(insn); - char *output =3D g_strdup_printf("0x%"PRIx64", 0x%"PRIx32", \"%s\"= ", - insn_vaddr, insn_opcode, insn_disas= ); + insn_vaddr =3D qemu_plugin_insn_vaddr(insn); + + /* + * If we are filtering we better check out if we have any + * hits. The skip "latches" so we can track memory accesses + * after the instruction we care about. + */ + if (skip && imatches) { + int j; + for (j =3D 0; j < imatches->len && skip; j++) { + char *m =3D g_ptr_array_index(imatches, j); + if (g_str_has_prefix(insn_disas, m)) { + skip =3D false; + } + } + } + + if (skip && amatches) { + int j; + for (j =3D 0; j < amatches->len && skip; j++) { + uint64_t v =3D g_array_index(amatches, uint64_t, j); + if (v =3D=3D insn_vaddr) { + skip =3D false; + } + } + } =20 - /* Register callback on memory read or write */ - qemu_plugin_register_vcpu_mem_cb(insn, vcpu_mem, - QEMU_PLUGIN_CB_NO_REGS, - QEMU_PLUGIN_MEM_RW, NULL); + if (skip) { + g_free(insn_disas); + } else { + uint32_t insn_opcode; + insn_opcode =3D *((uint32_t *)qemu_plugin_insn_data(insn)); + char *output =3D g_strdup_printf("0x%"PRIx64", 0x%"PRIx32", \"= %s\"", + insn_vaddr, insn_opcode, insn_d= isas); + + /* Register callback on memory read or write */ + qemu_plugin_register_vcpu_mem_cb(insn, vcpu_mem, + QEMU_PLUGIN_CB_NO_REGS, + QEMU_PLUGIN_MEM_RW, NULL); + + /* Register callback on instruction */ + qemu_plugin_register_vcpu_insn_exec_cb(insn, vcpu_insn_exec, + QEMU_PLUGIN_CB_NO_REGS,= output); + } =20 - /* Register callback on instruction */ - qemu_plugin_register_vcpu_insn_exec_cb(insn, vcpu_insn_exec, - QEMU_PLUGIN_CB_NO_REGS, out= put); } } =20 @@ -132,6 +168,25 @@ static void plugin_exit(qemu_plugin_id_t id, void *p) } } =20 +/* Add a match to the array of matches */ +static void parse_insn_match(char *match) +{ + if (!imatches) { + imatches =3D g_ptr_array_new(); + } + g_ptr_array_add(imatches, match); +} + +static void parse_vaddr_match(char *match) +{ + uint64_t v =3D g_ascii_strtoull(match, NULL, 16); + + if (!amatches) { + amatches =3D g_array_new(false, true, sizeof(uint64_t)); + } + g_array_append_val(amatches, v); +} + /** * Install the plugin */ @@ -145,6 +200,19 @@ QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin= _id_t id, */ last_exec =3D g_array_new(FALSE, FALSE, sizeof(GString *)); =20 + for (int i =3D 0; i < argc; i++) { + char *opt =3D argv[i]; + g_autofree char **tokens =3D g_strsplit(opt, "=3D", 2); + if (g_strcmp0(tokens[0], "ifilter") =3D=3D 0) { + parse_insn_match(tokens[1]); + } else if (g_strcmp0(tokens[0], "afilter") =3D=3D 0) { + parse_vaddr_match(tokens[1]); + } else { + fprintf(stderr, "option parsing failed: %s\n", opt); + return -1; + } + } + /* Register translation block and exit callbacks */ qemu_plugin_register_vcpu_tb_trans_cb(id, vcpu_tb_trans); qemu_plugin_register_atexit_cb(id, plugin_exit, NULL); --=20 2.30.2 From nobody Mon Feb 9 21:01:33 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1649437250520441.374818770567; Fri, 8 Apr 2022 10:00:50 -0700 (PDT) Received: from localhost ([::1]:49970 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ncryb-0006PJ-Cy for importer@patchew.org; Fri, 08 Apr 2022 13:00:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51374) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ncrsq-0008Is-KK for qemu-devel@nongnu.org; Fri, 08 Apr 2022 12:54:52 -0400 Received: from mail-ed1-x52b.google.com ([2a00:1450:4864:20::52b]:37752) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ncrsp-0003ub-3l for qemu-devel@nongnu.org; Fri, 08 Apr 2022 12:54:52 -0400 Received: by mail-ed1-x52b.google.com with SMTP id b15so10747380edn.4 for ; Fri, 08 Apr 2022 09:54:50 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id f2-20020a170906390200b006e7f5fedbe7sm5336427eje.3.2022.04.08.09.54.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Apr 2022 09:54:43 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 97FCD1FFBA; Fri, 8 Apr 2022 17:47:45 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KFP0HbJwpn4b/8mC3zm1M94yL+pYYUEsnbWxKZ7xRO4=; b=w2Bx6K/BdmJ1ra+KbuXMj2STD1KouuvTD4HoMkk/yXNNX3N8aLuQPsO4YFyav47CI1 JC//EQ1VwseGzJdmx+t6a0uUfCYhwajdNzggyuxKxk1ELCVVdYQxqnDHuc7I+6k8n6Xi 4iPxpLpDPzGnla51HvFWfBknyGT7jagS+glMDTokVX/ckMlhih9Xw4LpfliYULpCy2dc +V/sUYSXxNWYY5NNheKivWk6KBhsx4fapwHW64e0R1JGecSyyDrgoZyMAYIsJMUAXPBP Bjk46hSsGT3QkqTX48TMdO+J8oIB1iNK1Z0jFAG+W9vomoqSt1Mt25bUXTX6536oCk09 cPyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KFP0HbJwpn4b/8mC3zm1M94yL+pYYUEsnbWxKZ7xRO4=; b=Il6SDk14BqTn/euyT2bph8MrIblUo37bclYjxRNVmDImnAcASU9X5iswyqpdA020EO x4HXyRU3/I+urKfzj6tcyUdUhz1TIsbpoeXoDa5zt4Umw9RCzEDBygdyOl6BHDnYFmsM C36ymR5QUmi7b6fAKlAyM42FCRbYMqiCjWdPlw9hGkbOJWs/g4IX1cRU1p8ZSk2dC2D9 O/daKJh9ER+ydeI50UB8g3u/eV/a3+JLGra5hpKM8oZjRE92brhhcVnerIUcRYrOvusV EWVpkfxMQVP0nl4ilOLo1lkyxU0fnGYw75V5CH2uDGtc1NDTIQvxMLWL06pODsZb5Qag 99Hg== X-Gm-Message-State: AOAM533PrC9KJgj0NrR8xZ7UHqLgytrVOlk3tExFbvyeN/awzREWCBHx uQjgftWk+xOeUNV+zWV2jqK2+Q== X-Google-Smtp-Source: ABdhPJxyXKGuelWIKSLpsquIq0lZ0Ibmmy2VLe6O6eMwXK2dlGN/PgYRdETsDCO4DPx/8naAk0SHRA== X-Received: by 2002:a05:6402:26d0:b0:419:75eb:b3a with SMTP id x16-20020a05640226d000b0041975eb0b3amr20744011edd.0.1649436889750; Fri, 08 Apr 2022 09:54:49 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 14/15] plugins: Assert mmu_idx in range before use in qemu_plugin_get_hwaddr Date: Fri, 8 Apr 2022 17:47:41 +0100 Message-Id: <20220408164742.2844631-15-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220408164742.2844631-1-alex.bennee@linaro.org> References: <20220408164742.2844631-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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=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: , Cc: fam@euphon.net, Damien Hedde , berrange@redhat.com, stefanha@redhat.com, crosa@redhat.com, Richard Henderson , aaron@os.amperecomputing.com, robhenry@microsoft.com, f4bug@amsat.org, mahmoudabdalghany@outlook.com, minyihh@uci.edu, cota@braap.org, Luke.Craig@ll.mit.edu, pbonzini@redhat.com, kuhn.chenqun@huawei.com, ma.mandourr@gmail.com, Alexandre Iooss , =?UTF-8?q?Alex=20Benn=C3=A9e?= , aurelien@aurel32.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1649437251628100001 From: Richard Henderson Coverity reports out-of-bound accesses here. This should be a false positive due to how the index is decoded from MemOpIdx. Fixes: Coverity CID 1487201 Signed-off-by: Richard Henderson Reviewed-by: Damien Hedde Message-Id: <20220401190233.329360-1-richard.henderson@linaro.org> Signed-off-by: Alex Benn=C3=A9e --- plugins/api.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/api.c b/plugins/api.c index 7bf71b189d..2078b16edb 100644 --- a/plugins/api.c +++ b/plugins/api.c @@ -289,6 +289,8 @@ struct qemu_plugin_hwaddr *qemu_plugin_get_hwaddr(qemu_= plugin_meminfo_t info, enum qemu_plugin_mem_rw rw =3D get_plugin_meminfo_rw(info); hwaddr_info.is_store =3D (rw & QEMU_PLUGIN_MEM_W) !=3D 0; =20 + assert(mmu_idx < NB_MMU_MODES); + if (!tlb_plugin_lookup(cpu, vaddr, mmu_idx, hwaddr_info.is_store, &hwaddr_info)) { error_report("invalid use of qemu_plugin_get_hwaddr"); --=20 2.30.2 From nobody Mon Feb 9 21:01:33 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1649437397519432.6411307882512; Fri, 8 Apr 2022 10:03:17 -0700 (PDT) Received: from localhost ([::1]:54800 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ncs0y-0001Ou-37 for importer@patchew.org; Fri, 08 Apr 2022 13:03:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51354) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ncrso-0008CL-5Y for qemu-devel@nongnu.org; Fri, 08 Apr 2022 12:54:50 -0400 Received: from mail-ej1-x62b.google.com ([2a00:1450:4864:20::62b]:43958) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ncrsm-0003u2-L5 for qemu-devel@nongnu.org; Fri, 08 Apr 2022 12:54:49 -0400 Received: by mail-ej1-x62b.google.com with SMTP id bq8so18457775ejb.10 for ; Fri, 08 Apr 2022 09:54:48 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id h7-20020a1709066d8700b006d4b4d137fbsm8914280ejt.50.2022.04.08.09.54.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Apr 2022 09:54:43 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id B9F681FFC5; Fri, 8 Apr 2022 17:47:45 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8RvB6WmUyabhe4EY+P1jACVM2phgaOzNjeVgtjqCztg=; b=YpXssetPCMJVAp5fK20w2bhQd4q7LP8J3hqTsHNiYj7E/PGrAAZMWvf7MnoOI3x3+w jnuNQzMprrqlYP0VCtAdVQfwm6bg1Sa7SZc+MyZvJFJXE+BMVQJw0T6esEnL3txH6of3 huURKwVbMxDiqXK36jrsHHbpK+eqp06VDZ/eWWMldGgiLIdCFPSCFyNGv0ZgqrR0mKr+ iLEKY5wFPlIvKXIoQr1VQtk3k68DFb4A8ddt6yJXrpiCgyFrDEMnmSSWgJUJuTU/dDla i4ppY8oJsb8iLYFMAHYjNxzE/kv2pgjdnDpZApOQsaamNOXRvWdf8xxBKaxadgC9xUw2 LH+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8RvB6WmUyabhe4EY+P1jACVM2phgaOzNjeVgtjqCztg=; b=BEfw+vzQNM3Mly01RjWjU4jAuBNt9UITMFzMfjvzkVvZXaGu3+trUGceSqCWX/YNH1 mXe3sDJrjamOA1379EgGsnZUBcEU3Q6W22z+pVf0QG+w7qt8sJth0b6Wq6BbvmixK8hJ vCF5HbVghuHQ2P4aqQ7bcvuTib8kBJG/dNvDXxoI7isXl6x0N/i7C/sZsSokg5arhXKE jJ2Ity4t/OFsOgQuYk0vjf8MBNAwukhFHl/d18WodzPoY4QaL+hAKh3o60MT1ZuMKOLF yyNAlJeuZ7n5D7ZusDbqZCvPcYriwLa7ZZKlLABgXEbkfca+AWtAqV5jWjNLvDsu/pzh 1mkg== X-Gm-Message-State: AOAM532RiEp/eeHILjAen1b+d2ngYbIy0qj5h77rKoyUE+cF1BgFRUSq H+Iep8BWCLnMivFMww3TB7Jt3g== X-Google-Smtp-Source: ABdhPJwX/bHGn0WdDCL4jZRBF1FcEfPlWnNjGul8m02ic2NOd6LAqzfkQKfqKBZlvOSRGWxREs0L1w== X-Received: by 2002:a17:907:8a13:b0:6e8:289d:c744 with SMTP id sc19-20020a1709078a1300b006e8289dc744mr12274489ejc.150.1649436887070; Fri, 08 Apr 2022 09:54:47 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v1 15/15] accel/tcg: add heuristic to invalidate al TBs in a page [hack!] Date: Fri, 8 Apr 2022 17:47:42 +0100 Message-Id: <20220408164742.2844631-16-alex.bennee@linaro.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220408164742.2844631-1-alex.bennee@linaro.org> References: <20220408164742.2844631-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::62b; envelope-from=alex.bennee@linaro.org; helo=mail-ej1-x62b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, 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: , Cc: fam@euphon.net, berrange@redhat.com, stefanha@redhat.com, crosa@redhat.com, Richard Henderson , aaron@os.amperecomputing.com, robhenry@microsoft.com, f4bug@amsat.org, mahmoudabdalghany@outlook.com, minyihh@uci.edu, cota@braap.org, Luke.Craig@ll.mit.edu, pbonzini@redhat.com, kuhn.chenqun@huawei.com, ma.mandourr@gmail.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= , aurelien@aurel32.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1649437398155100001 This is a dumb attempt to reduce to the execution time of UEFI booted kernels and almost certainly not what the final solution should be. The problem is if we have generated JIT code from running firmware we can spend a lot of time carefully invalidating every TB in a page when the kernel that eventually boots and clears all the pages in RAM. This fix simply assumes any write to the start of the page should invalidate everything in the page. Once that is done following writes to the page should all follow the fast path. Signed-off-by: Alex Benn=C3=A9e --- accel/tcg/translate-all.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 625c46dd9b..67884260fa 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -1830,6 +1830,16 @@ void tb_invalidate_phys_page_fast(struct page_collec= tion *pages, uintptr_t retaddr) { PageDesc *p =3D page_find(start >> TARGET_PAGE_BITS); + unsigned int nr =3D start & ~TARGET_PAGE_MASK; + + /* + * Assume any write to the start of the page is start of clearing + * the whole page. To avoid coming back multiple times lets just + * invalidate everything first. + */ + if (nr =3D=3D 0) { + len =3D TARGET_PAGE_SIZE; + } =20 if (trace_event_get_state_backends(TRACE_TB_INVALIDATE_PHYS_PAGE_FAST)= ) { TranslationBlock *tb =3D tcg_tb_lookup(retaddr); @@ -1850,10 +1860,8 @@ void tb_invalidate_phys_page_fast(struct page_collec= tion *pages, build_page_bitmap(p); } if (p->code_bitmap) { - unsigned int nr; unsigned long b; =20 - nr =3D start & ~TARGET_PAGE_MASK; b =3D p->code_bitmap[BIT_WORD(nr)] >> (nr & (BITS_PER_LONG - 1)); if (b & ((1 << len) - 1)) { goto do_invalidate; --=20 2.30.2