From nobody Sun Nov 24 05:59:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1725977293; cv=none; d=zohomail.com; s=zohoarc; b=P/Z6BXbALggjKNkOTByv4GZ7TTrcD50DoCmwxQkQBtzLmTpAHtZ7i550RAwl3On13a29ie2uJU7I0ko+7DxQCaA63WdJJHL65omXVXvoqfnGrmaeA+oXIJyHy2YrPuHC8IP++kYyHkUwaZB6mcoo9fnuXfb/YYNRFwEZpEnY4GE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725977293; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=LndXJjyjZbmiVr1fSe4zs9iupkSXPp6CUIfGBaC22cA=; b=JkQXT6KnGmX6K6xrszxS/nyHStXw1K3VkM8GHiNbvs5Oi45rWO1RWcMWXPAKux4M3SVog4jCR2ISSuP6U03GugSHN891NodKUxy/gf9KolgLnwoBQvwHivPyW9/LYS4GnKov4LmX5HYbwxNMmZQA4KBOlTblHGpZqaWJzMHvT9I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1725977293518169.09264855253343; Tue, 10 Sep 2024 07:08:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1so1Ww-0007RZ-Lj; Tue, 10 Sep 2024 10:07:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1so1Wu-0007LR-I9 for qemu-devel@nongnu.org; Tue, 10 Sep 2024 10:07:40 -0400 Received: from mail-ed1-x536.google.com ([2a00:1450:4864:20::536]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1so1Ws-0006Tt-5j for qemu-devel@nongnu.org; Tue, 10 Sep 2024 10:07:40 -0400 Received: by mail-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-5c3c3b63135so6026087a12.3 for ; Tue, 10 Sep 2024 07:07:37 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d259f56f6sm478231866b.81.2024.09.10.07.07.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 07:07:34 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id B879D5F78C; Tue, 10 Sep 2024 15:07:33 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725977256; x=1726582056; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LndXJjyjZbmiVr1fSe4zs9iupkSXPp6CUIfGBaC22cA=; b=N56i99Iz3fwxtAICfunZEAjR7iYtuKSYXXjCefJq5ghuAjY9H7zYmCUR7RTrV+dpKm K0kVWTlmhGrTvBEwW/RwK5iKT1f6hNsji9K/eWslYtHf5yEamxE8HKFFenmJNd5lrVYr tJE9RHeuTZYJD5KTfo8L7Y01PyByL+/EfRP2qvjCeIZfu4qad8TDRYvq0VkGdHJBvxsK cENPqJM4xZ+90GwOCZ4iRulww4o1AypodEiJWGJIL+wQoeuoJfSYQM0HPFHU6LCYgyUi 3m29TWJm2TeVcrmxq0lgcJyn9Dq6oIO254VVmwwsocPQkzFWag46vXqLcrNRq48KdMP8 l/NA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725977256; x=1726582056; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LndXJjyjZbmiVr1fSe4zs9iupkSXPp6CUIfGBaC22cA=; b=kxxmk48QKxrOecVIFjMRRDFtEOma8mkAdSlDveK8Vl8RMTULY/ctj2Xw9NlBLny7Uo I8+4UTgqWF+LxK5183zY4uqclDoc6Q9B87lBn4B8aMIY58K7nevcecdqg+lL45g8JoJ/ b84v0gCleuOOjnqFozaaPFPZy6Lzgi0UyJlMPPdhM6x0nI0uHMeS9qRChtaplI1aH/Yc dXMESgtEqJsIN8yqv2mYgSU3I9tV3fdUVQojiVwzn4bLhA7o1d3U/5dKi4b0gOhxXbjZ gmBxHJAYNGjXsvFVz5isRqKK63KOwJ3LRlp+L0turd7pvaNMfzY2L+zzYhzQJya1ZoV6 pN3A== X-Gm-Message-State: AOJu0YyAXm+9vPr0VTryxeeYNukw2cK6ojM7zMZ4S0JAeKAt51jsYien /I4JuLdCqZeojvp8EdqA1ZPrM6zS7lhR+gBsjZCI5xAH5jpruhUItZKOH0V4w+s= X-Google-Smtp-Source: AGHT+IH6/OSv1IRZLPvDsahkvD7qcOlMqQ9PQ5XbqoXUFNfezIdcKuq2QcBj7ahTvAQx+swgKoN4RA== X-Received: by 2002:a17:906:6a1b:b0:a77:b4e3:4fca with SMTP id a640c23a62f3a-a8ffaaa23bbmr101780366b.9.1725977255572; Tue, 10 Sep 2024 07:07:35 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Zhao Liu , Marcel Apfelbaum , Beraldo Leal , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Alexandre Iooss , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Pierrick Bouvier , Yanan Wang , Peter Maydell , Mahmoud Mandour , Thomas Huth , qemu-arm@nongnu.org, devel@lists.libvirt.org, Jiaxun Yang , Paolo Bonzini , Richard Henderson , Wainer dos Santos Moschetta Subject: [PATCH 01/26] tests/docker: remove debian-armel-cross Date: Tue, 10 Sep 2024 15:07:08 +0100 Message-Id: <20240910140733.4007719-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240910140733.4007719-1-alex.bennee@linaro.org> References: <20240910140733.4007719-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::536; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-x536.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1725977294742116600 As debian-11 transitions to LTS we are starting to have problems building the image. While we could update to a later Debian building a 32 bit QEMU without modern floating point is niche host amongst the few remaining 32 bit hosts we regularly build for. For now we still have armhf-debian-cross-container which is currently built from the more recent debian-12. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Pierrick Bouvier --- .gitlab-ci.d/container-cross.yml | 6 - .gitlab-ci.d/crossbuilds.yml | 7 - .../dockerfiles/debian-armel-cross.docker | 179 ------------------ tests/lcitool/refresh | 6 - 4 files changed, 198 deletions(-) delete mode 100644 tests/docker/dockerfiles/debian-armel-cross.docker diff --git a/.gitlab-ci.d/container-cross.yml b/.gitlab-ci.d/container-cros= s.yml index e3103940a0..9a3ebd885e 100644 --- a/.gitlab-ci.d/container-cross.yml +++ b/.gitlab-ci.d/container-cross.yml @@ -22,12 +22,6 @@ arm64-debian-cross-container: variables: NAME: debian-arm64-cross =20 -armel-debian-cross-container: - extends: .container_job_template - stage: containers - variables: - NAME: debian-armel-cross - armhf-debian-cross-container: extends: .container_job_template stage: containers diff --git a/.gitlab-ci.d/crossbuilds.yml b/.gitlab-ci.d/crossbuilds.yml index cb499e4ee0..459273f9da 100644 --- a/.gitlab-ci.d/crossbuilds.yml +++ b/.gitlab-ci.d/crossbuilds.yml @@ -1,13 +1,6 @@ include: - local: '/.gitlab-ci.d/crossbuild-template.yml' =20 -cross-armel-user: - extends: .cross_user_build_job - needs: - job: armel-debian-cross-container - variables: - IMAGE: debian-armel-cross - cross-armhf-user: extends: .cross_user_build_job needs: diff --git a/tests/docker/dockerfiles/debian-armel-cross.docker b/tests/doc= ker/dockerfiles/debian-armel-cross.docker deleted file mode 100644 index 8476fc8cce..0000000000 --- a/tests/docker/dockerfiles/debian-armel-cross.docker +++ /dev/null @@ -1,179 +0,0 @@ -# THIS FILE WAS AUTO-GENERATED -# -# $ lcitool dockerfile --layers all --cross-arch armv6l debian-11 qemu -# -# https://gitlab.com/libvirt/libvirt-ci - -FROM docker.io/library/debian:11-slim - -RUN export DEBIAN_FRONTEND=3Dnoninteractive && \ - apt-get update && \ - apt-get install -y eatmydata && \ - eatmydata apt-get dist-upgrade -y && \ - eatmydata apt-get install --no-install-recommends -y \ - bash \ - bc \ - bison \ - bsdextrautils \ - bzip2 \ - ca-certificates \ - ccache \ - dbus \ - debianutils \ - diffutils \ - exuberant-ctags \ - findutils \ - flex \ - gcc \ - gcovr \ - gettext \ - git \ - hostname \ - libglib2.0-dev \ - libgtk-vnc-2.0-dev \ - libpcre2-dev \ - libsndio-dev \ - libspice-protocol-dev \ - llvm \ - locales \ - make \ - meson \ - mtools \ - ncat \ - ninja-build \ - openssh-client \ - pkgconf \ - python3 \ - python3-numpy \ - python3-opencv \ - python3-pillow \ - python3-pip \ - python3-setuptools \ - python3-sphinx \ - python3-sphinx-rtd-theme \ - python3-venv \ - python3-wheel \ - python3-yaml \ - rpm2cpio \ - sed \ - socat \ - sparse \ - tar \ - tesseract-ocr \ - tesseract-ocr-eng \ - xorriso \ - zstd && \ - eatmydata apt-get autoremove -y && \ - eatmydata apt-get autoclean -y && \ - sed -Ei 's,^# (en_US\.UTF-8 .*)$,\1,' /etc/locale.gen && \ - dpkg-reconfigure locales && \ - rm -f /usr/lib*/python3*/EXTERNALLY-MANAGED - -RUN /usr/bin/pip3 install tomli - -ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers" -ENV LANG "en_US.UTF-8" -ENV MAKE "/usr/bin/make" -ENV NINJA "/usr/bin/ninja" -ENV PYTHON "/usr/bin/python3" - -RUN export DEBIAN_FRONTEND=3Dnoninteractive && \ - dpkg --add-architecture armel && \ - eatmydata apt-get update && \ - eatmydata apt-get dist-upgrade -y && \ - eatmydata apt-get install --no-install-recommends -y dpkg-dev && \ - eatmydata apt-get install --no-install-recommends -y \ - gcc-arm-linux-gnueabi \ - libaio-dev:armel \ - libasan6:armel \ - libasound2-dev:armel \ - libattr1-dev:armel \ - libbpf-dev:armel \ - libbrlapi-dev:armel \ - libbz2-dev:armel \ - libc6-dev:armel \ - libcacard-dev:armel \ - libcap-ng-dev:armel \ - libcapstone-dev:armel \ - libcmocka-dev:armel \ - libcurl4-gnutls-dev:armel \ - libdaxctl-dev:armel \ - libdrm-dev:armel \ - libepoxy-dev:armel \ - libfdt-dev:armel \ - libffi-dev:armel \ - libfuse3-dev:armel \ - libgbm-dev:armel \ - libgcrypt20-dev:armel \ - libglib2.0-dev:armel \ - libglusterfs-dev:armel \ - libgnutls28-dev:armel \ - libgtk-3-dev:armel \ - libibverbs-dev:armel \ - libiscsi-dev:armel \ - libjemalloc-dev:armel \ - libjpeg62-turbo-dev:armel \ - libjson-c-dev:armel \ - liblttng-ust-dev:armel \ - liblzo2-dev:armel \ - libncursesw5-dev:armel \ - libnfs-dev:armel \ - libnuma-dev:armel \ - libpam0g-dev:armel \ - libpipewire-0.3-dev:armel \ - libpixman-1-dev:armel \ - libpng-dev:armel \ - libpulse-dev:armel \ - librbd-dev:armel \ - librdmacm-dev:armel \ - libsasl2-dev:armel \ - libsdl2-dev:armel \ - libsdl2-image-dev:armel \ - libseccomp-dev:armel \ - libselinux1-dev:armel \ - libslirp-dev:armel \ - libsnappy-dev:armel \ - libspice-server-dev:armel \ - libssh-gcrypt-dev:armel \ - libsystemd-dev:armel \ - libtasn1-6-dev:armel \ - libubsan1:armel \ - libudev-dev:armel \ - liburing-dev:armel \ - libusb-1.0-0-dev:armel \ - libusbredirhost-dev:armel \ - libvdeplug-dev:armel \ - libvirglrenderer-dev:armel \ - libvte-2.91-dev:armel \ - libzstd-dev:armel \ - nettle-dev:armel \ - systemtap-sdt-dev:armel \ - zlib1g-dev:armel && \ - eatmydata apt-get autoremove -y && \ - eatmydata apt-get autoclean -y && \ - mkdir -p /usr/local/share/meson/cross && \ - printf "[binaries]\n\ -c =3D '/usr/bin/arm-linux-gnueabi-gcc'\n\ -ar =3D '/usr/bin/arm-linux-gnueabi-gcc-ar'\n\ -strip =3D '/usr/bin/arm-linux-gnueabi-strip'\n\ -pkgconfig =3D '/usr/bin/arm-linux-gnueabi-pkg-config'\n\ -\n\ -[host_machine]\n\ -system =3D 'linux'\n\ -cpu_family =3D 'arm'\n\ -cpu =3D 'arm'\n\ -endian =3D 'little'\n" > /usr/local/share/meson/cross/arm-linux-gnueabi &&= \ - dpkg-query --showformat '${Package}_${Version}_${Architecture}\n' --sh= ow > /packages.txt && \ - mkdir -p /usr/libexec/ccache-wrappers && \ - ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/arm-linux-gnueabi-c= c && \ - ln -s /usr/bin/ccache /usr/libexec/ccache-wrappers/arm-linux-gnueabi-g= cc - -ENV ABI "arm-linux-gnueabi" -ENV MESON_OPTS "--cross-file=3Darm-linux-gnueabi" -ENV QEMU_CONFIGURE_OPTS --cross-prefix=3Darm-linux-gnueabi- -ENV DEF_TARGET_LIST arm-softmmu,arm-linux-user,armeb-linux-user -# As a final step configure the user (if env is defined) -ARG USER -ARG UID -RUN if [ "${USER}" ]; then \ - id ${USER} 2>/dev/null || useradd -u ${UID} -U ${USER}; fi diff --git a/tests/lcitool/refresh b/tests/lcitool/refresh index ac803e34f1..199d5fad87 100755 --- a/tests/lcitool/refresh +++ b/tests/lcitool/refresh @@ -154,12 +154,6 @@ try: trailer=3Dcross_build("aarch64-linux-gnu-", "aarch64-softmmu,aarch64-linux= -user")) =20 - # migration to bookworm stalled: https://lists.debian.org/debian-arm/2= 023/09/msg00006.html - generate_dockerfile("debian-armel-cross", "debian-11", - cross=3D"armv6l", - trailer=3Dcross_build("arm-linux-gnueabi-", - "arm-softmmu,arm-linux-user,ar= meb-linux-user")) - generate_dockerfile("debian-armhf-cross", "debian-12", cross=3D"armv7l", trailer=3Dcross_build("arm-linux-gnueabihf-", --=20 2.39.2 From nobody Sun Nov 24 05:59:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1725977431; cv=none; d=zohomail.com; s=zohoarc; b=R7zAbK4LyaxwOF27bsdN7qzklZoKpG9dvZPqJM2dnbAvWIc5PvlE8t3AyY8K2mt7b2piFdtxGZK/jBcYCrWeto87q9DFCSk+I4unjN5lxrxufnbXfg/Qi1IjQxXgbANB4lzjaSlb5Q6cl8Es8d9tVXz1RpYH4bvZxoxh3V+2THo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725977431; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ExuMbIXOAQGfG1vwm+EE/TEBGthlbZ6vFrpI/DJuVTs=; b=K6dcWSeyXpIDnr0/fwkL7x7WIfjlY07G4MIPYPYAAnmDd9RziZw/rGRkE08xsrIuaWlUfQo6UP49Q+LykVo9xIlLgtxcJ0VFUjqYNtbXo1XPyrt6Tx/F2zgIOs1oHgjsollg26VuEdmumq4F/Qm0YOAB4r0528b88Sth6HmcLs4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1725977430978502.92287362464594; Tue, 10 Sep 2024 07:10:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1so1X1-0007ng-KW; Tue, 10 Sep 2024 10:07:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1so1Wx-0007WE-PE for qemu-devel@nongnu.org; Tue, 10 Sep 2024 10:07:43 -0400 Received: from mail-lf1-x136.google.com ([2a00:1450:4864:20::136]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1so1Wt-0006Uf-RH for qemu-devel@nongnu.org; Tue, 10 Sep 2024 10:07:43 -0400 Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-5365a9574b6so6261784e87.1 for ; Tue, 10 Sep 2024 07:07:39 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25cecc21sm484887666b.166.2024.09.10.07.07.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 07:07:34 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id D33825F7B4; Tue, 10 Sep 2024 15:07:33 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725977258; x=1726582058; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ExuMbIXOAQGfG1vwm+EE/TEBGthlbZ6vFrpI/DJuVTs=; b=gWySgFGSZJHBFSCZchbamVIoMYzoFyDoLUWaN56zotj/54fxcwDClfO1uHrgtzDCVo 87BoehHA4G9bJ+IbJE228SWpKXEEcskzz8cI6SNsfERZMPgJ5fgCXQVzjlU1H25iZqr8 zDbies236RfOiRL33o6lwGXDJDT57o58nnKc27eV+nNSpL9XW7IAGQVq/Wl0rY9R9Gcd BkM7dYoysdeBFcFum3YCkHJzVZvY3Q4X8XM3ZL7UONsvZ12OUQJAeN/OnZc+m/1nD271 gJxJM+KGNvxeDay6seaAvR+6hMzBOJtyKXaiNIK6+xnAMBCk/9Ut/VzsO5cCbgM44Dre fseQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725977258; x=1726582058; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ExuMbIXOAQGfG1vwm+EE/TEBGthlbZ6vFrpI/DJuVTs=; b=gV+pVOYlaICYw40QLxhEI0VdnS4Howh90f3iED3faBDVHnOMJcYfAxIjvQZxCE+03L OaQMcBTsR7jQVi7BdKeC8qGa7bMg3RbcP9kbT10IxDcs84XO0p6kwzhuwS8rkDkBtY2+ OypBQlsvuF96C7bG6xQb9HtZ3YI327nLqvTc+W5LT58ipsBXVBpWyJnvUbVWoEh6jrrx BAe2dU4A4O0i/mxXdBhKw37ZP+cD4akGsJXClIUrLbTVa5as9Q0ZDhqMlX3U2i9rLZXO Onui1IHJ4ja/5+i57yWZjvDxseBVVKRn7H58ODdiAvJSt6irt6hMoFrUYm4H2DDnSDxU nMfg== X-Gm-Message-State: AOJu0YwpYnPcyAQwQBNenbVeALSQjlutbCLoV98wAA+/PaD8TkoU/z1p j1T7AehQ7oiNKSzHUWkBfPFdqJ16XWqixRDLluIOqMZLZJl7Pdb1GTJNaU9Yo1c= X-Google-Smtp-Source: AGHT+IHD9cl3GrQHrZn7xNAQK3tsXaN04X4wSHPljJCjEbWvzFormiwvfDWUhUBkNllzcCE8nQDpOg== X-Received: by 2002:a05:6512:2395:b0:535:6925:7a82 with SMTP id 2adb3069b0e04-536587f845amr14728847e87.41.1725977255283; Tue, 10 Sep 2024 07:07:35 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Zhao Liu , Marcel Apfelbaum , Beraldo Leal , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Alexandre Iooss , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Pierrick Bouvier , Yanan Wang , Peter Maydell , Mahmoud Mandour , Thomas Huth , qemu-arm@nongnu.org, devel@lists.libvirt.org, Jiaxun Yang , Paolo Bonzini , Richard Henderson , Wainer dos Santos Moschetta Subject: [PATCH 02/26] tests/docker: update debian i686 and mipsel images to bookworm Date: Tue, 10 Sep 2024 15:07:09 +0100 Message-Id: <20240910140733.4007719-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240910140733.4007719-1-alex.bennee@linaro.org> References: <20240910140733.4007719-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::136; envelope-from=alex.bennee@linaro.org; helo=mail-lf1-x136.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1725977438095116600 Whatever issues there were which stopped these being updates when the rest were have now been resolved. However mips64el continues to be broken so don't update it here. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Pierrick Bouvier --- tests/docker/dockerfiles/debian-i686-cross.docker | 10 ++++------ tests/docker/dockerfiles/debian-mipsel-cross.docker | 10 ++++------ tests/lcitool/refresh | 4 ++-- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/tests/docker/dockerfiles/debian-i686-cross.docker b/tests/dock= er/dockerfiles/debian-i686-cross.docker index 3fe8ee623d..2328ee1732 100644 --- a/tests/docker/dockerfiles/debian-i686-cross.docker +++ b/tests/docker/dockerfiles/debian-i686-cross.docker @@ -1,10 +1,10 @@ # THIS FILE WAS AUTO-GENERATED # -# $ lcitool dockerfile --layers all --cross-arch i686 debian-11 qemu +# $ lcitool dockerfile --layers all --cross-arch i686 debian-12 qemu # # https://gitlab.com/libvirt/libvirt-ci =20 -FROM docker.io/library/debian:11-slim +FROM docker.io/library/debian:12-slim =20 RUN export DEBIAN_FRONTEND=3Dnoninteractive && \ apt-get update && \ @@ -48,16 +48,15 @@ RUN export DEBIAN_FRONTEND=3Dnoninteractive && \ python3-opencv \ python3-pillow \ python3-pip \ - python3-setuptools \ python3-sphinx \ python3-sphinx-rtd-theme \ python3-venv \ - python3-wheel \ python3-yaml \ rpm2cpio \ sed \ socat \ sparse \ + swtpm \ tar \ tesseract-ocr \ tesseract-ocr-eng \ @@ -69,8 +68,6 @@ RUN export DEBIAN_FRONTEND=3Dnoninteractive && \ dpkg-reconfigure locales && \ rm -f /usr/lib*/python3*/EXTERNALLY-MANAGED =20 -RUN /usr/bin/pip3 install tomli - ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers" ENV LANG "en_US.UTF-8" ENV MAKE "/usr/bin/make" @@ -145,6 +142,7 @@ RUN export DEBIAN_FRONTEND=3Dnoninteractive && \ libvdeplug-dev:i386 \ libvirglrenderer-dev:i386 \ libvte-2.91-dev:i386 \ + libxdp-dev:i386 \ libzstd-dev:i386 \ nettle-dev:i386 \ systemtap-sdt-dev:i386 \ diff --git a/tests/docker/dockerfiles/debian-mipsel-cross.docker b/tests/do= cker/dockerfiles/debian-mipsel-cross.docker index 0d559ae4ba..4ac314e22e 100644 --- a/tests/docker/dockerfiles/debian-mipsel-cross.docker +++ b/tests/docker/dockerfiles/debian-mipsel-cross.docker @@ -1,10 +1,10 @@ # THIS FILE WAS AUTO-GENERATED # -# $ lcitool dockerfile --layers all --cross-arch mipsel debian-11 qemu +# $ lcitool dockerfile --layers all --cross-arch mipsel debian-12 qemu # # https://gitlab.com/libvirt/libvirt-ci =20 -FROM docker.io/library/debian:11-slim +FROM docker.io/library/debian:12-slim =20 RUN export DEBIAN_FRONTEND=3Dnoninteractive && \ apt-get update && \ @@ -48,16 +48,15 @@ RUN export DEBIAN_FRONTEND=3Dnoninteractive && \ python3-opencv \ python3-pillow \ python3-pip \ - python3-setuptools \ python3-sphinx \ python3-sphinx-rtd-theme \ python3-venv \ - python3-wheel \ python3-yaml \ rpm2cpio \ sed \ socat \ sparse \ + swtpm \ tar \ tesseract-ocr \ tesseract-ocr-eng \ @@ -69,8 +68,6 @@ RUN export DEBIAN_FRONTEND=3Dnoninteractive && \ dpkg-reconfigure locales && \ rm -f /usr/lib*/python3*/EXTERNALLY-MANAGED =20 -RUN /usr/bin/pip3 install tomli - ENV CCACHE_WRAPPERSDIR "/usr/libexec/ccache-wrappers" ENV LANG "en_US.UTF-8" ENV MAKE "/usr/bin/make" @@ -143,6 +140,7 @@ RUN export DEBIAN_FRONTEND=3Dnoninteractive && \ libvdeplug-dev:mipsel \ libvirglrenderer-dev:mipsel \ libvte-2.91-dev:mipsel \ + libxdp-dev:mipsel \ libzstd-dev:mipsel \ nettle-dev:mipsel \ systemtap-sdt-dev:mipsel \ diff --git a/tests/lcitool/refresh b/tests/lcitool/refresh index 199d5fad87..c60490a7fa 100755 --- a/tests/lcitool/refresh +++ b/tests/lcitool/refresh @@ -159,7 +159,7 @@ try: trailer=3Dcross_build("arm-linux-gnueabihf-", "arm-softmmu,arm-linux-user")) =20 - generate_dockerfile("debian-i686-cross", "debian-11", + generate_dockerfile("debian-i686-cross", "debian-12", cross=3D"i686", trailer=3Dcross_build("i686-linux-gnu-", "x86_64-softmmu," @@ -171,7 +171,7 @@ try: trailer=3Dcross_build("mips64el-linux-gnuabi64-", "mips64el-softmmu,mips64el-lin= ux-user")) =20 - generate_dockerfile("debian-mipsel-cross", "debian-11", + generate_dockerfile("debian-mipsel-cross", "debian-12", cross=3D"mipsel", trailer=3Dcross_build("mipsel-linux-gnu-", "mipsel-softmmu,mipsel-linux-u= ser")) --=20 2.39.2 From nobody Sun Nov 24 05:59:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1725977395020464.03729190359695; Tue, 10 Sep 2024 07:09:55 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 071DF1953; Tue, 10 Sep 2024 10:09:54 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 108801712; Tue, 10 Sep 2024 10:07:49 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 9A202166C; Tue, 10 Sep 2024 10:07:39 -0400 (EDT) Received: from mail-ed1-f51.google.com (mail-ed1-f51.google.com [209.85.208.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 040F11678 for ; Tue, 10 Sep 2024 10:07:38 -0400 (EDT) Received: by mail-ed1-f51.google.com with SMTP id 4fb4d7f45d1cf-5c3d209db94so6117469a12.3 for ; Tue, 10 Sep 2024 07:07:37 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c3ebd41bb2sm4296386a12.14.2024.09.10.07.07.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 07:07:34 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id E9E8F5F86D; Tue, 10 Sep 2024 15:07:33 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725977257; x=1726582057; darn=lists.libvirt.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CQdWQJOdy0yNPGoyktr5h9MWk5hDnvlzDOKzVVqQGjs=; b=gYGKxpmXWcdFvPL2JzmXkT9ZXE/T3x3FaaRtX699Q/er0KyRfaLu145J6LW0mtpOmm ilmjiv7uxjQSbWLsS3eaXDTsGx2IIZs1j8J5XWEeAdS9Djd8mbqeITUtuQyLpXYrcGVf NLDxmX2jACQZljJOr/TUB81IlQy9Zy99LTqrQpmAaSJJQRUiHCshmnppM+FhZQnA6+QV ZTHu8zNClBkzj0UjkLucOKrz4BKPu7vCLpkVyOK8VucWtTRgJeuQARFwKDKfUWZfcOPv vkkqs7HwzUU8J4HLk42tpSU1WApaRNDNtK3OVrfnqAAidmE5zoPbERZUZAGcJZke+zGO 6r+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725977257; x=1726582057; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CQdWQJOdy0yNPGoyktr5h9MWk5hDnvlzDOKzVVqQGjs=; b=qn4e59Z/lUfXmo/tvWk/9hOeam18X7DPu4JVhrltYyYSryFhpCGUZq25e8XmeEuwUs QeDN9bAnTz0Ij+xacHwuwIuaXaBY40E7jOcpgJUA/ttmKwfmttLRQnEEYTfcYWQZJx16 UpAav9ql9lUyfxKqwPcpR4AyJ2hGRXGXMvQi8HXh1zVMcgGu+3pKJ4kCtuZoe0+YXhX8 HQzIZvdACXRpHaehohmHgd5WljgYAYYlwUv72cQ+Rle2NsV1HhMEGZ7pJbnAD0Y5vm89 dxsKW3Edv8PBGrp0LBfxVhHuxl4j8aYRe0XP7H71YWTrhYE5ljqzD8FnyV06a+08O+hj QQsA== X-Forwarded-Encrypted: i=1; AJvYcCVWBf/LSxi50zgSGmgMeM0Xhr5QQ/SChxhZleEsGOzOAJdOItWiNP9ZnAo+xzTZyx8H7W/anQ==@lists.libvirt.org X-Gm-Message-State: AOJu0Yyspy4aYoe5XrGr2TkPt8uOcPCCzBK3sojqV1Q05HqtwBMd5bzQ fA6Qe88f2KOB/dblVdA2PApgKwDnmHc95r2I7a6DzWkOaJgZ9v0ryBDnkTefl64= X-Google-Smtp-Source: AGHT+IE2U0uHU06/Vp8X2hd+avzIe7NO4Zox0gqTRxzpZB6uesrM+rBCmQyq9iS6tiXXMU7g4SBUOw== X-Received: by 2002:a05:6402:1d4d:b0:5c4:95d:da34 with SMTP id 4fb4d7f45d1cf-5c4095ddb7cmr1039308a12.26.1725977256520; Tue, 10 Sep 2024 07:07:36 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH 03/26] docs/devel: fix duplicate line Date: Tue, 10 Sep 2024 15:07:10 +0100 Message-Id: <20240910140733.4007719-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240910140733.4007719-1-alex.bennee@linaro.org> References: <20240910140733.4007719-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: YWEYDUTWJODNVLL43OYT3WA6VM3DS4VH X-Message-ID-Hash: YWEYDUTWJODNVLL43OYT3WA6VM3DS4VH X-MailFrom: alex.bennee@linaro.org X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0 CC: Eduardo Habkost , Zhao Liu , Marcel Apfelbaum , Beraldo Leal , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Alexandre Iooss , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Pierrick Bouvier , Yanan Wang , Peter Maydell , Mahmoud Mandour , Thomas Huth , qemu-arm@nongnu.org, devel@lists.libvirt.org, Jiaxun Yang , Paolo Bonzini , Richard Henderson , Wainer dos Santos Moschetta X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1725977396877116600 Content-Type: text/plain; charset="utf-8" I guess the same change came in via two patch series. Remove the repetition. Fixes: 2a851fca9f (docs/devel: remind developers to run CI container pipeli= ne when updating images) Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Pierrick Bouvier --- docs/devel/testing/main.rst | 6 ------ 1 file changed, 6 deletions(-) diff --git a/docs/devel/testing/main.rst b/docs/devel/testing/main.rst index e9921a4b10..09725e8ea9 100644 --- a/docs/devel/testing/main.rst +++ b/docs/devel/testing/main.rst @@ -500,12 +500,6 @@ first to contribute the mapping to the ``libvirt-ci`` = project: `CI `__ documentation page on how to trigger gitlab CI pipelines on your change. =20 - * Please also trigger gitlab container generation pipelines on your change - for as many OS distros as practical to make sure that there are no - obvious breakages when adding the new pre-requisite. Please see - `CI `__ documentation - page on how to trigger gitlab CI pipelines on your change. - For enterprise distros that default to old, end-of-life versions of the Python runtime, QEMU uses a separate set of mappings that work with more recent versions. These can be found in ``tests/lcitool/mappings.yml``. --=20 2.39.2 From nobody Sun Nov 24 05:59:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 172597733272344.125762440304925; Tue, 10 Sep 2024 07:08:52 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 9E21119B3; Tue, 10 Sep 2024 10:08:51 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 795051859; Tue, 10 Sep 2024 10:07:44 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 17192166C; Tue, 10 Sep 2024 10:07:39 -0400 (EDT) Received: from mail-ej1-f45.google.com (mail-ej1-f45.google.com [209.85.218.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id C1B71163B for ; Tue, 10 Sep 2024 10:07:37 -0400 (EDT) Received: by mail-ej1-f45.google.com with SMTP id a640c23a62f3a-a8d100e9ce0so531529266b.2 for ; Tue, 10 Sep 2024 07:07:37 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25d64880sm480900266b.219.2024.09.10.07.07.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 07:07:34 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 0BCDA5F9CC; Tue, 10 Sep 2024 15:07:34 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725977256; x=1726582056; darn=lists.libvirt.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=aapQk1vd/skAQcOUzQTtovi1QafMjbKZgpmgK7D3jz4=; b=ypcNQfmdculcikKSvwi1HoJkH5I3JSnqkvRWZEYCks9pr9IVQymJqa6ib9CqyiHiIP EqzpQW96bFSJO+S1B9/sjhi/nZmMUgTUCESk4BdgaqHsGcTnxAYVj5iN4NioNDcuKCdJ 30cztBUWVbjTeKhvKkHEUUkXrVwRkxoFWYbpPBKK/KBwKCakJYRJ8+alC3tQt+GDImJ+ UpDGxC0yCasf/qSA60hzjEU9OhbKiPct4HoCcOFBE1zlPYC/AOoLVskEJZuUddEGRNZF p2wiy4/hE2vJ7KqQ8UlkuUae2zLeUqBuYlreVM06miVnadRKFkHXNwNMGg0YkoukCnlo JFLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725977256; x=1726582056; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aapQk1vd/skAQcOUzQTtovi1QafMjbKZgpmgK7D3jz4=; b=SgLr4aS1fij0cZufwtFBz0VTcJOGdhlUI6JiXYG0By9bk9KTqhla1wQLabKCKxpFOp uXooTOo3MknHcTW6qsEQMjMzZnZZK+hnFL3I0WNzWo6X5dRFH3HbUUoTH1XHsEteuzFJ vCwZbB5KbPuSfq2YDlH0bqD9/nSQJUEsEeN5ikvtLHmUChoASMZfpuzTrlE36EyTqAVM mNJbEOfK2DfzqxEC5SEzLzdmJ4Q+kF/E6bUbaCFx+c6uEjcrTLfLXu98cRZpz6hKtQoO 5JRGr+OOQ+ift2N8iGn7Yv4mhKz2ykal1XKQa1FL6acYFe1iGJBApHRNlfONn+pHuEAG eOIQ== X-Forwarded-Encrypted: i=1; AJvYcCVDXwoXpV//B9y4m8rWnEuIoJQqWcUstKVsVB/qS3bLcV6/RKFR4ZpT/RloDxpwCxMQrwj7Kw==@lists.libvirt.org X-Gm-Message-State: AOJu0YyBV0gbPp3B/45xAWbv5ml42QC1KU6jL0h+56WUv3q2T7nMeaPL 4GyIKjWAHoJkZLfGT4VLXrARf+1jI1AHClqzIGD1LmM8I/MlEqriBcCzJElS6IQ= X-Google-Smtp-Source: AGHT+IEVAIEEqGMWQsXh9dt5MPuBFRt53jahMB917OVma3lzDJh9VVW7y8UMT1SN4mnhFtYUk1VutQ== X-Received: by 2002:a17:907:7ea3:b0:a86:9f56:21e6 with SMTP id a640c23a62f3a-a8ffab832ebmr81996566b.33.1725977256225; Tue, 10 Sep 2024 07:07:36 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH 04/26] scripts/ci: update the gitlab-runner playbook Date: Tue, 10 Sep 2024 15:07:11 +0100 Message-Id: <20240910140733.4007719-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240910140733.4007719-1-alex.bennee@linaro.org> References: <20240910140733.4007719-1-alex.bennee@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: YEASM2IM6GKC3RAG2EPE4ORROSOQTWB2 X-Message-ID-Hash: YEASM2IM6GKC3RAG2EPE4ORROSOQTWB2 X-MailFrom: alex.bennee@linaro.org X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0 CC: Eduardo Habkost , Zhao Liu , Marcel Apfelbaum , Beraldo Leal , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Alexandre Iooss , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Pierrick Bouvier , Yanan Wang , Peter Maydell , Mahmoud Mandour , Thomas Huth , qemu-arm@nongnu.org, devel@lists.libvirt.org, Jiaxun Yang , Paolo Bonzini , Richard Henderson , Wainer dos Santos Moschetta X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1725977334877116600 Content-Type: text/plain; charset="utf-8" The upstream install instructions: https://docs.gitlab.com/runner/install/linux-repository.html Now refer to repositories and a setup script. Modernise the playbook to use the preferred delivery method. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Pierrick Bouvier --- scripts/ci/setup/gitlab-runner.yml | 39 +++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/scripts/ci/setup/gitlab-runner.yml b/scripts/ci/setup/gitlab-r= unner.yml index 7bdafab511..57e7faebf1 100644 --- a/scripts/ci/setup/gitlab-runner.yml +++ b/scripts/ci/setup/gitlab-runner.yml @@ -49,30 +49,51 @@ - debug: msg: gitlab-runner arch is {{ gitlab_runner_arch }} =20 - - name: Download the matching gitlab-runner (DEB) + # Debian/Ubuntu setup + - name: Get gitlab-runner repo setup script (DEB) get_url: dest: "/root/" - url: "https://gitlab-runner-downloads.s3.amazonaws.com/latest/deb/= gitlab-runner_{{ gitlab_runner_arch }}.deb" + url: "https://packages.gitlab.com/install/repositories/runner/gitl= ab-runner/script.deb.sh" + mode: 0755 when: - ansible_facts['distribution'] =3D=3D 'Ubuntu' =20 - - name: Download the matching gitlab-runner (RPM) + - name: Run gitlab-runner repo setup script (DEB) + shell: "/root/script.deb.sh" + when: + - ansible_facts['distribution'] =3D=3D 'Ubuntu' + + - name: Install gitlab-runner (DEB) + ansible.builtin.apt: + name: gitlab-runner + update_cache: yes + state: present + when: + - ansible_facts['distribution'] =3D=3D 'Ubuntu' + + # RPM setup + - name: Get gitlab-runner repo setup script (RPM) get_url: dest: "/root/" - url: "https://gitlab-runner-downloads.s3.amazonaws.com/latest/rpm/= gitlab-runner_{{ gitlab_runner_arch }}.rpm" + url: "https://packages.gitlab.com/install/repositories/runner/gitl= ab-runner/script.rpm.sh" + mode: 0755 when: - ansible_facts['distribution'] =3D=3D 'CentOS' =20 - - name: Install gitlab-runner via package manager (DEB) - apt: deb=3D"/root/gitlab-runner_{{ gitlab_runner_arch }}.deb" + - name: Run gitlab-runner repo setup script (RPM) + shell: "/root/script.rpm.sh" when: - - ansible_facts['distribution'] =3D=3D 'Ubuntu' + - ansible_facts['distribution'] =3D=3D 'CentOS' =20 - - name: Install gitlab-runner via package manager (RPM) - yum: name=3D"/root/gitlab-runner_{{ gitlab_runner_arch }}.rpm" + - name: Install gitlab-runner (RPM) + yum: + name: gitlab-runner + update_cache: yes + state: present when: - ansible_facts['distribution'] =3D=3D 'CentOS' =20 + # Register Runners - name: Register the gitlab-runner command: "/usr/bin/gitlab-runner register --non-interactive --url {{= gitlab_runner_server_url }} --registration-token {{ gitlab_runner_registra= tion_token }} --executor shell --tag-list {{ ansible_facts[\"architecture\"= ] }},{{ ansible_facts[\"distribution\"]|lower }}_{{ ansible_facts[\"distrib= ution_version\"] }} --description '{{ ansible_facts[\"distribution\"] }} {{= ansible_facts[\"distribution_version\"] }} {{ ansible_facts[\"architecture= \"] }} ({{ ansible_facts[\"os_family\"] }})'" =20 --=20 2.39.2 From nobody Sun Nov 24 05:59:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1725977481; cv=none; d=zohomail.com; s=zohoarc; b=jPYWGLRsyt2yC6gTSTaxlhtUihxuQ5L7xAELBdUJdfgEHkidGAlrwsje/ysq0Ux3sbvN4KG0IxTD2hNoYF8asWibOJ11FIiKn4L2PiJKOPAwDbWRvatmoEzL9Ys3bYehVODZh2YjTMAuhgD5BV4TvTWfAF11OAB5FCfH6FJiIjY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725977481; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=4x/2lUUGLpLRO+8rqUP/+rQmXa+2LMUSZP6UGcSNzgE=; b=SDOm7sh3eV9RY7immQOPCEoPGlUgOPJ4ZFLwiNUv4bKxHhpkTR8QqUcz1xiVK/6nxxvhIcniw3TDCpqjJYL3RUWUUoV6VvsHgwZRZf08q+P2yhyXgggkaQkaHDttomhpTgDum3dXAFwkKQzJzF/nYHgVublRDdAjbqOJs1UR4fM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1725977480938791.1845955906078; Tue, 10 Sep 2024 07:11:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1so1X2-0007qV-Ba; Tue, 10 Sep 2024 10:07:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1so1X0-0007hO-7T for qemu-devel@nongnu.org; Tue, 10 Sep 2024 10:07:46 -0400 Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1so1Wv-0006VG-Ve for qemu-devel@nongnu.org; Tue, 10 Sep 2024 10:07:45 -0400 Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-a8d4093722bso449358366b.0 for ; Tue, 10 Sep 2024 07:07:41 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25c7286esm481008866b.138.2024.09.10.07.07.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 07:07:36 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 22ADC5F9CE; Tue, 10 Sep 2024 15:07:34 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725977260; x=1726582060; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4x/2lUUGLpLRO+8rqUP/+rQmXa+2LMUSZP6UGcSNzgE=; b=O7E6uwHSbHOuWwdIOCEcsg4vaGkmKongHQIe22PkTFdYOShs/iAWUf3JRvA9Yplfkv 2/+O9Q5OnuEQaO234QyRvxBkpU6pjYBrySXxduQ+X9PIigOXhxACQXvlyBr7TAHJdmEL gieD45sL3mPkLojRY9WQpaP88W74arVX7xg+LsciyzYylTLeV8AfatMWzOKhT/WgT+3E 5bXNhyuom5EIBrs+lWdl354f5SmMukps5MwWKv+JDRQqc/uJLWPaewXEEr4SnNaZ4D6S XnXVx8NWdKdEIsedP4FJQClWds70M4LzL/TRAghq8quUp1yIAMxHXd0eQBnRcQNkICzI W8VA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725977260; x=1726582060; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4x/2lUUGLpLRO+8rqUP/+rQmXa+2LMUSZP6UGcSNzgE=; b=G7OZ0wIfJUKrkbYx9UbVKiPFkCfAzAjntv7i0ape2uwNaOKXnUVTvZlme9sI98FRMn lyU4LGbOhIKoeZ2+9Inrh4m6nuqZ+sBYsAQ7yIZ/lewLWnPg5Du0AMEEQzVcApJ648pN VeDRkq6lTvOEyx1rSQOb65L/N+lv0JgPy0Lr4NLx2oFrMmFexYHtkpa767Rt4Nq1Cz+t 4j4Y9ZFYJew4aekeH+XPb6rLEbCU6cDAST/7hkolbX1++Siav5kc5zncwzOJ8e3bi2bz w+AAgOO2ypnNxzgKEvGTj2aaTUPoySRD/H0LjJP1Hu0VRpXuiLl5TWdsAbv82nxYcbaA i2oQ== X-Gm-Message-State: AOJu0Yw6HCRi/lcfCtIWKtzcWiFFmzkQEK22Dh7JZHYYicjAZKAQ8TXC U/tfeLZDJi6VJMDJYglOBCkiThsRSqZBryORJwDkILdX1e9HUG3yG7BQmXf7OA4= X-Google-Smtp-Source: AGHT+IEvuWIAiAG/1WQfC8cKFBctoP0A4dYQjLeoHf7iKJZzLcR5lBFadtqLJorqSvb5dGkIUb/WEg== X-Received: by 2002:a17:906:dc92:b0:a7a:3928:3529 with SMTP id a640c23a62f3a-a8ffaaa54d0mr74864366b.13.1725977260214; Tue, 10 Sep 2024 07:07:40 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Zhao Liu , Marcel Apfelbaum , Beraldo Leal , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Alexandre Iooss , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Pierrick Bouvier , Yanan Wang , Peter Maydell , Mahmoud Mandour , Thomas Huth , qemu-arm@nongnu.org, devel@lists.libvirt.org, Jiaxun Yang , Paolo Bonzini , Richard Henderson , Wainer dos Santos Moschetta , Gustavo Romero Subject: [PATCH 05/26] gdbstub: Use specific MMU index when probing MTE addresses Date: Tue, 10 Sep 2024 15:07:12 +0100 Message-Id: <20240910140733.4007719-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240910140733.4007719-1-alex.bennee@linaro.org> References: <20240910140733.4007719-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::630; envelope-from=alex.bennee@linaro.org; helo=mail-ej1-x630.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1725977481366116600 From: Gustavo Romero Use cpu_mmu_index() to determine the specific translation regime (MMU index) before probing addresses using allocation_tag_mem_probe(). Currently, the MMU index is hardcoded to 0 and only works for user mode. By obtaining the specific MMU index according to the translation regime, future use of the stubs relying on allocation_tag_mem_probe in other regimes will be possible, like in EL1. This commit also changes the ptr_size value passed to allocation_tag_mem_probe() from 8 to 1. The ptr_size parameter actually represents the number of bytes in the memory access (which can be as small as 1 byte), rather than the number of bits used in the address space pointed to by ptr. Signed-off-by: Gustavo Romero Reviewed-by: Richard Henderson Message-Id: <20240906143316.657436-2-gustavo.romero@linaro.org> Signed-off-by: Alex Benn=C3=A9e --- target/arm/gdbstub64.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/target/arm/gdbstub64.c b/target/arm/gdbstub64.c index 5221381cc8..85a19c14c7 100644 --- a/target/arm/gdbstub64.c +++ b/target/arm/gdbstub64.c @@ -435,6 +435,7 @@ static void handle_q_memtag(GArray *params, void *user_= ctx) { ARMCPU *cpu =3D ARM_CPU(user_ctx); CPUARMState *env =3D &cpu->env; + uint32_t mmu_index; =20 uint64_t addr =3D gdb_get_cmd_param(params, 0)->val_ull; uint64_t len =3D gdb_get_cmd_param(params, 1)->val_ul; @@ -458,8 +459,10 @@ static void handle_q_memtag(GArray *params, void *user= _ctx) gdb_put_packet("E03"); } =20 + /* Find out the current translation regime for probe. */ + mmu_index =3D cpu_mmu_index(env_cpu(env), false); /* Note that tags are packed here (2 tags packed in one byte). */ - tags =3D allocation_tag_mem_probe(env, 0, addr, MMU_DATA_LOAD, 8 /* 64= -bit */, + tags =3D allocation_tag_mem_probe(env, mmu_index, addr, MMU_DATA_LOAD,= 1, MMU_DATA_LOAD, true, 0); if (!tags) { /* Address is not in a tagged region. */ @@ -478,13 +481,16 @@ static void handle_q_isaddresstagged(GArray *params, = void *user_ctx) { ARMCPU *cpu =3D ARM_CPU(user_ctx); CPUARMState *env =3D &cpu->env; + uint32_t mmu_index; =20 uint64_t addr =3D gdb_get_cmd_param(params, 0)->val_ull; =20 uint8_t *tags; const char *reply; =20 - tags =3D allocation_tag_mem_probe(env, 0, addr, MMU_DATA_LOAD, 8 /* 64= -bit */, + /* Find out the current translation regime for probe. */ + mmu_index =3D cpu_mmu_index(env_cpu(env), false); + tags =3D allocation_tag_mem_probe(env, mmu_index, addr, MMU_DATA_LOAD,= 1, MMU_DATA_LOAD, true, 0); reply =3D tags ? "01" : "00"; =20 @@ -495,6 +501,7 @@ static void handle_Q_memtag(GArray *params, void *user_= ctx) { ARMCPU *cpu =3D ARM_CPU(user_ctx); CPUARMState *env =3D &cpu->env; + uint32_t mmu_index; =20 uint64_t start_addr =3D gdb_get_cmd_param(params, 0)->val_ull; uint64_t len =3D gdb_get_cmd_param(params, 1)->val_ul; @@ -527,8 +534,10 @@ static void handle_Q_memtag(GArray *params, void *user= _ctx) * Get all tags in the page starting from the tag of the start address. * Note that there are two tags packed into a single byte here. */ - tags =3D allocation_tag_mem_probe(env, 0, start_addr, MMU_DATA_STORE, - 8 /* 64-bit */, MMU_DATA_STORE, true, = 0); + /* Find out the current translation regime for probe. */ + mmu_index =3D cpu_mmu_index(env_cpu(env), false); + tags =3D allocation_tag_mem_probe(env, mmu_index, start_addr, MMU_DATA= _STORE, + 1, MMU_DATA_STORE, true, 0); if (!tags) { /* Address is not in a tagged region. */ gdb_put_packet("E04"); --=20 2.39.2 From nobody Sun Nov 24 05:59:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1725977294; cv=none; d=zohomail.com; s=zohoarc; b=SYroi36g2NjWkQH+4hmJVOHXFEqyHEMx0GunQnnrxk/UKmrUu+qHeMDMnfEhWnpX3NkEP+nIwoiZFy7N6feBxmybiNk0JdyfIYMLofI9bFPCQ1SM0oauRrRoRD63FOedWHSuFAjNsnEJzz/fljJBPomTlqKMEc5Pdh183wH0taU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725977294; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=fSOOKTU4/ntvh1NQhQ1KOTaJwtvBojTKzDVk3v/UKCo=; b=IYT2vLfbLUjKdTFVkCaeaEVRj4u9lP6ISW4Mk3VMC0g6kEydmsJEhCmTbF7wixnklnIxzM2wDasMkAFa2UUIyNsqsrxT/LJYMBJsaNAHVoGKS4/RS1vhIL82o2NhfFPUn0pqNNYqBM12prsy74Ucg18GqWUfCoOa6mDOhog7BR8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1725977294816462.68054941533774; Tue, 10 Sep 2024 07:08:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1so1X0-0007jX-Pg; Tue, 10 Sep 2024 10:07:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1so1Wx-0007UH-A8 for qemu-devel@nongnu.org; Tue, 10 Sep 2024 10:07:43 -0400 Received: from mail-ej1-x62b.google.com ([2a00:1450:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1so1Ws-0006UB-OO for qemu-devel@nongnu.org; Tue, 10 Sep 2024 10:07:43 -0400 Received: by mail-ej1-x62b.google.com with SMTP id a640c23a62f3a-a80eab3945eso535983166b.1 for ; Tue, 10 Sep 2024 07:07:38 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25d547e5sm487267866b.201.2024.09.10.07.07.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 07:07:36 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 38F8B5FA08; Tue, 10 Sep 2024 15:07:34 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725977257; x=1726582057; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=fSOOKTU4/ntvh1NQhQ1KOTaJwtvBojTKzDVk3v/UKCo=; b=RoGl4P+dlREizikCWeXw5BgoFVw3qhiumZ+le+OHwkUS0J7XDufSPnLsiab8zriiCf f7+USNYn+4YQlCfq5LmHWOZGdj1fua60GpQqoOkEN8ysoORHd9MW+9IRj7bERoCLAn5W 7sJSBBCcrsO27O4+qalN2VxAdXNYDJOLbqT+ul38h/ZgM2PMcfO8ub+qaPwf1YNu9po0 j+ccBByHA3zL/OQi9eRoZbgEB/kaQaauE8LDsu9rCMAbobZEfBYrxHnoCuGG0sjVeeaC f0B3hOSAVVKahG7EMg53672A3xpeQwsG9RQCMHU4jbRCbN9WLwSWVJRdndXbiq6ufDdO lTJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725977257; x=1726582057; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fSOOKTU4/ntvh1NQhQ1KOTaJwtvBojTKzDVk3v/UKCo=; b=iuRSHlYgi8TkpUhereM4lS7zjlaL6PQQZ8dO7RCW4u080G60L9cioBq9o9NPRkX3ZH gULrYJvfnuL8lQ3N7QkQGFVA9kacQpoyOLjZX9YE6J039SVpUH+V88zofae+q7XPzyLt /Dr6LDkTF9Xpv9GRQ6Qzuxn1x3n4vJPVIeZwS/2hwZ/CyEkRmJ8sU2tWnBETHASZ1tkz ddq8Pb3Xr5Uax2sWkaKUEZYAhkxgYWyYC8YqGqhRhKLb4osXSD4lnZ+dkKU8V7ubUhHZ icBjkFBSRmpT/AL4hDsVXvAcp/trN8LeS1w7I+F67YG93ZjVKQod8l48XstEUhc5BOQ7 qfFg== X-Gm-Message-State: AOJu0YxKIl+G1tVibZiYCN+wM/9HlNJqx8CCYvmMJmSbKoHwvsMgHk0N rmMybVinWLUgzDTnJHAJQCLbMBmURMRcfYLfS40V9J7aXwB2mP2L0Tknbn0uaYs= X-Google-Smtp-Source: AGHT+IEUZn53fDk87zWHtEpTttuo9yKxzi0SdkBIBe7jGlHX0fBIZI/tQQcrUCLzy4+5JDJpceSSlg== X-Received: by 2002:a17:907:3da4:b0:a8d:6073:2c13 with SMTP id a640c23a62f3a-a8ffab8f2d5mr80695566b.33.1725977257023; Tue, 10 Sep 2024 07:07:37 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Zhao Liu , Marcel Apfelbaum , Beraldo Leal , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Alexandre Iooss , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Pierrick Bouvier , Yanan Wang , Peter Maydell , Mahmoud Mandour , Thomas Huth , qemu-arm@nongnu.org, devel@lists.libvirt.org, Jiaxun Yang , Paolo Bonzini , Richard Henderson , Wainer dos Santos Moschetta , Gustavo Romero Subject: [PATCH 06/26] gdbstub: Add support for MTE in system mode Date: Tue, 10 Sep 2024 15:07:13 +0100 Message-Id: <20240910140733.4007719-7-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240910140733.4007719-1-alex.bennee@linaro.org> References: <20240910140733.4007719-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 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1725977296803116600 From: Gustavo Romero This commit makes handle_q_memtag, handle_q_isaddresstagged, and handle_Q_memtag stubs build for system mode, allowing all GDB 'memory-tag' subcommands to work with QEMU gdbstub on aarch64 system mode. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/620 Signed-off-by: Gustavo Romero Reviewed-by: Richard Henderson Message-Id: <20240906143316.657436-3-gustavo.romero@linaro.org> Signed-off-by: Alex Benn=C3=A9e --- target/arm/gdbstub64.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/target/arm/gdbstub64.c b/target/arm/gdbstub64.c index 85a19c14c7..9462d3f560 100644 --- a/target/arm/gdbstub64.c +++ b/target/arm/gdbstub64.c @@ -430,6 +430,7 @@ int aarch64_gdb_set_tag_ctl_reg(CPUState *cs, uint8_t *= buf, int reg) return 0; #endif } +#endif /* CONFIG_USER_ONLY */ =20 static void handle_q_memtag(GArray *params, void *user_ctx) { @@ -600,12 +601,10 @@ static const GdbCmdParseEntry cmd_handler_table[NUM_C= MDS] =3D { .need_cpu_context =3D true }, }; -#endif /* CONFIG_USER_ONLY */ =20 void aarch64_cpu_register_gdb_commands(ARMCPU *cpu, GString *qsupported, GPtrArray *qtable, GPtrArray *stabl= e) { -#ifdef CONFIG_USER_ONLY /* MTE */ if (cpu_isar_feature(aa64_mte, cpu)) { g_string_append(qsupported, ";memory-tagging+"); @@ -614,5 +613,4 @@ void aarch64_cpu_register_gdb_commands(ARMCPU *cpu, GSt= ring *qsupported, g_ptr_array_add(qtable, (gpointer) &cmd_handler_table[qIsAddressTa= gged]); g_ptr_array_add(stable, (gpointer) &cmd_handler_table[QMemTags]); } -#endif } --=20 2.39.2 From nobody Sun Nov 24 05:59:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1725977500; cv=none; d=zohomail.com; s=zohoarc; b=CsIclcbmIYTDTDvgQ/qTR5XizTbccCDdZ2qnn7Pg1hSEvjdCn6OYE+JGFe9u/KJxRv29p6jjdW5/koRIusoJO8Zwl5mRq1KZG1dtIaoZpA6HWApwp32UMWpYUNhAweRlj8ERygHHc9PPaGF8GyZV1a4PiGOtYQxeH9lhpp/l5NU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725977500; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=0gsP/ANf70RJH0KlgA0KWCypst2Oh4Yb8PQcZ6VG+qU=; b=E0XhcXyVPNOkxYJidze6M5kJhIcPkZ1/PPeACtIr2GSy8U0NB4qF0EUHPBgKB98bf7Pug4q+4Y/tE1f4rr65kGa3Zs8iQ5cuh8uFgTQnTWu1LNIwJfAw0GWl9PPMzfb0xNp9uTnMRDoljiymVKfjgmJ10zO+qAeCUOAiJYm7wTA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 172597750016259.486549054461534; Tue, 10 Sep 2024 07:11:40 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1so1X2-0007qT-B0; Tue, 10 Sep 2024 10:07:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1so1Wz-0007cv-5u for qemu-devel@nongnu.org; Tue, 10 Sep 2024 10:07:45 -0400 Received: from mail-ed1-x52b.google.com ([2a00:1450:4864:20::52b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1so1Wv-0006VB-J6 for qemu-devel@nongnu.org; Tue, 10 Sep 2024 10:07:44 -0400 Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-5c25554ec1eso7302336a12.1 for ; Tue, 10 Sep 2024 07:07:41 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c3ebd424dasm4338661a12.9.2024.09.10.07.07.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 07:07:36 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 5342A5FA0E; Tue, 10 Sep 2024 15:07:34 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725977260; x=1726582060; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0gsP/ANf70RJH0KlgA0KWCypst2Oh4Yb8PQcZ6VG+qU=; b=vUealY35jhI7MWFnRiYrGw4zqYgA5C5aH33YO/McliGEmZDQDG8nf+4m0apq9oQ/vK y3o5oJTYnCsc1t4cXKjnzBZxtz2hz9Bgs4hIL6I/ERuWLLuejMPzdOK4UUoHlcxxBWJh 0fwpKAp9tziIAtmGnc+JwCvcQ+DOo6VJ4HFjMsP/bZH8B2ITqKZgXy6aNo/92FhspAR6 2M1CMsanQa2zK94SvNoFnnJT7qawFZX1vmTSGsU6tmqtEqEyuyB/r0VNvwn+qPRR7H07 miiN5kNcjV0axG42VfnfzcofjR8EEKkcVTlR4aK4zQbIz/0aUd4akPoqjDB10wpjJBRt qneg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725977260; x=1726582060; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0gsP/ANf70RJH0KlgA0KWCypst2Oh4Yb8PQcZ6VG+qU=; b=nDbonY+lrbFXR87gcfYRe456HYiQbgl3bdxeMbsAPFZwiKDU4QNWxSZNwkgHjOSXd6 vO22ceg5p0LoA1XfGgDmv1wKYXbCvC+gPzIP/FnSKxsbV0D58PNFdicze5hiUqrMFcl7 /KFW4CsJQVkBIEebweIspuB+DFvg8xIlVYN9hVk7XCvRr+CQZ6ZlSM6o2pZlK6rg+ksg DCwLo9B6SFL9Hc0cB9GeO7MeOEILXBRBVMKT+MXmAaovrYJegC4L4ceXa38wwHDtEeNS rEuaLNIWJZCtQNuVmsSAjsk5MUAFBmx5y1nbhLNsaiaYugWHe29EFZF5ZH/AVdA422Ns OXng== X-Gm-Message-State: AOJu0YwhYeMgUMjZv1+Zfcpb4tccGWyOG52WGUEECcIM/8UR5j+xZ/xF hqkumOIjQXQgC29sYVKxVWVwc3j+xgphbd2dMJWTjnc57cB9sLBd1f6HqvbucrY= X-Google-Smtp-Source: AGHT+IFjXyaFYA+dR/GiFQ0leb2lapksUx3adB5TZ9WCr/rcjU4CyFAL3XLlLXQoKDeTSGh4w5Esfg== X-Received: by 2002:a05:6402:40cd:b0:5be:f1a7:c2cd with SMTP id 4fb4d7f45d1cf-5c3e974b43fmr11967582a12.31.1725977259898; Tue, 10 Sep 2024 07:07:39 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Zhao Liu , Marcel Apfelbaum , Beraldo Leal , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Alexandre Iooss , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Pierrick Bouvier , Yanan Wang , Peter Maydell , Mahmoud Mandour , Thomas Huth , qemu-arm@nongnu.org, devel@lists.libvirt.org, Jiaxun Yang , Paolo Bonzini , Richard Henderson , Wainer dos Santos Moschetta , Gustavo Romero Subject: [PATCH 07/26] tests/guest-debug: Support passing arguments to the GDB test script Date: Tue, 10 Sep 2024 15:07:14 +0100 Message-Id: <20240910140733.4007719-8-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240910140733.4007719-1-alex.bennee@linaro.org> References: <20240910140733.4007719-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 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1725977501474116600 From: Gustavo Romero This commit adds support for passing arguments to the GDB test scripts so it's possible to parse the args in an "argparse way" in the test scripts launched by the runner. The arguments should be preceded by -- when passed to the runner. For example, passing "--help" arg to the GDB_TEST_SCRIPT: run-test.py [...] --test -- --help The test script should not use the argparse module directly but import arg_parser from test_gdbstub module. arg_parser then can be used just like the argparse.ArgumentParser class: from test_gdbstub import arg_parser p =3D arg_parser(prog=3D"test-mytest.py", description=3D"My test.") p.add_argument("--vowel", help=3D"Select vowel", required=3DTrue, choices=3D['a','e','i','o','u']) [...] The arg_parser allows a smooth and informative exit if, for instance, the caller of the runner script passes an invalid argument or misses a required argument by the test script. Signed-off-by: Gustavo Romero Reviewed-by: Alex Benn=C3=A9e Message-Id: <20240906143316.657436-4-gustavo.romero@linaro.org> Signed-off-by: Alex Benn=C3=A9e --- tests/guest-debug/run-test.py | 6 ++++++ tests/guest-debug/test_gdbstub.py | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/tests/guest-debug/run-test.py b/tests/guest-debug/run-test.py index 368ff8a890..5a091db8be 100755 --- a/tests/guest-debug/run-test.py +++ b/tests/guest-debug/run-test.py @@ -27,6 +27,10 @@ def get_args(): parser.add_argument("--binary", help=3D"Binary to debug", required=3DTrue) parser.add_argument("--test", help=3D"GDB test script") + parser.add_argument('test_args', nargs=3D'*', + help=3D"Additional args for GDB test script. " + "The args should be preceded by -- to avoid confus= ion " + "with flags for runner script") parser.add_argument("--gdb", help=3D"The gdb binary to use", default=3DNone) parser.add_argument("--gdb-args", help=3D"Additional gdb arguments") @@ -91,6 +95,8 @@ def log(output, msg): gdb_cmd +=3D " -ex 'target remote %s'" % (socket_name) # finally the test script itself if args.test: + if args.test_args: + gdb_cmd +=3D f" -ex \"py sys.argv=3D{args.test_args}\"" gdb_cmd +=3D " -x %s" % (args.test) =20 =20 diff --git a/tests/guest-debug/test_gdbstub.py b/tests/guest-debug/test_gdb= stub.py index 46fbf98f0c..a715c0e3f5 100644 --- a/tests/guest-debug/test_gdbstub.py +++ b/tests/guest-debug/test_gdbstub.py @@ -2,6 +2,7 @@ =20 """ from __future__ import print_function +import argparse import gdb import os import sys @@ -9,6 +10,10 @@ =20 fail_count =3D 0 =20 +class arg_parser(argparse.ArgumentParser): + def exit(self, status=3DNone, message=3D""): + print("Wrong GDB script test argument! " + message) + gdb.execute("exit 1") =20 def report(cond, msg): """Report success/fail of a test""" --=20 2.39.2 From nobody Sun Nov 24 05:59:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1725977293; cv=none; d=zohomail.com; s=zohoarc; b=V1W/HOzr9vKuiAGsKrHJkUlgHSXEamRuQ4+sDSTzHmsj41Z6m/3wuJnerZTGS8N+OT2kVnWxOTRsvu1H8t2BvQCDDHKtJODd83bBlq9BLRSBvpvFiaBhFY7TD2EPE0E2+5VK1BBGrttpshZdOnzJb04xb2QKUFGZDVgLhVCMzeo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725977293; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Y9b0lTkZojj9hYO/C00YAyDV7juvCe44sJPqhBOockE=; b=BnKlO70JymjDVoH59Eqv0AE3gr9MgIRQl/epQzBPpajAYLcWY2VEJsnntrstFvo6F9wIkkT3F/veLqX2yWwp2ydyvgQfVsxs17X5pFYD71+NZIpIfCgUi4Fn9gvcopyr8aDZxmOD7puCHSBnus7kjVyo8Q0IV/49ctbLDHnz7tM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17259772934321010.0813139662386; Tue, 10 Sep 2024 07:08:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1so1X0-0007g4-3J; Tue, 10 Sep 2024 10:07:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1so1Wy-0007Zo-Is for qemu-devel@nongnu.org; Tue, 10 Sep 2024 10:07:44 -0400 Received: from mail-ej1-x631.google.com ([2a00:1450:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1so1Wv-0006Uy-CD for qemu-devel@nongnu.org; Tue, 10 Sep 2024 10:07:44 -0400 Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-a8a7596b7dfso23608466b.0 for ; Tue, 10 Sep 2024 07:07:40 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25835a76sm487586366b.39.2024.09.10.07.07.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 07:07:36 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 69F825FA11; Tue, 10 Sep 2024 15:07:34 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725977260; x=1726582060; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Y9b0lTkZojj9hYO/C00YAyDV7juvCe44sJPqhBOockE=; b=IP0zdsKXM8qmWnxqNvsEX8q72HmDyZ5gd27QDb+PUxbsyf+Bgx2ZTVRAIlEgSq2Bl+ uFmicV5otAjQJYSjw8lBEUIx6DLLJ/OifYMI0p5nmOctXF/liE1tBBgvy4Ege4sAKCi+ TJSnIPROO3elzi8sJxqvsfYWQX1IXNUb0lnIHFPGYIuTiaIqxVMkQOr+AiZIfNeE0yN9 eY3jKEdjvmEbFs66DJ3ygfy6K7Uhb880B6LGE2QScb18xDJ4ggqrRcNCRP4aqXVQMFRg 1S8laBR9vItebm+BiTKlWQER1lY9IgHPXkZ9GumD52Y1ZIgOYNjULo/GWOdKqsN8ACGZ nXxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725977260; x=1726582060; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Y9b0lTkZojj9hYO/C00YAyDV7juvCe44sJPqhBOockE=; b=E44kCbGBEfaudqVKQf4hCWKPMIMHbxSQOUr99kL10wR8uIBLFuSNcKyGfDfBRSlf3e OfGnkld7szuL2fh1M4zsid7qWQKfDJf+0lI76xY23xRL7tnM3RF6HTUS84DRY5iej9pE wowkqSR67ke+HY5ZS40oZMe1QwSCXI9yD2rgH73/eeI6yTfER088+ZI0YQt0tIIRhFab c2A7+U7B7quH4zKyG9U1/XippJ4Z9UYzrmss0xe0YrcfpqMkpfERzyrLGuL8i3ioll4I 1F79oWBgQzDLVx8330yGziPMWqAJLHvG47epG63Dtbc0slA4cUMxZSrD/A1voAO3mc4g TEkw== X-Gm-Message-State: AOJu0Yy9V5AtohGhmORDIl7SOtyvVDvDS/CQ06xvfBeAt2kcSV0auDKr JeuLsyl0+4tNYtkKEwm43/D1aNONwHmfKG5TfiNj35WVOyhorZ8Fp8Gb44jfCgM= X-Google-Smtp-Source: AGHT+IHd5sZIKfhBKo+JcT6B85aMNIPgLtx7UlLuykNO7OjlDo5LymBSdq2/3Yp5pWinJVXY0Rmn+A== X-Received: by 2002:a17:907:25c6:b0:a8a:8dd3:f135 with SMTP id a640c23a62f3a-a8ffab79894mr108768366b.14.1725977259513; Tue, 10 Sep 2024 07:07:39 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Zhao Liu , Marcel Apfelbaum , Beraldo Leal , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Alexandre Iooss , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Pierrick Bouvier , Yanan Wang , Peter Maydell , Mahmoud Mandour , Thomas Huth , qemu-arm@nongnu.org, devel@lists.libvirt.org, Jiaxun Yang , Paolo Bonzini , Richard Henderson , Wainer dos Santos Moschetta , Gustavo Romero Subject: [PATCH 08/26] tests/tcg/aarch64: Improve linker script organization Date: Tue, 10 Sep 2024 15:07:15 +0100 Message-Id: <20240910140733.4007719-9-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240910140733.4007719-1-alex.bennee@linaro.org> References: <20240910140733.4007719-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::631; envelope-from=alex.bennee@linaro.org; helo=mail-ej1-x631.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1725977294728116600 From: Gustavo Romero Improve kernel.ld linker script organization by using MEMORY command. Signed-off-by: Richard Henderson Signed-off-by: Gustavo Romero Message-Id: <20240906143316.657436-5-gustavo.romero@linaro.org> Signed-off-by: Alex Benn=C3=A9e --- tests/tcg/aarch64/system/kernel.ld | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/tcg/aarch64/system/kernel.ld b/tests/tcg/aarch64/system/= kernel.ld index 7b3a76dcbf..5f39258d32 100644 --- a/tests/tcg/aarch64/system/kernel.ld +++ b/tests/tcg/aarch64/system/kernel.ld @@ -1,23 +1,23 @@ ENTRY(__start) =20 -SECTIONS -{ - /* virt machine, RAM starts at 1gb */ - . =3D (1 << 30); +MEMORY { + /* On virt machine RAM starts at 1 GiB. */ + + /* Align text and rodata to the 1st 2 MiB chunk. */ + TXT (rx) : ORIGIN =3D 1 << 30, LENGTH =3D 2M + /* Align r/w data to the 2nd 2 MiB chunk. */ + DAT (rw) : ORIGIN =3D (1 << 30) + 2M, LENGTH =3D 2M +} + +SECTIONS { .text : { *(.text) - } - .rodata : { *(.rodata) - } - /* align r/w section to next 2mb */ - . =3D ALIGN(1 << 21); + } >TXT .data : { *(.data) - } - .bss : { *(.bss) - } + } >DAT /DISCARD/ : { *(.ARM.attributes) } --=20 2.39.2 From nobody Sun Nov 24 05:59:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1725977404; cv=none; d=zohomail.com; s=zohoarc; b=m70LKVK2vg/pJEGSpU8etEjtf0HZCqnOQy6tTJp+HZqlrQwq5fKvNfSjzf7TBTltAoap/ZdOPjxihvysNE8bU6SXQrl7Ft9L5MSFBIzmXoOE+MT3tTiadLJfq/gZXSrgHjhOh1vofcz7FLT7eRKV/L7Fe/QWk+DGT98LWllR+lo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725977404; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=8lUubg39HWYdaIBsvXY2XTeRzXHTolhDbI/MSB6QBok=; b=TTgFH8VrS2iVQCB3f2CSxSoAZofMYgxQ1/rXkR2OglyXkFIy7e7N70xLbSTyw+ROmUsTpIhHa5wgnEZZ10WmUCmvz+nughn0C11c5WfFjb23TCQ2N0JtpwMEmmSTRiO3/+CG20GfczCwr90DZnc4qeA/2pfyEcR593aVwetTxgA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1725977399910973.8561015242357; Tue, 10 Sep 2024 07:09:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1so1X2-0007tO-Vh; Tue, 10 Sep 2024 10:07:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1so1X1-0007mn-ER for qemu-devel@nongnu.org; Tue, 10 Sep 2024 10:07:47 -0400 Received: from mail-ej1-x62e.google.com ([2a00:1450:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1so1Wy-0006W6-0d for qemu-devel@nongnu.org; Tue, 10 Sep 2024 10:07:47 -0400 Received: by mail-ej1-x62e.google.com with SMTP id a640c23a62f3a-a8a7b1c2f2bso133659766b.0 for ; Tue, 10 Sep 2024 07:07:43 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25c62485sm485443566b.104.2024.09.10.07.07.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 07:07:36 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 876F25FA14; Tue, 10 Sep 2024 15:07:34 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725977262; x=1726582062; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8lUubg39HWYdaIBsvXY2XTeRzXHTolhDbI/MSB6QBok=; b=A/UWltSELuA4p82wdpPH1i4OTwbY+3mtI0vKjqge/gI1BlbGq5HV6NtqimZSEZ8jD5 FbbfIQThTBDrpk06gdUI3PW27VEzEYklrjEBTy+wwvFRX2lPaOB2y83bNeimGu8NoKH7 UroymOfh+CGRnAqIqRq9IIdwRGHHtA/ziLypWCfiKFadtRx+bMrWVqs1Nao1c+7Ilctn 0Sbaf6Arm27XPXFslDEH5eTHkrVKuxfpFqjuCmzn8mrLs7oyTseAEVmXHBWtttPFbG6r BVfa8Uf+U7SC8b8GiTOQWUqOPrpZHrhjpxAMmXLw5E/DXZEHCbH+cCR8WUL5r9qMnV9v 0p3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725977262; x=1726582062; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8lUubg39HWYdaIBsvXY2XTeRzXHTolhDbI/MSB6QBok=; b=usEBvmHepIqnDDpQ3PkXRK+MeV1fWsVDi06w1I9O4vds7chCosQDb75LkfAS2NX8iP F9lE5dwqi1339jWV+OdXTOOaAQMr60gTnVud8JoaSnfbrSY6XaFdk82nVvKPhqMlgZXp cL/FlLrOGKgWtmEjngB83X58kUicbCBOtadc+cw5d3QFNCHX76n5IxpuH0lliltD6ylK HNBRylnyqKT6O/z0Z50Lol6gmSYnPg90LH4ePLQykKGjM8wOERJt5b+cfRdb6xMef2D+ mF4WSC6XTZTE93hDOLPhztb6mfBJ0aFL8DV9MdQl+ho3Lqjti8UUoh+WLXO8c0Rs7Tvv /TyQ== X-Gm-Message-State: AOJu0Yzz+hnT/cDN41tCOqbpgsEz3xDG2wjR1I0xmti+8S1aLKNTIL4o SeICiKnAysOmzoH0Xj88meRRkn505z/z6Y0ARZ2IiKTUBUYJyc+4vfEvV80Cfa0= X-Google-Smtp-Source: AGHT+IExEUa6jkqzU0Brw13JAniPu7af1KeniNGhAN9RwmezE4X6NEhT+Lg12c4gYPlHfvjYORFQxg== X-Received: by 2002:a17:907:3d8b:b0:a8a:7501:de39 with SMTP id a640c23a62f3a-a8ffaab0216mr71778666b.9.1725977262218; Tue, 10 Sep 2024 07:07:42 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Zhao Liu , Marcel Apfelbaum , Beraldo Leal , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Alexandre Iooss , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Pierrick Bouvier , Yanan Wang , Peter Maydell , Mahmoud Mandour , Thomas Huth , qemu-arm@nongnu.org, devel@lists.libvirt.org, Jiaxun Yang , Paolo Bonzini , Richard Henderson , Wainer dos Santos Moschetta , Gustavo Romero Subject: [PATCH 09/26] tests/tcg/aarch64: Extend MTE gdbstub tests to system mode Date: Tue, 10 Sep 2024 15:07:16 +0100 Message-Id: <20240910140733.4007719-10-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240910140733.4007719-1-alex.bennee@linaro.org> References: <20240910140733.4007719-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::62e; envelope-from=alex.bennee@linaro.org; helo=mail-ej1-x62e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1725977407143116600 From: Gustavo Romero Extend MTE gdbstub tests to also run in system mode (share tests between user mode and system mode). The tests will only run if a version of GDB that supports MTE on baremetal is available in the test environment and if available compiler supports the 'memtag' flag (-march=3Darmv8.5-a+memtag). For the tests running in system mode, a page that supports MTE ops. is necessary. Therefore, an MTE-enabled page is made available (mapped) in the third 2 MB chunk of the second 1 GB space in the flat mapping set in boot.S. A new binary, mte.S, is also introduced for the tests. It links against boot.S and is executed by QEMU in system mode. Signed-off-by: Gustavo Romero Message-Id: <20240906143316.657436-6-gustavo.romero@linaro.org> Signed-off-by: Alex Benn=C3=A9e --- configure | 5 + tests/tcg/aarch64/Makefile.softmmu-target | 49 +++++++++- tests/tcg/aarch64/Makefile.target | 3 +- tests/tcg/aarch64/gdbstub/test-mte.py | 71 +++++++++----- tests/tcg/aarch64/system/boot.S | 11 +++ tests/tcg/aarch64/system/kernel.ld | 9 ++ tests/tcg/aarch64/system/mte.S | 109 ++++++++++++++++++++++ 7 files changed, 229 insertions(+), 28 deletions(-) create mode 100644 tests/tcg/aarch64/system/mte.S diff --git a/configure b/configure index d08b71f14b..40186d865e 100755 --- a/configure +++ b/configure @@ -1679,6 +1679,11 @@ for target in $target_list; do echo "GDB_HAS_MTE=3Dy" >> $config_target_mak fi =20 + if test "${gdb_arches#*aarch64}" !=3D "$gdb_arches" && version_ge $g= db_version 16.0; then + # GDB has to support MTE in baremetal to allow debugging MTE in = QEMU system mode + echo "GDB_SUPPORTS_MTE_IN_BAREMETAL=3Dy" >> $config_target_mak + fi + echo "run-tcg-tests-$target: $qemu\$(EXESUF)" >> Makefile.prereqs tcg_tests_targets=3D"$tcg_tests_targets $target" fi diff --git a/tests/tcg/aarch64/Makefile.softmmu-target b/tests/tcg/aarch64/= Makefile.softmmu-target index 139e04d15f..59ee662cda 100644 --- a/tests/tcg/aarch64/Makefile.softmmu-target +++ b/tests/tcg/aarch64/Makefile.softmmu-target @@ -2,14 +2,22 @@ # Aarch64 system tests # =20 -AARCH64_SYSTEM_SRC=3D$(SRC_PATH)/tests/tcg/aarch64/system +AARCH64_SRC=3D$(SRC_PATH)/tests/tcg/aarch64 +AARCH64_SYSTEM_SRC=3D$(AARCH64_SRC)/system + VPATH+=3D$(AARCH64_SYSTEM_SRC) =20 # These objects provide the basic boot code and helper functions for all t= ests CRT_OBJS=3Dboot.o =20 -AARCH64_TEST_SRCS=3D$(wildcard $(AARCH64_SYSTEM_SRC)/*.c) -AARCH64_TESTS =3D $(patsubst $(AARCH64_SYSTEM_SRC)/%.c, %, $(AARCH64_TEST_= SRCS)) +AARCH64_TEST_C_SRCS_=3D$(wildcard $(AARCH64_SYSTEM_SRC)/*.c) +AARCH64_TEST_S_SRCS=3D$(AARCH64_SYSTEM_SRC)/mte.S + +AARCH64_C_TESTS =3D $(patsubst $(AARCH64_SYSTEM_SRC)/%.c, %, $(AARCH64_TES= T_C_SRCS)) +AARCH64_S_TESTS =3D $(patsubst $(AARCH64_SYSTEM_SRC)/%.S, %, $(AARCH64_TES= T_S_SRCS)) + +AARCH64_TESTS =3D $(AARCH64_C_TESTS) +AARCH64_TESTS +=3D $(AARCH64_S_TESTS) =20 CRT_PATH=3D$(AARCH64_SYSTEM_SRC) LINK_SCRIPT=3D$(AARCH64_SYSTEM_SRC)/kernel.ld @@ -21,7 +29,8 @@ LDFLAGS+=3D-static -nostdlib $(CRT_OBJS) $(MINILIB_OBJS) = -lgcc =20 config-cc.mak: Makefile $(quiet-@)( \ - $(call cc-option,-march=3Darmv8.3-a, CROSS_CC_HAS_ARMV8_3)) 3> config= -cc.mak + $(call cc-option,-march=3Darmv8.3-a, CROSS_CC_HAS_ARMV8_3); \ + $(call cc-option,-march=3Darmv8.5-a+memtag, CROSS_CC_HAS_ARMV8_MTE)) = 3> config-cc.mak -include config-cc.mak =20 # building head blobs @@ -88,3 +97,35 @@ pauth-3: run-pauth-3: $(call skip-test, "RUN of pauth-3", "not built") endif + +ifneq ($(CROSS_CC_HAS_ARMV8_MTE),) +QEMU_MTE_ENABLED_MACHINE=3D-M virt,mte=3Don -cpu max -display none +QEMU_OPTS_WITH_MTE_ON =3D $(QEMU_MTE_ENABLED_MACHINE) $(QEMU_BASE_ARGS) -k= ernel +mte: CFLAGS+=3D-march=3Darmv8.5-a+memtag +mte: mte.S $(LINK_SCRIPT) $(CRT_OBJS) $(MINILIB_OBJS) + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS) + +run-mte: QEMU_OPTS=3D$(QEMU_OPTS_WITH_MTE_ON) +run-mte: mte + +ifeq ($(GDB_SUPPORTS_MTE_IN_BAREMETAL),y) +run-gdbstub-mte: QEMU_OPTS=3D$(QEMU_OPTS_WITH_MTE_ON) +run-gdbstub-mte: mte + $(call run-test, $@, $(GDB_SCRIPT) \ + --output run-gdbstub-mte.out \ + --gdb $(GDB) \ + --qemu $(QEMU) --qargs "-chardev null$(COMMA)id=3Doutput $(QEMU_OPTS)" \ + --bin $< --test $(AARCH64_SRC)/gdbstub/test-mte.py -- --mode=3Dsystem, \ + gdbstub MTE support) + +EXTRA_RUNS +=3D run-gdbstub-mte +else # !GDB_SUPPORTS_MTE_IN_BAREMETAL +run-gdbstub-mte: + $(call skip-test "RUN of gdbstub-mte", "GDB does not support MTE in barem= etal!") +endif +else # !CROSS_CC_HAS_ARMV8_MTE +mte: + $(call skip-test, "BUILD of $@", "missing compiler support") +run-mte: + $(call skip-test, "RUN of mte", "not build") +endif diff --git a/tests/tcg/aarch64/Makefile.target b/tests/tcg/aarch64/Makefile= .target index 8cc62eb456..9efe2f81ad 100644 --- a/tests/tcg/aarch64/Makefile.target +++ b/tests/tcg/aarch64/Makefile.target @@ -138,7 +138,8 @@ run-gdbstub-mte: mte-8 $(call run-test, $@, $(GDB_SCRIPT) \ --gdb $(GDB) \ --qemu $(QEMU) --qargs "$(QEMU_OPTS)" \ - --bin $< --test $(AARCH64_SRC)/gdbstub/test-mte.py, \ + --bin $< --test $(AARCH64_SRC)/gdbstub/test-mte.py \ + -- --mode=3Duser, \ gdbstub MTE support) =20 EXTRA_RUNS +=3D run-gdbstub-mte diff --git a/tests/tcg/aarch64/gdbstub/test-mte.py b/tests/tcg/aarch64/gdbs= tub/test-mte.py index 66f9c25f8a..a4cae6caa0 100644 --- a/tests/tcg/aarch64/gdbstub/test-mte.py +++ b/tests/tcg/aarch64/gdbstub/test-mte.py @@ -1,21 +1,26 @@ from __future__ import print_function # # Test GDB memory-tag commands that exercise the stubs for the qIsAddressT= agged, -# qMemTag, and QMemTag packets. Logical tag-only commands rely on local -# operations, hence don't exercise any stub. +# qMemTag, and QMemTag packets, which are used for manipulating allocation= tags. +# Logical tags-related commands rely on local operations, hence don't exer= cise +# any stub and so are not used in this test. # -# The test consists in breaking just after a atag() call (which sets the -# allocation tag -- see mte-8.c for details) and setting/getting tags in -# different memory locations and ranges starting at the address of the arr= ay -# 'a'. +# The test consists in breaking just after a tag is set in a specific memo= ry +# chunk, and then using the GDB 'memory-tagging' subcommands to set/get ta= gs in +# different memory locations and ranges in the MTE-enabled memory chunk. # # This is launched via tests/guest-debug/run-test.py # =20 =20 -import gdb +try: + import gdb +except ModuleNotFoundError: + from sys import exit + exit("This script must be launched via tests/guest-debug/run-test.py!") import re -from test_gdbstub import main, report +from sys import argv +from test_gdbstub import arg_parser, main, report =20 =20 PATTERN_0 =3D "Memory tags for address 0x[0-9a-f]+ match \\(0x[0-9a-f]+\\)= ." @@ -23,12 +28,32 @@ =20 =20 def run_test(): - gdb.execute("break 95", False, True) + p =3D arg_parser(prog=3D"test-mte.py", description=3D"TCG MTE tests.") + p.add_argument("--mode", help=3D"Run test for QEMU system or user mode= .", + required=3DTrue, choices=3D['system','user']) + + args =3D p.parse_args(args=3Dargv) + + if args.mode =3D=3D "system": + # Break address: where to break before performing the tests + # See mte.S for details about this label. + ba =3D "main_end" + # Tagged address: the start of the MTE-enabled memory chunk to be = tested + # 'tagged_addr' (x1) is a pointer to the MTE-enabled page. See mte= .S. + ta =3D "$x1" + else: # mode=3D"user" + # Line 95 in mte-8.c + ba =3D "95" + # 'a' array. See mte-8.c + ta =3D "a" + + gdb.execute(f"break {ba}", False, True) gdb.execute("continue", False, True) + try: - # Test if we can check correctly that the allocation tag for - # array 'a' matches the logical tag after atag() is called. - co =3D gdb.execute("memory-tag check a", False, True) + # Test if we can check correctly that the allocation tag for the a= ddress + # in {ta} matches the logical tag in {ta}. + co =3D gdb.execute(f"memory-tag check {ta}", False, True) tags_match =3D re.findall(PATTERN_0, co, re.MULTILINE) if tags_match: report(True, f"{tags_match[0]}") @@ -39,20 +64,20 @@ def run_test(): # tags rely on local operation and so don't exercise any stub. =20 # Set the allocation tag for the first granule (16 bytes) of - # address starting at 'a' address to a known value, i.e. 0x04. - gdb.execute("memory-tag set-allocation-tag a 1 04", False, True) + # address starting at {ta} address to a known value, i.e. 0x04. + gdb.execute(f"memory-tag set-allocation-tag {ta} 1 04", False, Tru= e) =20 # Then set the allocation tag for the second granule to a known # value, i.e. 0x06. This tests that contiguous tag granules are - # set correct and don't run over each other. - gdb.execute("memory-tag set-allocation-tag a+16 1 06", False, True) + # set correctly and don't run over each other. + gdb.execute(f"memory-tag set-allocation-tag {ta}+16 1 06", False, = True) =20 # Read the known values back and check if they remain the same. =20 - co =3D gdb.execute("memory-tag print-allocation-tag a", False, Tru= e) + co =3D gdb.execute(f"memory-tag print-allocation-tag {ta}", False,= True) first_tag =3D re.match(PATTERN_1, co)[1] =20 - co =3D gdb.execute("memory-tag print-allocation-tag a+16", False, = True) + co =3D gdb.execute(f"memory-tag print-allocation-tag {ta}+16", Fal= se, True) second_tag =3D re.match(PATTERN_1, co)[1] =20 if first_tag =3D=3D "0x4" and second_tag =3D=3D "0x6": @@ -61,15 +86,15 @@ def run_test(): report(False, "Can't set/print allocation tags!") =20 # Now test fill pattern by setting a whole page with a pattern. - gdb.execute("memory-tag set-allocation-tag a 4096 0a0b", False, Tr= ue) + gdb.execute(f"memory-tag set-allocation-tag {ta} 4096 0a0b", False= , True) =20 # And read back the tags of the last two granules in page so # we also test if the pattern is set correctly up to the end of # the page. - co =3D gdb.execute("memory-tag print-allocation-tag a+4096-32", Fa= lse, True) + co =3D gdb.execute(f"memory-tag print-allocation-tag {ta}+4096-32"= , False, True) tag =3D re.match(PATTERN_1, co)[1] =20 - co =3D gdb.execute("memory-tag print-allocation-tag a+4096-16", Fa= lse, True) + co =3D gdb.execute(f"memory-tag print-allocation-tag {ta}+4096-16"= , False, True) last_tag =3D re.match(PATTERN_1, co)[1] =20 if tag =3D=3D "0xa" and last_tag =3D=3D "0xb": @@ -78,8 +103,8 @@ def run_test(): report(False, "Fill pattern failed!") =20 except gdb.error: - # This usually happens because a GDB version that does not - # support memory tagging was used to run the test. + # This usually happens because a GDB version that does not support + # memory tagging was used to run the test. report(False, "'memory-tag' command failed!") =20 =20 diff --git a/tests/tcg/aarch64/system/boot.S b/tests/tcg/aarch64/system/boo= t.S index 501685d0ec..4eb1b35b88 100644 --- a/tests/tcg/aarch64/system/boot.S +++ b/tests/tcg/aarch64/system/boot.S @@ -135,6 +135,17 @@ __start: orr x1, x1, x3 str x1, [x2] /* 2nd 2mb (.data & .bss)*/ =20 + /* Third block: at 'mte_page', set in kernel.ld */ + adrp x1, mte_page + add x1, x1, :lo12:mte_page + bic x1, x1, #(1 << 21) - 1 + and x4, x1, x5 + add x2, x0, x4, lsr #(21 - 3) + /* attr(AF, NX, block, AttrIndx=3DAttr1) */ + ldr x3, =3D(3 << 53) | 0x401 | (1 << 2) + orr x1, x1, x3 + str x1, [x2] + /* Setup/enable the MMU. */ =20 /* diff --git a/tests/tcg/aarch64/system/kernel.ld b/tests/tcg/aarch64/system/= kernel.ld index 5f39258d32..aef043e31d 100644 --- a/tests/tcg/aarch64/system/kernel.ld +++ b/tests/tcg/aarch64/system/kernel.ld @@ -7,6 +7,8 @@ MEMORY { TXT (rx) : ORIGIN =3D 1 << 30, LENGTH =3D 2M /* Align r/w data to the 2nd 2 MiB chunk. */ DAT (rw) : ORIGIN =3D (1 << 30) + 2M, LENGTH =3D 2M + /* Align the MTE-enabled page to the 3rd 2 MiB chunk. */ + TAG (rw) : ORIGIN =3D (1 << 30) + 4M, LENGTH =3D 2M } =20 SECTIONS { @@ -18,6 +20,13 @@ SECTIONS { *(.data) *(.bss) } >DAT + .tag : { + /* + * Symbol 'mte_page' is used in boot.S to setup the PTE and in the= mte.S + * test as the address that the MTE instructions operate on. + */ + mte_page =3D .; + } >TAG /DISCARD/ : { *(.ARM.attributes) } diff --git a/tests/tcg/aarch64/system/mte.S b/tests/tcg/aarch64/system/mte.S new file mode 100644 index 0000000000..b611240a95 --- /dev/null +++ b/tests/tcg/aarch64/system/mte.S @@ -0,0 +1,109 @@ +/* + * Code to help test the MTE gdbstubs in system mode. + * + * Copyright (c) 2024 Linaro Limited + * + * Author: Gustavo Romero + * + * SPDX-License-Identifier: LGPL-2.1-or-later + */ + +#define addr x0 /* Ptr to the start of the MTE-enabled page. */ +#define tagged_addr x1 /* 'addr' ptr with a random-generated tag added. */ +#define tmp0 x2 /* Scratch register. */ +#define tmp1 x3 /* Scratch register. */ +#define tmp2 x4 /* Scratch register. */ +#define tmp3 x5 /* Sctatch register. */ + + .file "mte.S" + + .text + .align 4 + + .globl main + .type main, @function + +main: + /* + * Set MAIR_EL1 (Memory Attribute Index Register). In boot.S, the + * attribute index for .mte_page is set to point to MAILR_EL field Attr1 + * (AttrIndx=3DAttr1), so set Attr1 as Tagged Normal (MTE) to enable MTE + * on this page. + * + * Attr1 =3D 0xF0 =3D> Tagged Normal (MTE) + */ + mrs tmp0, mair_el1 + orr tmp0, tmp0, (0xF0 << 8) + msr mair_el1, tmp0 + + /* + * Set TCR_EL1 (Translation Control Registers) to ignore the top byte + * in the translated addresses so it can be used to keep the tags. + * + * TBI0[37] =3D 0b1 =3D> Top Byte ignored and used for tagged addresses + */ + mrs tmp1, tcr_el1 + orr tmp1, tmp1, (1 << 37) + msr tcr_el1, tmp1 + + /* + * Set SCTLR_EL1 (System Control Register) to enable the use of MTE + * insns., like stg & friends, and to enable synchronous exception in + * case of a tag mismatch, i.e., when the logical tag in 'tagged_addr' + * is different from the allocation tag related to 'addr' address. + * + * ATA[43] =3D 0b1 =3D> Enable access to allocation tags at EL1 + * TCF[41:40] =3D 0b01 =3D> Tag Check Faults cause a synchronous exception + * + */ + mrs tmp2, sctlr_el1 + mov tmp3, (1 << 43) | (1 << 40) + orr tmp2, tmp2, tmp3 + msr sctlr_el1, tmp2 + + isb + + /* + * MTE-enabled page resides at the 3rd 2MB chunk in the second 1GB + * block, i.e., at 0x40400000 address. See .mte_page section in boot.S + * and kernel.ld (where the address is effectively computed). + * + * Load .mte_page address into 'addr' register. + */ + adrp addr, mte_page + add addr, addr, :lo12:mte_page + + /* + * Set GCR for random tag generation. 0xA5 is just a random value to set + * GCR !=3D 0 so the tag generated by 'irg' insn. is not zero, which is + * more interesting for the tests than when tag is zero. + */ + mov tmp0, 0xA5 + msr gcr_el1, tmp0 + + /* + * Generate a logical tag, add it to 'addr' address and put it into + * 'tagged_addr'. + */ + irg tagged_addr, addr + + /* + * Store the generated tag to memory region pointed to by 'addr', i.e. + * set the allocation tag for granule at 'addr'. The tag is extracted + * by stg from tagged_addr pointer. + */ + stg tagged_addr, [addr] + + /* + * Store a random value (0xdeadbeef) to tagged_addr address. This must + * not cause any Tag Check Fault since logical tag in tagged_addr and + * allocation tag associated with the memory pointed by tagged_addr are + * set the same, otherwise something is off and the test fails -- an + * exception is generated. + */ + ldr tmp1, =3D0xdeadbeef + str tmp1, [tagged_addr] + + /* This label is used by GDB Python script test-mte.py. */ +main_end: + ret --=20 2.39.2 From nobody Sun Nov 24 05:59:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1725977452; cv=none; d=zohomail.com; s=zohoarc; b=PdJ/IIGMZMYBYutaDateMYM5EfVYVSHHATp78ClI6FIuNdjvukBHRioOLqfpglglYUIXfo80xc94rix3gzK8ETPwfZ0ZqFLF0+z9zX2S9T5BRBaVSEM4B7ujO+d8YIvMiWVL/EltzHLxRWcNL988psk0gF/mNWNQ96MdZkbdDGY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725977452; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=IsUfGT83ExXUAJJQLptvfbG4vLgQieFEBjde6vtierM=; b=KUc5hDHHKgWbBx9kJm+jLPsoHT4NluwEshW4FWsqDJv2+3kZpThxl5pKPt4Q0xRDqZ1pbtGusHIg3b2iyd8zuA/ZarBXGN9ib1voluGDQAp6rmxV0D0+iBT8pEge9pRAFgjUguvkwaUZbL3Oi8WMTuTZ/xfvpIaTyRLpztQg9Mk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1725977452850895.5966457357897; Tue, 10 Sep 2024 07:10:52 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1so1X3-0007ug-7a; Tue, 10 Sep 2024 10:07:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1so1X1-0007m2-9s for qemu-devel@nongnu.org; Tue, 10 Sep 2024 10:07:47 -0400 Received: from mail-ej1-x62a.google.com ([2a00:1450:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1so1Wy-0006Wc-WB for qemu-devel@nongnu.org; Tue, 10 Sep 2024 10:07:47 -0400 Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-a83562f9be9so78615366b.0 for ; Tue, 10 Sep 2024 07:07:44 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25a2c441sm487354166b.90.2024.09.10.07.07.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 07:07:40 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id A0FFB5FA18; Tue, 10 Sep 2024 15:07:34 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725977263; x=1726582063; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=IsUfGT83ExXUAJJQLptvfbG4vLgQieFEBjde6vtierM=; b=cpOwIF5V2sARfRaaezi3XfCe2bohmIJkXVv8rh4pP1fHmdEXoVWWgT/LJSW61fcahV /jsIxQ2hvC2zmKF0zasnwuSz8fWE86Aku6wwRj5Yd2KqMzsXf7RhxaiXm/K5d18+Uk3I Dycc1hxLk8drz4zFshMH2VPvw2YrBzWgO58zqrnQt1wPnDBsDyv7z3gXTW7zoUuVDmQP SaRPwLklJ4yAp22R27odcak1/7/uJEs/2b+5G6/8SlVSWOc3qS8kjNvRGzAXiI/RdWCE St56dzfg+8RttEqjc43wQgiAIKZsBiwVg2LJmOF8RjC0NI1imG3HSuwZWk8TWJiSvnY3 89VQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725977263; x=1726582063; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IsUfGT83ExXUAJJQLptvfbG4vLgQieFEBjde6vtierM=; b=Re2/9xl5IMTsgNkefT7sjhHq3uE/3WoL9Il1QSoFNvUZDnevSeiI90a4inf4/z8Lly y3fUZpo9Srm1vRJoxDHE0uOeK8uu1GIQbtHG0g2xdFuqmPrL/jh3DGuaL8Qc7zLV7Bcb Y6z+Z/ltzRfKoF7r1xpz+IOorDZAdTAzeIZ3T/Bt04v4v7rCqGzxzD/zSXLLJtQDYiDj crf0qYhiCT5Azt0cxTpjHjIym8RTRzXrpgkPaIytnFLndmqOTGpzP3RW3dnR3UbwmuwA eQL/GZGu48gJVpeAsdcgDnQD4fQmqDCZoTi7WSr9zqrHj5MjBkIEgh4bsApmnL+J98zW La5w== X-Gm-Message-State: AOJu0YxW1osMYCreM8k7mGqpbPMgpnYp8LvjY4JyzlvRc7NcEDe/YSPJ K9Bb2c/x7TWGKzfnOsMkiJPZ8Zz+et6Ua+u/lhx1DLqaB4N0wddmOY0rwNirXuA= X-Google-Smtp-Source: AGHT+IEfpc61Ff8Z+U/qAeLxqjz1tp2OBS0Heq2Uz0SmZ3HkZLPX8o4XiHCg9zOlnny1JWh39jazzg== X-Received: by 2002:a17:906:7949:b0:a86:80ef:4fe5 with SMTP id a640c23a62f3a-a8ffadece87mr102318566b.47.1725977263302; Tue, 10 Sep 2024 07:07:43 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Zhao Liu , Marcel Apfelbaum , Beraldo Leal , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Alexandre Iooss , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Pierrick Bouvier , Yanan Wang , Peter Maydell , Mahmoud Mandour , Thomas Huth , qemu-arm@nongnu.org, devel@lists.libvirt.org, Jiaxun Yang , Paolo Bonzini , Richard Henderson , Wainer dos Santos Moschetta Subject: [PATCH 10/26] contrib/plugins/Makefile: Add a 'distclean' target Date: Tue, 10 Sep 2024 15:07:17 +0100 Message-Id: <20240910140733.4007719-11-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240910140733.4007719-1-alex.bennee@linaro.org> References: <20240910140733.4007719-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::62a; envelope-from=alex.bennee@linaro.org; helo=mail-ej1-x62a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1725977453195116600 From: Thomas Huth Running "make distclean" in the build tree currently fails since this tries to run the "distclean" target in the contrib/plugins/ folder, too, but the Makefile there is missing this target. Thus add 'distclean' there to fix this issue. And to avoid regressions with "make distclean", add this command to one of the build jobs, too. Signed-off-by: Thomas Huth Reviewed-by: Pierrick Bouvier Message-Id: <20240902154749.73876-1-thuth@redhat.com> Signed-off-by: Alex Benn=C3=A9e --- .gitlab-ci.d/buildtest.yml | 2 ++ contrib/plugins/Makefile | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.d/buildtest.yml b/.gitlab-ci.d/buildtest.yml index 1d2afae996..8bc67ef7e9 100644 --- a/.gitlab-ci.d/buildtest.yml +++ b/.gitlab-ci.d/buildtest.yml @@ -345,6 +345,8 @@ build-tcg-disabled: 124 132 139 142 144 145 151 152 155 157 165 194 196 200 202 208 209 216 218 227 234 246 247 248 250 254 255 257 258 260 261 262 263 264 270 272 273 277 279 image-fleecing + - cd ../.. + - make distclean =20 build-user: extends: .native_build_job_template diff --git a/contrib/plugins/Makefile b/contrib/plugins/Makefile index edf256cd9d..05a2a45c5c 100644 --- a/contrib/plugins/Makefile +++ b/contrib/plugins/Makefile @@ -77,7 +77,7 @@ lib%$(SO_SUFFIX): %.o endif =20 =20 -clean: +clean distclean: rm -f *.o *$(SO_SUFFIX) *.d rm -Rf .libs =20 --=20 2.39.2 From nobody Sun Nov 24 05:59:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1725977461; cv=none; d=zohomail.com; s=zohoarc; b=I/45s9PX5wFDt8qp6eTozl29nuvJJfGR1YqKsz7JcT94qI5N+cdSx5ng02VB7Nk5oVcj1BEe0+dwm1LfX8zRPHAHX+CMV5/Y4eF8gMd3JYdndBP8NN1YeRR8PeEhhdsGPukGx7kxsv0g5Yj3lBcKTloYWMihMvBilmjw5lNQWbY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725977461; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=b313DFQEs8B271qGHlfKxgFhU13Os4oo/NuzYy1RUc0=; b=V/r3rvtZ4VhYwyhXH1DaAxHWqMg7MCWYIUTDOMyDlY6/xhV76t+kjL/oJTXTm2pSqt0fld2mbKSHm++VA6rfsW1E1A17cw8lM71/IzLFXidltYKUeCMqtP26qT7XNt+s1he1wp8S/SUUKgHadxuMjy/IDyeYr7UU7aBUnkodkbg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1725977461062728.1246547772977; Tue, 10 Sep 2024 07:11:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1so1X4-0007z4-BB; Tue, 10 Sep 2024 10:07:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1so1X2-0007sL-NH for qemu-devel@nongnu.org; Tue, 10 Sep 2024 10:07:48 -0400 Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1so1Wz-0006We-DB for qemu-devel@nongnu.org; Tue, 10 Sep 2024 10:07:48 -0400 Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-53661a131b4so3723060e87.1 for ; Tue, 10 Sep 2024 07:07:44 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25c72748sm485424066b.117.2024.09.10.07.07.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 07:07:42 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id B972C5FA1C; Tue, 10 Sep 2024 15:07:34 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725977263; x=1726582063; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=b313DFQEs8B271qGHlfKxgFhU13Os4oo/NuzYy1RUc0=; b=bMN4RQwDrjOseBIGL0ppdfKoGAOQtpgLxsGZS/0Nv2mxme+/Qs8v0h1Qb4KecHwGxM oXMNW0gtDxk+Y386BX/r/cFfmkrv7wz9ilObAOTvZTuYt7KE/4SGt+fYWYdc5clPGKVi /h2gSoppokl5yqs8Tjb8PNuuGo6EG/RtftjU5hmSSrFp86x2PeEo0wTzyVNFc2a6mh7L bcJ6I9ZY4Zav8J/X8kokmRbCWD9XByNiHi8cXYTlvl5hJDwkQD2QwxYV+sCnrz4O/lqD QMUWQP3MYJDHy8fe4AtniC9p65f04jglA6s2wxiV9a1BPqvKCp9UrPOKrqqd1+aZjBBY l1+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725977263; x=1726582063; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=b313DFQEs8B271qGHlfKxgFhU13Os4oo/NuzYy1RUc0=; b=GIGNdFCGd5KNX7deNnkiDdXeYZlOUUAEtjFZs1wM1szJbqEzaOC1QXFA2gjebLP9SX JaRG8HCMlGys7cvB1yENiBUDECjbEx471h/9JuwxkldZvLKr+UTWPvCExoWtHt8X2mDz 83lPDb+AMFceG7wqmZRgflJeNgTpMPMFzmVbbLAuEmepSYtUSoqxA8D0o0zBF12pNkle Z97cesWWkJx+gxflstvLZylHMGEN1xni2MprywBg2FQ2dGY4bLjblJVjWE6f6whiIbyi mNeyGXN7Unw7SliUQpBL4jFBFa6xynWZ1moNsO3cbgpbpYfQ2/UWezrNsoF1NmmHKZzp 1eBw== X-Gm-Message-State: AOJu0YycnKPhvNLtyAUFd5EGhpTWjpIo0wND1sMka0nYkT+s885XQxcz lvn1QZS+ebNfQRiAT7WY35DIvmWedBjpAPfUQFQnI7OJlAEFpvn4NdMUjJ7EozM= X-Google-Smtp-Source: AGHT+IFwO8H6MQwQurzjS0eTgVG0M9Cu5OMs+G0LwZFRbZEmCxIeo0Cs7eE9m636G9ihGMN/RsqLdw== X-Received: by 2002:a05:6512:398d:b0:533:4652:983a with SMTP id 2adb3069b0e04-536587cda61mr8522331e87.35.1725977262997; Tue, 10 Sep 2024 07:07:42 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Zhao Liu , Marcel Apfelbaum , Beraldo Leal , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Alexandre Iooss , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Pierrick Bouvier , Yanan Wang , Peter Maydell , Mahmoud Mandour , Thomas Huth , qemu-arm@nongnu.org, devel@lists.libvirt.org, Jiaxun Yang , Paolo Bonzini , Richard Henderson , Wainer dos Santos Moschetta Subject: [PATCH 11/26] deprecation: don't enable TCG plugins by default on 32 bit hosts Date: Tue, 10 Sep 2024 15:07:18 +0100 Message-Id: <20240910140733.4007719-12-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240910140733.4007719-1-alex.bennee@linaro.org> References: <20240910140733.4007719-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::133; envelope-from=alex.bennee@linaro.org; helo=mail-lf1-x133.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1725977463299116600 The existing plugins already liberally use host pointer stuffing for passing user data which will fail when doing 64 bit guests on 32 bit hosts. We should discourage this by officially deprecating support and adding another nail to the 32 bit host coffin. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Pierrick Bouvier --- v2 - don't manually set based on CPU type, use __SIZEOF_POINTER__ --- docs/about/deprecated.rst | 11 +++++++++++ configure | 21 ++++++++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index 88f0f03786..f7c7c33d39 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -184,6 +184,17 @@ be an effective use of its limited resources, and thus= intends to discontinue it. Since all recent x86 hardware from the past >10 years is capable of the 64-bit x86 extensions, a corresponding 64-bit OS should be used instead. =20 +TCG Plugin support not enabled by default on 32-bit hosts (since 9.2) +''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' + +While it is still possible to enable TCG plugin support for 32-bit +hosts there are a number of potential pitfalls when instrumenting +64-bit guests. The plugin APIs typically pass most addresses as +uint64_t but practices like encoding that address in a host pointer +for passing as user-data will lose data. As most software analysis +benefits from having plenty of host memory it seems reasonable to +encourage users to use 64 bit builds of QEMU for analysis work +whatever targets they are instrumenting. =20 System emulator CPUs -------------------- diff --git a/configure b/configure index 40186d865e..14581c1b9a 100755 --- a/configure +++ b/configure @@ -516,6 +516,25 @@ case "$cpu" in ;; esac =20 +# Now we have our CPU_CFLAGS we can check if we are targeting a 32 or +# 64 bit host. + +check_64bit_host() { +cat > $TMPC < (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1725977336273406.6086543398102; Tue, 10 Sep 2024 07:08:56 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1so1XC-0000Cd-Qj; Tue, 10 Sep 2024 10:07:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1so1X8-0008GK-1X for qemu-devel@nongnu.org; Tue, 10 Sep 2024 10:07:54 -0400 Received: from mail-ej1-x631.google.com ([2a00:1450:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1so1X4-0006Yz-Nb for qemu-devel@nongnu.org; Tue, 10 Sep 2024 10:07:53 -0400 Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-a8d2b4a5bf1so111545566b.2 for ; Tue, 10 Sep 2024 07:07:49 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25cf6a88sm483205466b.182.2024.09.10.07.07.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 07:07:42 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id D55C862330; Tue, 10 Sep 2024 15:07:34 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725977268; x=1726582068; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=g4TlBd0JeT03UVw9sn8pYyZukJ9dto1YgZC+m8kda2c=; b=tcNsxONHHaJUkykjmJjolSw+9LCt8rt5KLYyP6+JoDLQZ9gPou3nN2oD87a2ot52ye BOwQuN2+tmrH4lPuZN0WdrDzypdOe3dNmm4M33rcP56w73hFATTAcwF7c/vOLzShBr5K /fl8UbiV7Nr+Bg6axe1gNFzDZjcXFXZ4J3GCjwzyE1fKPbuwyujscTJjNmSmNSl9uzs8 cRf4ypA23fo+5XVtQjU/TztuHopzGhT0zP6gahR2Ta8JUfQ8YJRIOhkuJnhuSNN+IN3x 5b4ErdgwGVQFug0DzhJNht0NM9GwENqBBT8SMon/JrZn+IcgAZWopNv5IPE7lMrnw8Zn wnVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725977268; x=1726582068; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=g4TlBd0JeT03UVw9sn8pYyZukJ9dto1YgZC+m8kda2c=; b=JL+tMtsFxP/G4BtpTM0+IQ1bUc8ZxhnhbRXxcKCimsroEat3erCA5QJIzfLrR0QVO9 rH9d2EzucZfjJEahbIzz+JQrwuhkNbC30vu8V/VfyOm+5ntCawFsFHY3cyJBJbuP5KZ4 FFmqCsxhfNKtO/L8DdlrRskRJkfyvEMH14HGPMEG9uSQsW/sMjeqpnIC3yC2YF88qIZR sJQ1DBE0UMR/QqTB+1czlhJvBqwaoSop0nh1M1AixYGns7rcKwgOLa7oiME94NE+ewfz rE1r6ktC+gVh6DBOrKsy3jdk9MRusBoMXSsZ7rMS1jDKcgwaygyCaWsW+6XprCtQcO1B uFdA== X-Gm-Message-State: AOJu0YzQVYShwpkzJZpw/aVgz5ApISphuGlAj3KLEYoR7HvCW72ZJyyQ qPGiUFBjX2KV3wFZ4lMrAVo1+0XAfUpZ7h+3GjWaAIb9NPT+j+LuVOUrQseFCK4= X-Google-Smtp-Source: AGHT+IErJNJJoE7feFTNDc27hviErpxt+F5KAygxg+YXUgSVnGAwixrEWB2e79CWF6NltR/8bD4giQ== X-Received: by 2002:a17:907:7208:b0:a8d:2c3e:7ed3 with SMTP id a640c23a62f3a-a8ffab9752amr88481766b.35.1725977268040; Tue, 10 Sep 2024 07:07:48 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Zhao Liu , Marcel Apfelbaum , Beraldo Leal , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Alexandre Iooss , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Pierrick Bouvier , Yanan Wang , Peter Maydell , Mahmoud Mandour , Thomas Huth , qemu-arm@nongnu.org, devel@lists.libvirt.org, Jiaxun Yang , Paolo Bonzini , Richard Henderson , Wainer dos Santos Moschetta Subject: [PATCH 12/26] deprecation: don't enable TCG plugins by default with TCI Date: Tue, 10 Sep 2024 15:07:19 +0100 Message-Id: <20240910140733.4007719-13-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240910140733.4007719-1-alex.bennee@linaro.org> References: <20240910140733.4007719-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::631; envelope-from=alex.bennee@linaro.org; helo=mail-ej1-x631.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1725977336696116600 The softmmu memory instrumentation test sees so many more accesses than a normal translated host and its really not worth fixing up. Lets deprecate this odd configuration and save on the CI cycles. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Pierrick Bouvier --- docs/about/deprecated.rst | 8 ++++++++ configure | 11 +++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index f7c7c33d39..5aa2e35314 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -196,6 +196,14 @@ benefits from having plenty of host memory it seems re= asonable to encourage users to use 64 bit builds of QEMU for analysis work whatever targets they are instrumenting. =20 +TCG Plugin support not enabled by default with TCI (since 9.2) +'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' + +While the TCG interpreter can interpret the TCG ops used by plugins it +is going to be so much slower it wouldn't make sense for any serious +instrumentation. Due to implementation differences there will also be +anomalies in things like memory instrumentation. + System emulator CPUs -------------------- =20 diff --git a/configure b/configure index 14581c1b9a..1bda6b3a3b 100755 --- a/configure +++ b/configure @@ -629,6 +629,9 @@ meson_option_parse() { exit 1 fi } +has_meson_option() { + test "${meson_options#*"$1"}" !=3D "$meson_options" +} =20 meson_add_machine_file() { if test "$cross_compile" =3D "yes"; then @@ -1048,8 +1051,12 @@ if test "$static" =3D "yes" ; then plugins=3D"no" fi if test "$plugins" !=3D "no" && test $host_bits -eq 64; then - plugins=3Dyes - subdirs=3D"$subdirs contrib/plugins" + if has_meson_option "-Dtcg_interpreter=3Dtrue"; then + plugins=3D"no" + else + plugins=3Dyes + subdirs=3D"$subdirs contrib/plugins" + fi fi =20 cat > $TMPC << EOF --=20 2.39.2 From nobody Sun Nov 24 05:59:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1725977311; cv=none; d=zohomail.com; s=zohoarc; b=mbwRS/PJBzPiJF5CJownMnPCEh6aTWRKija+v/BWAYRGFJ4p+OYKGQInXxMOIw8mEXhLJEKFJ6fQ478TSo5Sb4kpdjqjAIpBj6fKL+V9l3PreyM2XWjvZUzo9vo5TmFMMMqFJiSy/FQmE2iwJg9F5AebqaWgb7OpJP97PU62fuQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725977311; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Jq+bIaq+Yu3DGt6tVQ6YepDYvCa3NgcrqP3wlvmzv9c=; b=jnPLGEz0Z22oLONwIhvHK7frlT1MLvXfEnQDlBulyoZJWt4iAxPIQIcYEzJO/HElEcfMjwjSv8Ol97yoA0YTaS0yTUssM9L9o2otjPM7f2XanbjcDZ8WMqw7aHb8pU4RCjGxeeUcOJNz47k5FZcbzumQ+pHDG9/EDsnmHnKfUeU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1725977311654763.9868532831485; Tue, 10 Sep 2024 07:08:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1so1X8-0008Kf-Vf; Tue, 10 Sep 2024 10:07:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1so1X4-00081d-UR for qemu-devel@nongnu.org; Tue, 10 Sep 2024 10:07:50 -0400 Received: from mail-ej1-x62a.google.com ([2a00:1450:4864:20::62a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1so1X1-0006Xu-Rp for qemu-devel@nongnu.org; Tue, 10 Sep 2024 10:07:50 -0400 Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-a8d56155f51so94600166b.2 for ; Tue, 10 Sep 2024 07:07:47 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25cf4aa7sm492483466b.176.2024.09.10.07.07.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 07:07:42 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id F06316324D; Tue, 10 Sep 2024 15:07:34 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725977266; x=1726582066; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Jq+bIaq+Yu3DGt6tVQ6YepDYvCa3NgcrqP3wlvmzv9c=; b=hejLEhrAHNHVxFwUI7ZjV4GN636PNxlaNVuVpPjwD+sT6pvWamR2VWuJViIeAQqlVh g9La4KPs5kfwSH/AokXyDbtUhkjFMeOqyXUuZH7yGgfR5eu7PUHrBGjmiZ+MY2yqQNE5 uym1WYPw3KlYd3KPGczfWzCuwy1nj270wzJPxoKY3lxjyu2TSKfuIEX+6vdscxbH7Xea gFLaHf02F1a0dFKaERCMgBd/eRWtNEzpj4P4SDTLSi2wJbTdgm/NePh+me8tIPdq/I1y BCAq/yHzJpcbDDIemt+gCfxmKH/AoItDHp/h3rxA96bg2cmtLDk9qcnMAVzjg/EzqGJI ygLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725977266; x=1726582066; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Jq+bIaq+Yu3DGt6tVQ6YepDYvCa3NgcrqP3wlvmzv9c=; b=SL3Y2DkXJ/aISvhsKiW2W1wXF6vcopOWkVTV0kX9DASILTAQN5hUdegKuFRXLLBhJD Xnip0nN9OAstfvj0HmKLhbyYDbAuZTUdlixHfkQxjFx10WpOJsSjHajDSm2dLn5zcvgK pqd7RQK6u97KSLrVIuyX9t3vUZuXhCXSl1KzyPKrPSG02ysK248SmpABVX9Er+GGZ+2W AB0ASjZjPxjGnE8X7ALa/7P4HgU4aqvIn6PJE5o5pXuqyAuxZuFle3oCgAm/lChu+wUz j1SmHM+y9TklNmm/xIG4BqvG06SILUqVs2gHSI9rYnEDahL2hRukrZJbrchd1E4Gh3SI eb7g== X-Gm-Message-State: AOJu0YzOllfmINyUPLIelRdogeL2xjgc+Xs4pIKkuyZnGM9CuQfoQm5U b+krkCDHb9XClNfTJmdvCkQhW5pl79dK0hwage4b/14a0Z/4QrqT+a5vWTA/T3g= X-Google-Smtp-Source: AGHT+IFpbdr7MB3Zu7Nfvg7kkD3soTVUdfO15Eky4YgiWiSS9VKMqibqWE+GIpPY4XBRONtYRVQGog== X-Received: by 2002:a17:907:961a:b0:a8a:4e39:a462 with SMTP id a640c23a62f3a-a8ffaaafcd9mr78363466b.7.1725977266086; Tue, 10 Sep 2024 07:07:46 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Zhao Liu , Marcel Apfelbaum , Beraldo Leal , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Alexandre Iooss , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Pierrick Bouvier , Yanan Wang , Peter Maydell , Mahmoud Mandour , Thomas Huth , qemu-arm@nongnu.org, devel@lists.libvirt.org, Jiaxun Yang , Paolo Bonzini , Richard Henderson , Wainer dos Santos Moschetta , Gustavo Romero Subject: [PATCH 13/26] contrib/plugins: control flow plugin Date: Tue, 10 Sep 2024 15:07:20 +0100 Message-Id: <20240910140733.4007719-14-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240910140733.4007719-1-alex.bennee@linaro.org> References: <20240910140733.4007719-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::62a; envelope-from=alex.bennee@linaro.org; helo=mail-ej1-x62a.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1725977312540116600 This is a simple control flow tracking plugin that uses the latest inline and conditional operations to detect and track control flow changes. It is currently an exercise at seeing how useful the changes are. Based-on: <20240312075428.244210-1-pierrick.bouvier@linaro.org> Cc: Gustavo Romero Cc: Pierrick Bouvier Signed-off-by: Alex Benn=C3=A9e Message-Id: <20240311153432.1395190-1-alex.bennee@linaro.org> Reviewed-by: Pierrick Bouvier --- v2 - only need a single call back - drop need for INSN_WIDTH - still don't understand the early exits v3 - move initial STORE ops to first instruction to avoid confusion with the conditional callback on the start - filter out non-branches before processing - fix off-by-one with accounting - display "sync fault" or "branch" instead of raw numbers v4 - rename hotdest to hottest (i.e. the hottest branch insn) - rename early to exception - WIP insn structure --- contrib/plugins/cflow.c | 413 +++++++++++++++++++++++++++++++++++++++ contrib/plugins/Makefile | 1 + 2 files changed, 414 insertions(+) create mode 100644 contrib/plugins/cflow.c diff --git a/contrib/plugins/cflow.c b/contrib/plugins/cflow.c new file mode 100644 index 0000000000..173daec60d --- /dev/null +++ b/contrib/plugins/cflow.c @@ -0,0 +1,413 @@ +/* + * Control Flow plugin + * + * This plugin will track changes to control flow and detect where + * instructions fault. + * + * Copyright (c) 2024 Linaro Ltd + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ +#include +#include +#include +#include +#include +#include + +#include + +QEMU_PLUGIN_EXPORT int qemu_plugin_version =3D QEMU_PLUGIN_VERSION; + +typedef enum { + SORT_HOTTEST, /* hottest branch insn */ + SORT_EXCEPTION, /* most early exits */ + SORT_POPDEST, /* most destinations (usually ret's) */ +} ReportType; + +ReportType report =3D SORT_HOTTEST; +int topn =3D 10; + +typedef struct { + uint64_t daddr; + uint64_t dcount; +} DestData; + +/* A node is an address where we can go to multiple places */ +typedef struct { + GMutex lock; + /* address of the branch point */ + uint64_t addr; + /* array of DestData */ + GArray *dests; + /* early exit/fault count */ + uint64_t early_exit; + /* jump destination count */ + uint64_t dest_count; + /* instruction data */ + char *insn_disas; + /* symbol? */ + const char *symbol; + /* times translated as last in block? */ + int last_count; + /* times translated in the middle of block? */ + int mid_count; +} NodeData; + +typedef enum { + /* last insn in block, expected flow control */ + LAST_INSN =3D (1 << 0), + /* mid-block insn, can only be an exception */ + EXCP_INSN =3D (1 << 1), + /* multiple disassembly, may have changed */ + MULT_INSN =3D (1 << 2), +} InsnTypes; + +typedef struct { + /* address of the branch point */ + uint64_t addr; + /* disassembly */ + char *insn_disas; + /* symbol? */ + const char *symbol; + /* types */ + InsnTypes type_flag; +} InsnData; + +/* We use this to track the current execution state */ +typedef struct { + /* address of end of block */ + uint64_t end_block; + /* next pc after end of block */ + uint64_t pc_after_block; + /* address of last executed PC */ + uint64_t last_pc; +} VCPUScoreBoard; + +/* descriptors for accessing the above scoreboard */ +static qemu_plugin_u64 end_block; +static qemu_plugin_u64 pc_after_block; +static qemu_plugin_u64 last_pc; + + +static GMutex node_lock; +static GHashTable *nodes; +struct qemu_plugin_scoreboard *state; + +static GMutex insn_lock; +static GHashTable *insn_hash; + +/* SORT_HOTTEST */ +static gint hottest(gconstpointer a, gconstpointer b) +{ + NodeData *na =3D (NodeData *) a; + NodeData *nb =3D (NodeData *) b; + + return na->dest_count > nb->dest_count ? -1 : + na->dest_count =3D=3D nb->dest_count ? 0 : 1; +} + +static gint exception(gconstpointer a, gconstpointer b) +{ + NodeData *na =3D (NodeData *) a; + NodeData *nb =3D (NodeData *) b; + + return na->early_exit > nb->early_exit ? -1 : + na->early_exit =3D=3D nb->early_exit ? 0 : 1; +} + +static gint popular(gconstpointer a, gconstpointer b) +{ + NodeData *na =3D (NodeData *) a; + NodeData *nb =3D (NodeData *) b; + + return na->dests->len > nb->dests->len ? -1 : + na->dests->len =3D=3D nb->dests->len ? 0 : 1; +} + +/* Filter out non-branches - returns true to remove entry */ +static gboolean filter_non_branches(gpointer key, gpointer value, gpointer= user_data) +{ + NodeData *node =3D (NodeData *) value; + + return node->dest_count =3D=3D 0; +} + +static void plugin_exit(qemu_plugin_id_t id, void *p) +{ + g_autoptr(GString) result =3D g_string_new("collected "); + GList *data; + GCompareFunc sort =3D &hottest; + int n =3D 0; + + g_mutex_lock(&node_lock); + g_string_append_printf(result, "%d control flow nodes in the hash tabl= e\n", + g_hash_table_size(nodes)); + + /* remove all nodes that didn't branch */ + g_hash_table_foreach_remove(nodes, filter_non_branches, NULL); + + data =3D g_hash_table_get_values(nodes); + + switch (report) { + case SORT_HOTTEST: + sort =3D &hottest; + break; + case SORT_EXCEPTION: + sort =3D &exception; + break; + case SORT_POPDEST: + sort =3D &popular; + break; + } + + data =3D g_list_sort(data, sort); + + for (GList *l =3D data; + l !=3D NULL && n < topn; + l =3D l->next, n++) { + NodeData *n =3D l->data; + const char *type =3D n->mid_count ? "sync fault" : "branch"; + g_string_append_printf(result, " addr: 0x%"PRIx64 " %s: %s (%s)\n= ", + n->addr, n->symbol, n->insn_disas, type); + if (n->early_exit) { + g_string_append_printf(result, " early exits %"PRId64"\n", + n->early_exit); + } + g_string_append_printf(result, " branches %"PRId64"\n", + n->dest_count); + for (int j =3D 0; j < n->dests->len; j++ ) { + DestData *dd =3D &g_array_index(n->dests, DestData, j); + g_string_append_printf(result, " to 0x%"PRIx64" (%"PRId64= ")\n", + dd->daddr, dd->dcount); + } + } + + qemu_plugin_outs(result->str); + + g_mutex_unlock(&node_lock); +} + +static void plugin_init(void) +{ + g_mutex_init(&node_lock); + nodes =3D g_hash_table_new(NULL, g_direct_equal); + state =3D qemu_plugin_scoreboard_new(sizeof(VCPUScoreBoard)); + + /* score board declarations */ + end_block =3D qemu_plugin_scoreboard_u64_in_struct(state, VCPUScoreBoa= rd, end_block); + pc_after_block =3D qemu_plugin_scoreboard_u64_in_struct(state, VCPUSco= reBoard, pc_after_block); + last_pc =3D qemu_plugin_scoreboard_u64_in_struct(state, VCPUScoreBoard= , last_pc); +} + +static NodeData *create_node(uint64_t addr) +{ + NodeData *node =3D g_new0(NodeData, 1); + g_mutex_init(&node->lock); + node->addr =3D addr; + node->dests =3D g_array_new(true, true, sizeof(DestData)); + return node; +} + +static NodeData *fetch_node(uint64_t addr, bool create_if_not_found) +{ + NodeData *node =3D NULL; + + g_mutex_lock(&node_lock); + node =3D (NodeData *) g_hash_table_lookup(nodes, (gconstpointer) addr); + if (!node && create_if_not_found) { + node =3D create_node(addr); + g_hash_table_insert(nodes, (gpointer) addr, (gpointer) node); + } + g_mutex_unlock(&node_lock); + return node; +} + +#if 0 +static InsnData *fetch_insn(uint64_t addr, struct qemu_plugin_insn *insn, = InsnTypes flag) +{ + InsnData *d =3D NULL; + + g_mutex_lock(&insn_lock); + d =3D (InsnData *) g_hash_table_lookup(insn_hash, (gconstpointer) addr= ); + if (!d) { + d =3D g_new0(InsnData, 1); + d->addr =3D addr; + d->type_flag =3D flag; + d->insn_disas =3D qemu_plugin_insn_disas(insn); + d->symbol =3D qemu_plugin_insn_symbol(insn); + g_hash_table_insert(insn_hash, (gpointer) addr, (gpointer) d); + } else { + g_autofree char* cmp_disas =3D qemu_plugin_insn_disas(insn); + if (g_strcmp0(d->insn_disas, cmp_disas) !=3D 0) { + d->type_flag |=3D MULT_INSN; + } + d->type_flag |=3D flag; + } + g_mutex_unlock(&insn_lock); + return d; +} +#endif + +/* + * Called when we detect a non-linear execution (pc !=3D + * pc_after_block). This could be due to a fault causing some sort of + * exit exception (if last_pc !=3D block_end) or just a taken branch. + */ +static void vcpu_tb_branched_exec(unsigned int cpu_index, void *udata) +{ + uint64_t lpc =3D qemu_plugin_u64_get(last_pc, cpu_index); + uint64_t ebpc =3D qemu_plugin_u64_get(end_block, cpu_index); + uint64_t npc =3D qemu_plugin_u64_get(pc_after_block, cpu_index); + uint64_t pc =3D GPOINTER_TO_UINT(udata); + + /* return early for address 0 */ + if (!lpc) { + return; + } + + NodeData *node =3D fetch_node(lpc, true); + DestData *data =3D NULL; + bool early_exit =3D (lpc !=3D ebpc); + GArray *dests; + + /* the condition should never hit */ + g_assert(pc !=3D npc); + + g_mutex_lock(&node->lock); + + if (early_exit) { + fprintf(stderr, "%s: pc=3D%"PRIx64", epbc=3D%"PRIx64 + " npc=3D%"PRIx64", lpc=3D%"PRIx64", \n", + __func__, pc, ebpc, npc, lpc); + node->early_exit++; + if (!node->mid_count) { + /* count now as we've only just allocated */ + node->mid_count++; + } + } + + dests =3D node->dests; + for (int i =3D 0; i < dests->len; i++) { + if (g_array_index(dests, DestData, i).daddr =3D=3D pc) { + data =3D &g_array_index(dests, DestData, i); + } + } + + /* we've never seen this before, allocate a new entry */ + if (!data) { + DestData new_entry =3D { .daddr =3D pc }; + g_array_append_val(dests, new_entry); + data =3D &g_array_index(dests, DestData, dests->len - 1); + g_assert(data->daddr =3D=3D pc); + } + + data->dcount++; + node->dest_count++; + + g_mutex_unlock(&node->lock); +} + +/* + * At the start of each block we need to resolve two things: + * + * - is last_pc =3D=3D block_end, if not we had an early exit + * - is start of block last_pc + insn width, if not we jumped + * + * Once those are dealt with we can instrument the rest of the + * instructions for their execution. + * + */ +static void vcpu_tb_trans(qemu_plugin_id_t id, struct qemu_plugin_tb *tb) +{ + uint64_t pc =3D qemu_plugin_tb_vaddr(tb); + size_t insns =3D qemu_plugin_tb_n_insns(tb); + struct qemu_plugin_insn *first_insn =3D qemu_plugin_tb_get_insn(tb, 0); + struct qemu_plugin_insn *last_insn =3D qemu_plugin_tb_get_insn(tb, ins= ns - 1); + + /* + * check if we are executing linearly after the last block. We can + * handle both early block exits and normal branches in the + * callback if we hit it. + */ + gpointer udata =3D GUINT_TO_POINTER(pc); + qemu_plugin_register_vcpu_tb_exec_cond_cb( + tb, vcpu_tb_branched_exec, QEMU_PLUGIN_CB_NO_REGS, + QEMU_PLUGIN_COND_NE, pc_after_block, pc, udata); + + /* + * Now we can set start/end for this block so the next block can + * check where we are at. Do this on the first instruction and not + * the TB so we don't get mixed up with above. + */ + qemu_plugin_register_vcpu_insn_exec_inline_per_vcpu(first_insn, + QEMU_PLUGIN_INLINE_S= TORE_U64, + end_block, qemu_plug= in_insn_vaddr(last_insn)); + qemu_plugin_register_vcpu_insn_exec_inline_per_vcpu(first_insn, + QEMU_PLUGIN_INLINE_S= TORE_U64, + pc_after_block, + qemu_plugin_insn_vad= dr(last_insn) + + qemu_plugin_insn_siz= e(last_insn)); + + for (int idx =3D 0; idx < qemu_plugin_tb_n_insns(tb); ++idx) { + struct qemu_plugin_insn *insn =3D qemu_plugin_tb_get_insn(tb, idx); + uint64_t ipc =3D qemu_plugin_insn_vaddr(insn); + /* + * If this is a potential branch point check if we could grab + * the disassembly for it. If it is the last instruction + * always create an entry. + */ + NodeData *node =3D fetch_node(ipc, last_insn); + if (node) { + g_mutex_lock(&node->lock); + if (!node->insn_disas) { + node->insn_disas =3D qemu_plugin_insn_disas(insn); + } + if (!node->symbol) { + node->symbol =3D qemu_plugin_insn_symbol(insn); + } + if (last_insn =3D=3D insn) { + node->last_count++; + } else { + node->mid_count++; + } + g_mutex_unlock(&node->lock); + } + + /* Store the PC of what we are about to execute */ + qemu_plugin_register_vcpu_insn_exec_inline_per_vcpu(insn, + QEMU_PLUGIN_IN= LINE_STORE_U64, + last_pc, ipc); + } +} + +QEMU_PLUGIN_EXPORT +int qemu_plugin_install(qemu_plugin_id_t id, const qemu_info_t *info, + int argc, char **argv) +{ + for (int i =3D 0; i < argc; i++) { + char *opt =3D argv[i]; + g_auto(GStrv) tokens =3D g_strsplit(opt, "=3D", 2); + if (g_strcmp0(tokens[0], "sort") =3D=3D 0) { + if (g_strcmp0(tokens[1], "hottest") =3D=3D 0) { + report =3D SORT_HOTTEST; + } else if (g_strcmp0(tokens[1], "early") =3D=3D 0) { + report =3D SORT_EXCEPTION; + } else if (g_strcmp0(tokens[1], "exceptions") =3D=3D 0) { + report =3D SORT_POPDEST; + } else { + fprintf(stderr, "failed to parse: %s\n", tokens[1]); + return -1; + } + } else { + fprintf(stderr, "option parsing failed: %s\n", opt); + return -1; + } + } + + plugin_init(); + + qemu_plugin_register_vcpu_tb_trans_cb(id, vcpu_tb_trans); + qemu_plugin_register_atexit_cb(id, plugin_exit, NULL); + return 0; +} diff --git a/contrib/plugins/Makefile b/contrib/plugins/Makefile index 05a2a45c5c..d4ac599f93 100644 --- a/contrib/plugins/Makefile +++ b/contrib/plugins/Makefile @@ -29,6 +29,7 @@ NAMES +=3D cache NAMES +=3D drcov NAMES +=3D ips NAMES +=3D stoptrigger +NAMES +=3D cflow =20 ifeq ($(CONFIG_WIN32),y) SO_SUFFIX :=3D .dll --=20 2.39.2 From nobody Sun Nov 24 05:59:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1725977321; cv=none; d=zohomail.com; s=zohoarc; b=K3d6GO3deDpSsfD76CjsZhbnXjVz5mvHtb0F+IzvdYab7jB5tWkLHeO1eVJm/YeS/Eu5aCRpS1iCiMKGQ9CGKNfIy677oAVOVS+8P+YS7RXwd9yvoyiv1zOU/QGM3Zyx/TluPQTxZ6O0ANHC006h83YHBUkjPUyjfuo4Oxx7SLA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725977321; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=QnElM81hCsi1ZuPnpFOx/34GLOM47VGqPSwGZVF4S40=; b=lbnRLsGY3+Fd5dmIybXYsetEAzUQgeEOwvIiXBCO2CYsP+b/9x/JJTBJwQOIo0/jQoKxrfSzHkVY7125hccWw8jUdXCrtP6dF5R4Pp3Uokm0xlT+3rJBRIzvfS71/LDODqnW6i3S8E9afSJdxM77u9TH3+pbSt/D+be/1C+fdOI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1725977321220221.95745027865257; Tue, 10 Sep 2024 07:08:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1so1X9-0008OJ-Mw; Tue, 10 Sep 2024 10:07:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1so1X6-00088f-Hf for qemu-devel@nongnu.org; Tue, 10 Sep 2024 10:07:52 -0400 Received: from mail-lf1-x131.google.com ([2a00:1450:4864:20::131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1so1X2-0006Xq-2s for qemu-devel@nongnu.org; Tue, 10 Sep 2024 10:07:52 -0400 Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-5365cf5de24so4163559e87.1 for ; Tue, 10 Sep 2024 07:07:47 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25c7277bsm480175966b.102.2024.09.10.07.07.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 07:07:42 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 1845E633C9; Tue, 10 Sep 2024 15:07:35 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725977266; x=1726582066; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=QnElM81hCsi1ZuPnpFOx/34GLOM47VGqPSwGZVF4S40=; b=ZpSNjzfqBSNa9AssxOMnRHj+tAvZjTWIlKtxINbUbr6dWespWi9Rx5TAZaMi0pqjSL NHgB/zZVCqK7/GyjzCB0l4DGs8/9nNDXjDppCn86SNuj9V2Dp1mqMN0+oig0cO0ZJAPC g2Y2UrCDPCJjPybZwJKky/NPQbTen0WZYw3LTbD/dB4ol6cNXKy+rxo8reUyq3xHEPwV YskuSfudvjdALIeVMOIWxhILNdMVpmLiQNZetx5OtLm/+F+IAa27yIjo+cZi1Cjex3qK chSasauIyYldVzvuiblS4175e+q4xCkfw4x1jGQw9qQiryTgz5jPorRVGH+RnLOdPewS jIOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725977266; x=1726582066; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QnElM81hCsi1ZuPnpFOx/34GLOM47VGqPSwGZVF4S40=; b=CTC8XsycUcne73B6HSomWJv//kzMKbY4UsQRiscG0bTKjfPjrO/j2rMD+5RyVmPjcF u6vZBCC+cTgcLplwEGiL6h0oKrj64m0mIJ/VhVgiEaxOap/fQllVOuMP7c6BLwPVG6Uo FmdfRElm1iWoiVvyGTkpBU0peDu1Y3CUr1p7sC6+UWXIneHXo1YlEHzEriV9U1V7vFnz 5UIheBXMa/mM85BvYlnDjcoqwePjiRjpgMD0PEH1BJJq8Wd0+e0Soj1a6cEmGxuvosg/ Q+pONYfTwE+XiQPrFwfZo+ani/LHg1u8ZvVUkBwbOj2MCHjXPGLBZF9g6JGL3kIAxOlw pnRQ== X-Gm-Message-State: AOJu0Yw7gsaeVbZTR42Mj02PRpYZaajv4RHzP/Iy345D8p62FpnbZ4RK j+pT6n+lWw1QEeEgrVZFaChdh5zt6k9VbvfZPG/G8ARkCFCM6g4EqTDyvHTPlEo= X-Google-Smtp-Source: AGHT+IGKQV9o4zEwuIpYGn40S5sKSq2UaiPdl5zsZmiQcIYtv0Ea6stTagjFhawkFnGdKKfucrHd8g== X-Received: by 2002:a05:6512:3d1f:b0:52f:288:5664 with SMTP id 2adb3069b0e04-5365881008amr7435511e87.51.1725977265741; Tue, 10 Sep 2024 07:07:45 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Zhao Liu , Marcel Apfelbaum , Beraldo Leal , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Alexandre Iooss , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Pierrick Bouvier , Yanan Wang , Peter Maydell , Mahmoud Mandour , Thomas Huth , qemu-arm@nongnu.org, devel@lists.libvirt.org, Jiaxun Yang , Paolo Bonzini , Richard Henderson , Wainer dos Santos Moschetta Subject: [PATCH 14/26] plugins: save value during memory accesses Date: Tue, 10 Sep 2024 15:07:21 +0100 Message-Id: <20240910140733.4007719-15-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240910140733.4007719-1-alex.bennee@linaro.org> References: <20240910140733.4007719-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::131; envelope-from=alex.bennee@linaro.org; helo=mail-lf1-x131.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1725977322653116600 From: Pierrick Bouvier Different code paths handle memory accesses: - tcg generated code - load/store helpers - atomic helpers This value is saved in cpu->neg.plugin_mem_value_{high,low}. Values are written only for accessed word size (upper bits are not set). Atomic operations are doing read/write at the same time, so we generate two memory callbacks instead of one, to allow plugins to access distinct values. For now, we can have access only up to 128 bits, thus split this in two 64 bits words. When QEMU will support wider operations, we'll be able to reconsider this. Reviewed-by: Richard Henderson Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Pierrick Bouvier Message-Id: <20240724194708.1843704-2-pierrick.bouvier@linaro.org> Signed-off-by: Alex Benn=C3=A9e --- accel/tcg/atomic_template.h | 66 ++++++++++++++++++++++++++++++----- include/hw/core/cpu.h | 4 +++ include/qemu/plugin.h | 4 +++ plugins/core.c | 6 ++++ tcg/tcg-op-ldst.c | 66 +++++++++++++++++++++++++++++++---- accel/tcg/atomic_common.c.inc | 13 ++++++- accel/tcg/ldst_common.c.inc | 38 ++++++++++++-------- 7 files changed, 167 insertions(+), 30 deletions(-) diff --git a/accel/tcg/atomic_template.h b/accel/tcg/atomic_template.h index 1dc2151daf..89593b2502 100644 --- a/accel/tcg/atomic_template.h +++ b/accel/tcg/atomic_template.h @@ -53,6 +53,14 @@ # error unsupported data size #endif =20 +#if DATA_SIZE =3D=3D 16 +# define VALUE_LOW(val) int128_getlo(val) +# define VALUE_HIGH(val) int128_gethi(val) +#else +# define VALUE_LOW(val) val +# define VALUE_HIGH(val) 0 +#endif + #if DATA_SIZE >=3D 4 # define ABI_TYPE DATA_TYPE #else @@ -83,7 +91,12 @@ ABI_TYPE ATOMIC_NAME(cmpxchg)(CPUArchState *env, abi_ptr= addr, ret =3D qatomic_cmpxchg__nocheck(haddr, cmpv, newv); #endif ATOMIC_MMU_CLEANUP; - atomic_trace_rmw_post(env, addr, oi); + atomic_trace_rmw_post(env, addr, + VALUE_LOW(ret), + VALUE_HIGH(ret), + VALUE_LOW(newv), + VALUE_HIGH(newv), + oi); return ret; } =20 @@ -97,7 +110,12 @@ ABI_TYPE ATOMIC_NAME(xchg)(CPUArchState *env, abi_ptr a= ddr, ABI_TYPE val, =20 ret =3D qatomic_xchg__nocheck(haddr, val); ATOMIC_MMU_CLEANUP; - atomic_trace_rmw_post(env, addr, oi); + atomic_trace_rmw_post(env, addr, + VALUE_LOW(ret), + VALUE_HIGH(ret), + VALUE_LOW(val), + VALUE_HIGH(val), + oi); return ret; } =20 @@ -109,7 +127,12 @@ ABI_TYPE ATOMIC_NAME(X)(CPUArchState *env, abi_ptr add= r, \ haddr =3D atomic_mmu_lookup(env_cpu(env), addr, oi, DATA_SIZE, retaddr= ); \ ret =3D qatomic_##X(haddr, val); \ ATOMIC_MMU_CLEANUP; \ - atomic_trace_rmw_post(env, addr, oi); \ + atomic_trace_rmw_post(env, addr, \ + VALUE_LOW(ret), \ + VALUE_HIGH(ret), \ + VALUE_LOW(val), \ + VALUE_HIGH(val), \ + oi); \ return ret; \ } =20 @@ -145,7 +168,12 @@ ABI_TYPE ATOMIC_NAME(X)(CPUArchState *env, abi_ptr add= r, \ cmp =3D qatomic_cmpxchg__nocheck(haddr, old, new); \ } while (cmp !=3D old); \ ATOMIC_MMU_CLEANUP; \ - atomic_trace_rmw_post(env, addr, oi); \ + atomic_trace_rmw_post(env, addr, \ + VALUE_LOW(old), \ + VALUE_HIGH(old), \ + VALUE_LOW(xval), \ + VALUE_HIGH(xval), \ + oi); \ return RET; \ } =20 @@ -188,7 +216,12 @@ ABI_TYPE ATOMIC_NAME(cmpxchg)(CPUArchState *env, abi_p= tr addr, ret =3D qatomic_cmpxchg__nocheck(haddr, BSWAP(cmpv), BSWAP(newv)); #endif ATOMIC_MMU_CLEANUP; - atomic_trace_rmw_post(env, addr, oi); + atomic_trace_rmw_post(env, addr, + VALUE_LOW(ret), + VALUE_HIGH(ret), + VALUE_LOW(newv), + VALUE_HIGH(newv), + oi); return BSWAP(ret); } =20 @@ -202,7 +235,12 @@ ABI_TYPE ATOMIC_NAME(xchg)(CPUArchState *env, abi_ptr = addr, ABI_TYPE val, =20 ret =3D qatomic_xchg__nocheck(haddr, BSWAP(val)); ATOMIC_MMU_CLEANUP; - atomic_trace_rmw_post(env, addr, oi); + atomic_trace_rmw_post(env, addr, + VALUE_LOW(ret), + VALUE_HIGH(ret), + VALUE_LOW(val), + VALUE_HIGH(val), + oi); return BSWAP(ret); } =20 @@ -214,7 +252,12 @@ ABI_TYPE ATOMIC_NAME(X)(CPUArchState *env, abi_ptr add= r, \ haddr =3D atomic_mmu_lookup(env_cpu(env), addr, oi, DATA_SIZE, retaddr= ); \ ret =3D qatomic_##X(haddr, BSWAP(val)); \ ATOMIC_MMU_CLEANUP; \ - atomic_trace_rmw_post(env, addr, oi); \ + atomic_trace_rmw_post(env, addr, \ + VALUE_LOW(ret), \ + VALUE_HIGH(ret), \ + VALUE_LOW(val), \ + VALUE_HIGH(val), \ + oi); \ return BSWAP(ret); \ } =20 @@ -247,7 +290,12 @@ ABI_TYPE ATOMIC_NAME(X)(CPUArchState *env, abi_ptr add= r, \ ldn =3D qatomic_cmpxchg__nocheck(haddr, ldo, BSWAP(new)); \ } while (ldo !=3D ldn); \ ATOMIC_MMU_CLEANUP; \ - atomic_trace_rmw_post(env, addr, oi); \ + atomic_trace_rmw_post(env, addr, \ + VALUE_LOW(old), \ + VALUE_HIGH(old), \ + VALUE_LOW(xval), \ + VALUE_HIGH(xval), \ + oi); \ return RET; \ } =20 @@ -281,3 +329,5 @@ GEN_ATOMIC_HELPER_FN(add_fetch, ADD, DATA_TYPE, new) #undef SUFFIX #undef DATA_SIZE #undef SHIFT +#undef VALUE_LOW +#undef VALUE_HIGH diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 1c9c775df6..04e9ad4996 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -350,6 +350,8 @@ typedef union IcountDecr { * from CPUArchState, via small negative offsets. * @can_do_io: True if memory-mapped IO is allowed. * @plugin_mem_cbs: active plugin memory callbacks + * @plugin_mem_value_low: 64 lower bits of latest accessed mem value. + * @plugin_mem_value_high: 64 higher bits of latest accessed mem value. */ typedef struct CPUNegativeOffsetState { CPUTLB tlb; @@ -358,6 +360,8 @@ typedef struct CPUNegativeOffsetState { * The callback pointer are accessed via TCG (see gen_empty_mem_helper= ). */ GArray *plugin_mem_cbs; + uint64_t plugin_mem_value_low; + uint64_t plugin_mem_value_high; #endif IcountDecr icount_decr; bool can_do_io; diff --git a/include/qemu/plugin.h b/include/qemu/plugin.h index af5f9db469..9726a9ebf3 100644 --- a/include/qemu/plugin.h +++ b/include/qemu/plugin.h @@ -167,6 +167,8 @@ qemu_plugin_vcpu_syscall(CPUState *cpu, int64_t num, ui= nt64_t a1, void qemu_plugin_vcpu_syscall_ret(CPUState *cpu, int64_t num, int64_t ret); =20 void qemu_plugin_vcpu_mem_cb(CPUState *cpu, uint64_t vaddr, + uint64_t value_low, + uint64_t value_high, MemOpIdx oi, enum qemu_plugin_mem_rw rw); =20 void qemu_plugin_flush_cb(void); @@ -251,6 +253,8 @@ void qemu_plugin_vcpu_syscall_ret(CPUState *cpu, int64_= t num, int64_t ret) { } =20 static inline void qemu_plugin_vcpu_mem_cb(CPUState *cpu, uint64_t vaddr, + uint64_t value_low, + uint64_t value_high, MemOpIdx oi, enum qemu_plugin_mem_rw rw) { } diff --git a/plugins/core.c b/plugins/core.c index 2897453cac..bb105e8e68 100644 --- a/plugins/core.c +++ b/plugins/core.c @@ -602,6 +602,8 @@ void exec_inline_op(enum plugin_dyn_cb_type type, } =20 void qemu_plugin_vcpu_mem_cb(CPUState *cpu, uint64_t vaddr, + uint64_t value_low, + uint64_t value_high, MemOpIdx oi, enum qemu_plugin_mem_rw rw) { GArray *arr =3D cpu->neg.plugin_mem_cbs; @@ -610,6 +612,10 @@ void qemu_plugin_vcpu_mem_cb(CPUState *cpu, uint64_t v= addr, if (arr =3D=3D NULL) { return; } + + cpu->neg.plugin_mem_value_low =3D value_low; + cpu->neg.plugin_mem_value_high =3D value_high; + for (i =3D 0; i < arr->len; i++) { struct qemu_plugin_dyn_cb *cb =3D &g_array_index(arr, struct qemu_plugin_dyn_cb, i); diff --git a/tcg/tcg-op-ldst.c b/tcg/tcg-op-ldst.c index 8510160258..23dc807f11 100644 --- a/tcg/tcg-op-ldst.c +++ b/tcg/tcg-op-ldst.c @@ -148,11 +148,11 @@ static TCGv_i64 plugin_maybe_preserve_addr(TCGTemp *a= ddr) return NULL; } =20 +#ifdef CONFIG_PLUGIN static void plugin_gen_mem_callbacks(TCGv_i64 copy_addr, TCGTemp *orig_addr, MemOpIdx = oi, enum qemu_plugin_mem_rw rw) { -#ifdef CONFIG_PLUGIN if (tcg_ctx->plugin_insn !=3D NULL) { qemu_plugin_meminfo_t info =3D make_plugin_meminfo(oi, rw); =20 @@ -172,6 +172,54 @@ plugin_gen_mem_callbacks(TCGv_i64 copy_addr, TCGTemp *= orig_addr, MemOpIdx oi, } } } +} +#endif + +static void +plugin_gen_mem_callbacks_i32(TCGv_i32 val, + TCGv_i64 copy_addr, TCGTemp *orig_addr, + MemOpIdx oi, enum qemu_plugin_mem_rw rw) +{ +#ifdef CONFIG_PLUGIN + if (tcg_ctx->plugin_insn !=3D NULL) { + tcg_gen_st_i32(val, tcg_env, + offsetof(CPUState, neg.plugin_mem_value_low) - + sizeof(CPUState) + (HOST_BIG_ENDIAN * 4)); + plugin_gen_mem_callbacks(copy_addr, orig_addr, oi, rw); + } +#endif +} + +static void +plugin_gen_mem_callbacks_i64(TCGv_i64 val, + TCGv_i64 copy_addr, TCGTemp *orig_addr, + MemOpIdx oi, enum qemu_plugin_mem_rw rw) +{ +#ifdef CONFIG_PLUGIN + if (tcg_ctx->plugin_insn !=3D NULL) { + tcg_gen_st_i64(val, tcg_env, + offsetof(CPUState, neg.plugin_mem_value_low) - + sizeof(CPUState)); + plugin_gen_mem_callbacks(copy_addr, orig_addr, oi, rw); + } +#endif +} + +static void +plugin_gen_mem_callbacks_i128(TCGv_i128 val, + TCGv_i64 copy_addr, TCGTemp *orig_addr, + MemOpIdx oi, enum qemu_plugin_mem_rw rw) +{ +#ifdef CONFIG_PLUGIN + if (tcg_ctx->plugin_insn !=3D NULL) { + tcg_gen_st_i64(TCGV128_LOW(val), tcg_env, + offsetof(CPUState, neg.plugin_mem_value_low) - + sizeof(CPUState)); + tcg_gen_st_i64(TCGV128_HIGH(val), tcg_env, + offsetof(CPUState, neg.plugin_mem_value_high) - + sizeof(CPUState)); + plugin_gen_mem_callbacks(copy_addr, orig_addr, oi, rw); + } #endif } =20 @@ -203,7 +251,8 @@ static void tcg_gen_qemu_ld_i32_int(TCGv_i32 val, TCGTe= mp *addr, opc =3D INDEX_op_qemu_ld_a64_i32; } gen_ldst(opc, tcgv_i32_temp(val), NULL, addr, oi); - plugin_gen_mem_callbacks(copy_addr, addr, orig_oi, QEMU_PLUGIN_MEM_R); + plugin_gen_mem_callbacks_i32(val, copy_addr, addr, orig_oi, + QEMU_PLUGIN_MEM_R); =20 if ((orig_memop ^ memop) & MO_BSWAP) { switch (orig_memop & MO_SIZE) { @@ -271,7 +320,7 @@ static void tcg_gen_qemu_st_i32_int(TCGv_i32 val, TCGTe= mp *addr, } } gen_ldst(opc, tcgv_i32_temp(val), NULL, addr, oi); - plugin_gen_mem_callbacks(NULL, addr, orig_oi, QEMU_PLUGIN_MEM_W); + plugin_gen_mem_callbacks_i32(val, NULL, addr, orig_oi, QEMU_PLUGIN_MEM= _W); =20 if (swap) { tcg_temp_free_i32(swap); @@ -324,7 +373,8 @@ static void tcg_gen_qemu_ld_i64_int(TCGv_i64 val, TCGTe= mp *addr, opc =3D INDEX_op_qemu_ld_a64_i64; } gen_ldst_i64(opc, val, addr, oi); - plugin_gen_mem_callbacks(copy_addr, addr, orig_oi, QEMU_PLUGIN_MEM_R); + plugin_gen_mem_callbacks_i64(val, copy_addr, addr, orig_oi, + QEMU_PLUGIN_MEM_R); =20 if ((orig_memop ^ memop) & MO_BSWAP) { int flags =3D (orig_memop & MO_SIGN @@ -396,7 +446,7 @@ static void tcg_gen_qemu_st_i64_int(TCGv_i64 val, TCGTe= mp *addr, opc =3D INDEX_op_qemu_st_a64_i64; } gen_ldst_i64(opc, val, addr, oi); - plugin_gen_mem_callbacks(NULL, addr, orig_oi, QEMU_PLUGIN_MEM_W); + plugin_gen_mem_callbacks_i64(val, NULL, addr, orig_oi, QEMU_PLUGIN_MEM= _W); =20 if (swap) { tcg_temp_free_i64(swap); @@ -606,7 +656,8 @@ static void tcg_gen_qemu_ld_i128_int(TCGv_i128 val, TCG= Temp *addr, tcg_constant_i32(orig_oi)); } =20 - plugin_gen_mem_callbacks(ext_addr, addr, orig_oi, QEMU_PLUGIN_MEM_R); + plugin_gen_mem_callbacks_i128(val, ext_addr, addr, orig_oi, + QEMU_PLUGIN_MEM_R); } =20 void tcg_gen_qemu_ld_i128_chk(TCGv_i128 val, TCGTemp *addr, TCGArg idx, @@ -722,7 +773,8 @@ static void tcg_gen_qemu_st_i128_int(TCGv_i128 val, TCG= Temp *addr, tcg_constant_i32(orig_oi)); } =20 - plugin_gen_mem_callbacks(ext_addr, addr, orig_oi, QEMU_PLUGIN_MEM_W); + plugin_gen_mem_callbacks_i128(val, ext_addr, addr, orig_oi, + QEMU_PLUGIN_MEM_W); } =20 void tcg_gen_qemu_st_i128_chk(TCGv_i128 val, TCGTemp *addr, TCGArg idx, diff --git a/accel/tcg/atomic_common.c.inc b/accel/tcg/atomic_common.c.inc index 95a5c5ff12..6056598c23 100644 --- a/accel/tcg/atomic_common.c.inc +++ b/accel/tcg/atomic_common.c.inc @@ -14,9 +14,20 @@ */ =20 static void atomic_trace_rmw_post(CPUArchState *env, uint64_t addr, + uint64_t read_value_low, + uint64_t read_value_high, + uint64_t write_value_low, + uint64_t write_value_high, MemOpIdx oi) { - qemu_plugin_vcpu_mem_cb(env_cpu(env), addr, oi, QEMU_PLUGIN_MEM_RW); + if (cpu_plugin_mem_cbs_enabled(env_cpu(env))) { + qemu_plugin_vcpu_mem_cb(env_cpu(env), addr, + read_value_low, read_value_high, + oi, QEMU_PLUGIN_MEM_R); + qemu_plugin_vcpu_mem_cb(env_cpu(env), addr, + write_value_low, write_value_high, + oi, QEMU_PLUGIN_MEM_W); + } } =20 /* diff --git a/accel/tcg/ldst_common.c.inc b/accel/tcg/ldst_common.c.inc index 87ceb95487..ebbf380d76 100644 --- a/accel/tcg/ldst_common.c.inc +++ b/accel/tcg/ldst_common.c.inc @@ -123,10 +123,15 @@ void helper_st_i128(CPUArchState *env, uint64_t addr,= Int128 val, MemOpIdx oi) * Load helpers for cpu_ldst.h */ =20 -static void plugin_load_cb(CPUArchState *env, abi_ptr addr, MemOpIdx oi) +static void plugin_load_cb(CPUArchState *env, abi_ptr addr, + uint64_t value_low, + uint64_t value_high, + MemOpIdx oi) { if (cpu_plugin_mem_cbs_enabled(env_cpu(env))) { - qemu_plugin_vcpu_mem_cb(env_cpu(env), addr, oi, QEMU_PLUGIN_MEM_R); + qemu_plugin_vcpu_mem_cb(env_cpu(env), addr, + value_low, value_high, + oi, QEMU_PLUGIN_MEM_R); } } =20 @@ -136,7 +141,7 @@ uint8_t cpu_ldb_mmu(CPUArchState *env, abi_ptr addr, Me= mOpIdx oi, uintptr_t ra) =20 tcg_debug_assert((get_memop(oi) & MO_SIZE) =3D=3D MO_UB); ret =3D do_ld1_mmu(env_cpu(env), addr, oi, ra, MMU_DATA_LOAD); - plugin_load_cb(env, addr, oi); + plugin_load_cb(env, addr, ret, 0, oi); return ret; } =20 @@ -147,7 +152,7 @@ uint16_t cpu_ldw_mmu(CPUArchState *env, abi_ptr addr, =20 tcg_debug_assert((get_memop(oi) & MO_SIZE) =3D=3D MO_16); ret =3D do_ld2_mmu(env_cpu(env), addr, oi, ra, MMU_DATA_LOAD); - plugin_load_cb(env, addr, oi); + plugin_load_cb(env, addr, ret, 0, oi); return ret; } =20 @@ -158,7 +163,7 @@ uint32_t cpu_ldl_mmu(CPUArchState *env, abi_ptr addr, =20 tcg_debug_assert((get_memop(oi) & MO_SIZE) =3D=3D MO_32); ret =3D do_ld4_mmu(env_cpu(env), addr, oi, ra, MMU_DATA_LOAD); - plugin_load_cb(env, addr, oi); + plugin_load_cb(env, addr, ret, 0, oi); return ret; } =20 @@ -169,7 +174,7 @@ uint64_t cpu_ldq_mmu(CPUArchState *env, abi_ptr addr, =20 tcg_debug_assert((get_memop(oi) & MO_SIZE) =3D=3D MO_64); ret =3D do_ld8_mmu(env_cpu(env), addr, oi, ra, MMU_DATA_LOAD); - plugin_load_cb(env, addr, oi); + plugin_load_cb(env, addr, ret, 0, oi); return ret; } =20 @@ -180,7 +185,7 @@ Int128 cpu_ld16_mmu(CPUArchState *env, abi_ptr addr, =20 tcg_debug_assert((get_memop(oi) & MO_SIZE) =3D=3D MO_128); ret =3D do_ld16_mmu(env_cpu(env), addr, oi, ra); - plugin_load_cb(env, addr, oi); + plugin_load_cb(env, addr, int128_getlo(ret), int128_gethi(ret), oi); return ret; } =20 @@ -188,10 +193,15 @@ Int128 cpu_ld16_mmu(CPUArchState *env, abi_ptr addr, * Store helpers for cpu_ldst.h */ =20 -static void plugin_store_cb(CPUArchState *env, abi_ptr addr, MemOpIdx oi) +static void plugin_store_cb(CPUArchState *env, abi_ptr addr, + uint64_t value_low, + uint64_t value_high, + MemOpIdx oi) { if (cpu_plugin_mem_cbs_enabled(env_cpu(env))) { - qemu_plugin_vcpu_mem_cb(env_cpu(env), addr, oi, QEMU_PLUGIN_MEM_W); + qemu_plugin_vcpu_mem_cb(env_cpu(env), addr, + value_low, value_high, + oi, QEMU_PLUGIN_MEM_W); } } =20 @@ -199,7 +209,7 @@ void cpu_stb_mmu(CPUArchState *env, abi_ptr addr, uint8= _t val, MemOpIdx oi, uintptr_t retaddr) { helper_stb_mmu(env, addr, val, oi, retaddr); - plugin_store_cb(env, addr, oi); + plugin_store_cb(env, addr, val, 0, oi); } =20 void cpu_stw_mmu(CPUArchState *env, abi_ptr addr, uint16_t val, @@ -207,7 +217,7 @@ void cpu_stw_mmu(CPUArchState *env, abi_ptr addr, uint1= 6_t val, { tcg_debug_assert((get_memop(oi) & MO_SIZE) =3D=3D MO_16); do_st2_mmu(env_cpu(env), addr, val, oi, retaddr); - plugin_store_cb(env, addr, oi); + plugin_store_cb(env, addr, val, 0, oi); } =20 void cpu_stl_mmu(CPUArchState *env, abi_ptr addr, uint32_t val, @@ -215,7 +225,7 @@ void cpu_stl_mmu(CPUArchState *env, abi_ptr addr, uint3= 2_t val, { tcg_debug_assert((get_memop(oi) & MO_SIZE) =3D=3D MO_32); do_st4_mmu(env_cpu(env), addr, val, oi, retaddr); - plugin_store_cb(env, addr, oi); + plugin_store_cb(env, addr, val, 0, oi); } =20 void cpu_stq_mmu(CPUArchState *env, abi_ptr addr, uint64_t val, @@ -223,7 +233,7 @@ void cpu_stq_mmu(CPUArchState *env, abi_ptr addr, uint6= 4_t val, { tcg_debug_assert((get_memop(oi) & MO_SIZE) =3D=3D MO_64); do_st8_mmu(env_cpu(env), addr, val, oi, retaddr); - plugin_store_cb(env, addr, oi); + plugin_store_cb(env, addr, val, 0, oi); } =20 void cpu_st16_mmu(CPUArchState *env, abi_ptr addr, Int128 val, @@ -231,7 +241,7 @@ void cpu_st16_mmu(CPUArchState *env, abi_ptr addr, Int1= 28 val, { tcg_debug_assert((get_memop(oi) & MO_SIZE) =3D=3D MO_128); do_st16_mmu(env_cpu(env), addr, val, oi, retaddr); - plugin_store_cb(env, addr, oi); + plugin_store_cb(env, addr, int128_getlo(val), int128_gethi(val), oi); } =20 /* --=20 2.39.2 From nobody Sun Nov 24 05:59:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1725977394; cv=none; d=zohomail.com; s=zohoarc; b=npRLAmYzsVJT9Hi/yl3xzAGfcEOs+1KxIj+v8w8EG8GYiOv7iUkRSLzpYxeag4twEM1WOzHJkoaCWnv54cDs1tXc3k0Kfts1vY8M9sB0uOSaqiau61pxaF2nWSiRiszo1Ulo114tzXZkNxFaousMlL4RpMhAm+Y/LSjZg9XvkV8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725977394; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=bg1S7MpqFLKynDQMTW/BgVqsjzz9T+4SZvu94a93bN0=; b=K/hiRnT76JZnr/ln/UFqlma4bADKcpCNhGGosnRulKz9JVw2aMH87jxhtj6b/vMvIDhMiRiIXP7XFMkNpeURhTSlI+zcvaz8ztDxPyAk53bmGJUs1521kri7ZjPiD2MKo39mDaUInMlPVTN04PSAAF/NmhKWBCX04cQ+YPpkj0c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1725977394816186.79808970202043; Tue, 10 Sep 2024 07:09:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1so1X5-00084S-HA; Tue, 10 Sep 2024 10:07:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1so1X4-0007y5-1U for qemu-devel@nongnu.org; Tue, 10 Sep 2024 10:07:50 -0400 Received: from mail-ed1-x52c.google.com ([2a00:1450:4864:20::52c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1so1X0-0006XY-Vd for qemu-devel@nongnu.org; Tue, 10 Sep 2024 10:07:49 -0400 Received: by mail-ed1-x52c.google.com with SMTP id 4fb4d7f45d1cf-5c26852af8fso7329944a12.2 for ; Tue, 10 Sep 2024 07:07:46 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c3ebd4696asm4311411a12.30.2024.09.10.07.07.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 07:07:42 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 31AEF633E6; Tue, 10 Sep 2024 15:07:35 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725977265; x=1726582065; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=bg1S7MpqFLKynDQMTW/BgVqsjzz9T+4SZvu94a93bN0=; b=OSGH31h3qkkw7RvVqoDEAkbUyqhE03bXYGqVfczno4PyMCbnuxxQ1lki3CBdB1VNHE ibErBbDaongY04CUvmp/GiJIwQHI/8eaxUOEBnRhszK9r+f8ekIe8Eg9xMbBiOyYvsHm Y7GQsWr02kKAtPHDjR54PqRC2AfwMX/fwhDgimXGeNdiBM1YwaVK1ZEcDXkyESWa+NiO 6pstBrUWTPfTARW3BPhjy9sSDBCe94qsWZbObnyA5ofodaiCIiV4ED1aS6whezrQIvuV 2hDbIbY4sjvpR1MFQe/ssMwa6MFZAzC7GcwKpr/3b8ifVSwjY9NgiTTZPyA1w4YHF4w0 kEAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725977265; x=1726582065; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bg1S7MpqFLKynDQMTW/BgVqsjzz9T+4SZvu94a93bN0=; b=l8q/9C1YEFAHIBT0V7KSkyNT4OUvGDwrEW6DJ/vqK6At0aWsSB89bHTxnj78GyBTqM c9C9pEIKPWFDvruqz5oudbY28zhdfaX0jHo6XZhOpRK73dF9yb2J72otNla7AR1yk+u6 0E7ABRSkI1o+QfhERNP1pkKPuPWHUcyakFllICqtR9Ixb23l62DtrHzXw1VeWUsyhceK 5/WsavFI+DI+l4TXvoMt+4QEyh3wGGYNKZarhsaW/CvePj3jcudEm4wDAN0tDPWCUDpA HugyQKa0dBsigygxep4mB0/355B6qKZdq7rWS8hQqyTA9jVaP4Ga2jrL1TMwwIohPTN0 p00g== X-Gm-Message-State: AOJu0YxcFSglYMuJLEHyZ/JPJnBhEO5h8abt2iXBpy9xBk7JzppGxxXX mV94MFukR4AvTeiDHteKXKuzj8ZW5DumR1OiTIgKON1LAw6VI+SLh7uElKy0CIY= X-Google-Smtp-Source: AGHT+IEi/0Wc0xg/L10zGHE+wHVRRGYGpIfWYPv8hdMQh0hn+pxd7BZD+gpJ3LXBwtWBKfSQIV8GYA== X-Received: by 2002:a05:6402:5109:b0:5c2:4d9f:61c with SMTP id 4fb4d7f45d1cf-5c3e9533614mr10178504a12.8.1725977265376; Tue, 10 Sep 2024 07:07:45 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Zhao Liu , Marcel Apfelbaum , Beraldo Leal , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Alexandre Iooss , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Pierrick Bouvier , Yanan Wang , Peter Maydell , Mahmoud Mandour , Thomas Huth , qemu-arm@nongnu.org, devel@lists.libvirt.org, Jiaxun Yang , Paolo Bonzini , Richard Henderson , Wainer dos Santos Moschetta , Xingtao Yao Subject: [PATCH 15/26] plugins: extend API to get latest memory value accessed Date: Tue, 10 Sep 2024 15:07:22 +0100 Message-Id: <20240910140733.4007719-16-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240910140733.4007719-1-alex.bennee@linaro.org> References: <20240910140733.4007719-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::52c; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-x52c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1725977396878116600 From: Pierrick Bouvier This value can be accessed only during a memory callback, using new qemu_plugin_mem_get_value function. Returned value can be extended when QEMU will support accesses wider than 128 bits. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1719 Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2152 Reviewed-by: Richard Henderson Reviewed-by: Xingtao Yao Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Pierrick Bouvier Message-Id: <20240724194708.1843704-3-pierrick.bouvier@linaro.org> Signed-off-by: Alex Benn=C3=A9e --- include/qemu/qemu-plugin.h | 32 ++++++++++++++++++++++++++++++++ plugins/api.c | 33 +++++++++++++++++++++++++++++++++ plugins/qemu-plugins.symbols | 1 + 3 files changed, 66 insertions(+) diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h index c71c705b69..649ce89815 100644 --- a/include/qemu/qemu-plugin.h +++ b/include/qemu/qemu-plugin.h @@ -262,6 +262,29 @@ enum qemu_plugin_mem_rw { QEMU_PLUGIN_MEM_RW, }; =20 +enum qemu_plugin_mem_value_type { + QEMU_PLUGIN_MEM_VALUE_U8, + QEMU_PLUGIN_MEM_VALUE_U16, + QEMU_PLUGIN_MEM_VALUE_U32, + QEMU_PLUGIN_MEM_VALUE_U64, + QEMU_PLUGIN_MEM_VALUE_U128, +}; + +/* typedef qemu_plugin_mem_value - value accessed during a load/store */ +typedef struct { + enum qemu_plugin_mem_value_type type; + union { + uint8_t u8; + uint16_t u16; + uint32_t u32; + uint64_t u64; + struct { + uint64_t low; + uint64_t high; + } u128; + } data; +} qemu_plugin_mem_value; + /** * enum qemu_plugin_cond - condition to enable callback * @@ -551,6 +574,15 @@ bool qemu_plugin_mem_is_big_endian(qemu_plugin_meminfo= _t info); QEMU_PLUGIN_API bool qemu_plugin_mem_is_store(qemu_plugin_meminfo_t info); =20 +/** + * qemu_plugin_mem_get_mem_value() - return last value loaded/stored + * @info: opaque memory transaction handle + * + * Returns: memory value + */ +QEMU_PLUGIN_API +qemu_plugin_mem_value qemu_plugin_mem_get_value(qemu_plugin_meminfo_t info= ); + /** * qemu_plugin_get_hwaddr() - return handle for memory operation * @info: opaque memory info structure diff --git a/plugins/api.c b/plugins/api.c index 2ff13d09de..3316d4a04d 100644 --- a/plugins/api.c +++ b/plugins/api.c @@ -351,6 +351,39 @@ bool qemu_plugin_mem_is_store(qemu_plugin_meminfo_t in= fo) return get_plugin_meminfo_rw(info) & QEMU_PLUGIN_MEM_W; } =20 +qemu_plugin_mem_value qemu_plugin_mem_get_value(qemu_plugin_meminfo_t info) +{ + uint64_t low =3D current_cpu->neg.plugin_mem_value_low; + qemu_plugin_mem_value value; + + switch (qemu_plugin_mem_size_shift(info)) { + case 0: + value.type =3D QEMU_PLUGIN_MEM_VALUE_U8; + value.data.u8 =3D (uint8_t)low; + break; + case 1: + value.type =3D QEMU_PLUGIN_MEM_VALUE_U16; + value.data.u16 =3D (uint16_t)low; + break; + case 2: + value.type =3D QEMU_PLUGIN_MEM_VALUE_U32; + value.data.u32 =3D (uint32_t)low; + break; + case 3: + value.type =3D QEMU_PLUGIN_MEM_VALUE_U64; + value.data.u64 =3D low; + break; + case 4: + value.type =3D QEMU_PLUGIN_MEM_VALUE_U128; + value.data.u128.low =3D low; + value.data.u128.high =3D current_cpu->neg.plugin_mem_value_high; + break; + default: + g_assert_not_reached(); + } + return value; +} + /* * Virtual Memory queries */ diff --git a/plugins/qemu-plugins.symbols b/plugins/qemu-plugins.symbols index ca773d8d9f..eed9d8abd9 100644 --- a/plugins/qemu-plugins.symbols +++ b/plugins/qemu-plugins.symbols @@ -13,6 +13,7 @@ qemu_plugin_insn_size; qemu_plugin_insn_symbol; qemu_plugin_insn_vaddr; + qemu_plugin_mem_get_value; qemu_plugin_mem_is_big_endian; qemu_plugin_mem_is_sign_extended; qemu_plugin_mem_is_store; --=20 2.39.2 From nobody Sun Nov 24 05:59:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1725977439; cv=none; d=zohomail.com; s=zohoarc; b=lJQweyaD0JZAEPwj6XvwnPIJvL5qA7LR7VasbCilSLmQ2e40NKWjoIE6lorKg1hXvfGENuPwlIZ8K3lWjysmBlWPBngHjPsbrfY5VN46wvskiPixRSMoyH7Hc7dsZ0s/wgYmAbFlv71QRSBViHDH1j3qk+IihzrrTdsxpdDl1X0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725977439; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ULpurcGomJFFFXGFveTbWvPTjZlX1tphSs0Gpvsy70s=; b=QGGKkObiGjtAiUmEQ9ESwJppfU28WfVRAhaLKKUS/8v7reIPiTBtzZ/9Y4HntMRaGqhsyWXYMrYluJEfkJAqu+YyUy5zRuylFBICrv0Y2FmsXkGG47xMSX/hf4zJevK2SM6ZOvMGO48gOAtMHIEV8+4zG5ctBMwjRfFZKoRMUTU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1725977439841326.12746138323485; Tue, 10 Sep 2024 07:10:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1so1X4-00080O-Mg; Tue, 10 Sep 2024 10:07:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1so1X2-0007sc-PN for qemu-devel@nongnu.org; Tue, 10 Sep 2024 10:07:48 -0400 Received: from mail-ed1-x52b.google.com ([2a00:1450:4864:20::52b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1so1X0-0006XO-Ti for qemu-devel@nongnu.org; Tue, 10 Sep 2024 10:07:48 -0400 Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-5c3ca32974fso6333829a12.3 for ; Tue, 10 Sep 2024 07:07:46 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c3ebd466dcsm4317560a12.24.2024.09.10.07.07.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 07:07:42 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 49394633F8; Tue, 10 Sep 2024 15:07:35 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725977265; x=1726582065; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ULpurcGomJFFFXGFveTbWvPTjZlX1tphSs0Gpvsy70s=; b=SRCXR3IHhnl+JZXbMBu9HjrxeOHFy2c6aenKD6QcZQX7gPeXouj5mXGVfFKg2FAvGS ptXT5+Rjy825IlO+5ewHUL0cesCe4CACCbvhA6jR6sfVza16n0MD8C6INmH8AjrwUT3+ nTyz15y29PKJZb7NlLL9MgRfREui+WI7ylv/PbA5B2b3gItblzM9KPMG633UQl0HvO4A or1pDSCMHO7pen5lfdIe7WEwsBVJXvh0wgSD9sEnAm+mJrCoxAlQfb7qrq8Ym2cxDbMy XoXLW6+/N6Wh6Bw0Tk2z8EbGqeMulFXvfBbl6Lzs1ozdEwUYxsQrzGAzRNXmoQEdAtFJ 8M/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725977265; x=1726582065; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ULpurcGomJFFFXGFveTbWvPTjZlX1tphSs0Gpvsy70s=; b=XsBpoKrsA4r4UpaVtCiJR3LzVZ8Pu3zNfNLY43+V7SwXvUXbDqWXjqp6oy0H7IouU5 n4q9YnEdqN78+7J6w3ty7BXMJxoeFBqW7MXlnHI7A7Tzhg6GyC4aueWbpyaWpMEV525J A1GpzK+MOrcOebB1j6Vy3vpxnA86ahiuIlKcziQarumZ5ScHu8UzVn5FKCisVSKwctzM TpG7MymXttIr52c7MyMOMXEFPgKCeOJt0U2PV4o+gegSop3o7M4OQhErf3ih4a0ONZ5+ v4r27I7A+Sy5ozw0kx4nVEEsYW4Ow0ek0Z0eekuH/BRYELQ0Pm8SrtjzlwI53NnhdlqF +Nrg== X-Gm-Message-State: AOJu0Yy5fl4tbXZXco6bO61/RDWaS1PCgglFegjGRkrEz/Czc7UXMhp4 XCRRO9tqCxPensHQhIFkuR2K+GvnnSX2a1PddViURvkrs/S4B5Bbsc1VnmKaXsc= X-Google-Smtp-Source: AGHT+IHYehEW5p/CsUsTqjaRfEvlPOLq1Z68qD+WjKXPatoYneJwmFjyKUkL3uODjj0Bn52xNprQDQ== X-Received: by 2002:a05:6402:40c7:b0:5c3:da92:495d with SMTP id 4fb4d7f45d1cf-5c3dc78008cmr8846555a12.3.1725977265063; Tue, 10 Sep 2024 07:07:45 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Zhao Liu , Marcel Apfelbaum , Beraldo Leal , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Alexandre Iooss , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Pierrick Bouvier , Yanan Wang , Peter Maydell , Mahmoud Mandour , Thomas Huth , qemu-arm@nongnu.org, devel@lists.libvirt.org, Jiaxun Yang , Paolo Bonzini , Richard Henderson , Wainer dos Santos Moschetta , Xingtao Yao Subject: [PATCH 16/26] tests/tcg: add mechanism to run specific tests with plugins Date: Tue, 10 Sep 2024 15:07:23 +0100 Message-Id: <20240910140733.4007719-17-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240910140733.4007719-1-alex.bennee@linaro.org> References: <20240910140733.4007719-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 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1725977441184116600 From: Pierrick Bouvier Only multiarch tests are run with plugins, and we want to be able to run per-arch test with plugins too. Tested-by: Xingtao Yao Reviewed-by: Richard Henderson Signed-off-by: Pierrick Bouvier Message-Id: <20240724194708.1843704-4-pierrick.bouvier@linaro.org> Signed-off-by: Alex Benn=C3=A9e --- tests/tcg/Makefile.target | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/tcg/Makefile.target b/tests/tcg/Makefile.target index 452a2cde65..c5b1c7a786 100644 --- a/tests/tcg/Makefile.target +++ b/tests/tcg/Makefile.target @@ -152,10 +152,11 @@ PLUGINS=3D$(patsubst %.c, lib%.so, $(notdir $(wildcar= d $(PLUGIN_SRC)/*.c))) # only expand MULTIARCH_TESTS which are common on most of our targets # to avoid an exponential explosion as new tests are added. We also # add some special helpers the run-plugin- rules can use below. +# In more, extra tests can be added using ADDITIONAL_PLUGINS_TESTS variabl= e. =20 ifneq ($(MULTIARCH_TESTS),) $(foreach p,$(PLUGINS), \ - $(foreach t,$(MULTIARCH_TESTS),\ + $(foreach t,$(MULTIARCH_TESTS) $(ADDITIONAL_PLUGINS_TESTS),\ $(eval run-plugin-$(t)-with-$(p): $t $p) \ $(eval RUN_TESTS+=3Drun-plugin-$(t)-with-$(p)))) endif # MULTIARCH_TESTS --=20 2.39.2 From nobody Sun Nov 24 05:59:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1725977533; cv=none; d=zohomail.com; s=zohoarc; b=SnjzCJvkWj0axsjXio5sOsUxjNtMD2ECLo6s4nLO53GhITo44L2sU+MpsrrZuYAAAEu9i9GdP91MZ5xwOUCjGHx/aCmdmHZdvmGnF7fKBbIH2QjCEcr678BGL1sHnV1LyQK/hKCftlx42JhyXzhz6O+/f1MvPeKbz9GoaEasTOI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725977533; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=XLtSiC/Qmy/Q/dtQX8Zk8sWvmopgnkSy4LkF7QeFpv4=; b=OH/L4Vpy126in4Y3elDygmNI8OVawfg2jEGIKStqVZ1ZmhbRZ5UZPMoyVM+7q8hdvPiapn/vNdspFH1bDgqkOPfmexs0eGW1/ES4o9E5BEVsAkfqdRclax8wFbjX7eDDG31nn72SHlRcr0U3FFmzXHKhkestRQT0gqcOxR1MKfM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1725977533938904.4956913316424; Tue, 10 Sep 2024 07:12:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1so1XA-0008Ri-BE; Tue, 10 Sep 2024 10:07:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1so1X6-00088h-I5 for qemu-devel@nongnu.org; Tue, 10 Sep 2024 10:07:52 -0400 Received: from mail-ej1-x62e.google.com ([2a00:1450:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1so1X4-0006ZB-1Z for qemu-devel@nongnu.org; Tue, 10 Sep 2024 10:07:52 -0400 Received: by mail-ej1-x62e.google.com with SMTP id a640c23a62f3a-a7a81bd549eso88146066b.3 for ; Tue, 10 Sep 2024 07:07:49 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d259267a6sm493257866b.51.2024.09.10.07.07.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 07:07:42 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 5F19763404; Tue, 10 Sep 2024 15:07:35 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725977268; x=1726582068; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=XLtSiC/Qmy/Q/dtQX8Zk8sWvmopgnkSy4LkF7QeFpv4=; b=Eo+YfplgzxTRJ6aaBfMkkRCHAW12mQEt5OuqKJoLpuxCBPqsyq7RaJSfVFg0oYbcei ZywLHNjIlbA8XtLrr1hj5l+1CSvvEqzS1muUO8kYHfIMTx4HdaIdOL6dIKfdAIYzNngh FwWzCZfphI4bTKGkksg0F+Szz89m/0+mn3ggYp83wa/zoCngdlxhruglKdiv/QrmO95P wfwm4H/hGXMLeZ762NAD5ot7rB5L38dyg+qd7cOUVapF3k9fyMu3vo3+J37lPB5hrRiB ahNAtGCRYClAl1If+rTM6Dj9lz1JxtA4Ld9eZIwTzezmsuKZ/8Zvmr6KctEG+ZbRJira hnfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725977268; x=1726582068; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XLtSiC/Qmy/Q/dtQX8Zk8sWvmopgnkSy4LkF7QeFpv4=; b=N/DvBj9/zQidrHDf4XfhE37dU7auT0v8CZxZ1zGWQjv8ejmey1sTL3QIEyIFo1VJVm aPUVKkhF4ZqJX8vDPL+WAfiAsO/Dr6AG6vmIiV/p7w7QcILpSo7OjwblyiSS+joRfXIj Yp8+v038TGOgbb2/+UEJdihLDqzVLtEEAAxgwRPM/ZhdUkKMSHTpTNdAw7LOD6VqxjKt DmdotY2r7lqUo0orWEKb3zO6OYEacVYjenQGL+weC2pUXLiI4oarnAORqO8Mw/Exlkyf 1E2ZgrX79QvHZgljOaRwcWcceGJM0kBQM/A0OPd0pgcrFRWTRWB1JhjSiCJRreESNpEB GW8w== X-Gm-Message-State: AOJu0YxghCHC3k5UgLuFR4cUd8rd9HfQmNXrqeLfkc3Vr5k7d2zhGpNH +BphG7CDLtwV8jwsdjQyKn6SCt6xfamyer6LDHAo5SJCKqydRsAHVumsfOQigMk= X-Google-Smtp-Source: AGHT+IEKAlTEXorwouZ2aDQpJWExbQ52iHDvEN1lztyi1+OuHEASvG3yXZUfcRMRclhGDZYJPhZswA== X-Received: by 2002:a17:907:72d1:b0:a8a:8d81:97b1 with SMTP id a640c23a62f3a-a8ffab92bf0mr96711966b.27.1725977268411; Tue, 10 Sep 2024 07:07:48 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Zhao Liu , Marcel Apfelbaum , Beraldo Leal , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Alexandre Iooss , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Pierrick Bouvier , Yanan Wang , Peter Maydell , Mahmoud Mandour , Thomas Huth , qemu-arm@nongnu.org, devel@lists.libvirt.org, Jiaxun Yang , Paolo Bonzini , Richard Henderson , Wainer dos Santos Moschetta , Xingtao Yao Subject: [PATCH 17/26] tests/tcg: allow to check output of plugins Date: Tue, 10 Sep 2024 15:07:24 +0100 Message-Id: <20240910140733.4007719-18-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240910140733.4007719-1-alex.bennee@linaro.org> References: <20240910140733.4007719-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::62e; envelope-from=alex.bennee@linaro.org; helo=mail-ej1-x62e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1725977535734116600 From: Pierrick Bouvier A specific plugin test can now read and check a plugin output, to ensure it contains expected values. Tested-by: Xingtao Yao Reviewed-by: Richard Henderson Signed-off-by: Pierrick Bouvier Message-Id: <20240724194708.1843704-5-pierrick.bouvier@linaro.org> Signed-off-by: Alex Benn=C3=A9e --- tests/tcg/Makefile.target | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/tcg/Makefile.target b/tests/tcg/Makefile.target index c5b1c7a786..2da70b2fcf 100644 --- a/tests/tcg/Makefile.target +++ b/tests/tcg/Makefile.target @@ -90,6 +90,7 @@ CFLAGS=3D LDFLAGS=3D =20 QEMU_OPTS=3D +CHECK_PLUGIN_OUTPUT_COMMAND=3D =20 =20 # If TCG debugging, or TCI is enabled things are a lot slower @@ -180,6 +181,10 @@ run-plugin-%: -plugin $(PLUGIN_LIB)/$(call extract-plugin,$@)$(PLUGIN_ARGS) \ -d plugin -D $*.pout \ $(call strip-plugin,$<)) + $(if $(CHECK_PLUGIN_OUTPUT_COMMAND), \ + $(call quiet-command, $(CHECK_PLUGIN_OUTPUT_COMMAND) $*.pout, \ + TEST, check plugin $(call extract-plugin,$@) output \ + with $(call strip-plugin,$<))) else run-%: % $(call run-test, $<, \ @@ -194,6 +199,10 @@ run-plugin-%: -plugin $(PLUGIN_LIB)/$(call extract-plugin,$@)$(PLUGIN_ARGS) \ -d plugin -D $*.pout \ $(QEMU_OPTS) $(call strip-plugin,$<)) + $(if $(CHECK_PLUGIN_OUTPUT_COMMAND), \ + $(call quiet-command, $(CHECK_PLUGIN_OUTPUT_COMMAND) $*.pout, \ + TEST, check plugin $(call extract-plugin,$@) output \ + with $(call strip-plugin,$<))) endif =20 gdb-%: % --=20 2.39.2 From nobody Sun Nov 24 05:59:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1725977346; cv=none; d=zohomail.com; s=zohoarc; b=ch8V2qzG3dBi6yUi8+DaVSSiILqrCKROkMi01a0evrtGFPnhgMMns7aeB3N4d6uMyA5ZOoIHAhyjv8lyhoL/0QvrNwuuuEQjFjT3mkpqA6nSDxIY7eG1zbIBNztd5A+XZnWgdRWTT92Eqa7j7z11o4HJG4yWmj95o7y2acFeu5U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725977346; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=tNcKpK3gqW5pd0AiX4NmCCbDvgLi1QOfUkQVya3+J3c=; b=bhkou+ry3HERb+voQ7Ls30sBMQ9ZQB0n6DfRZ87mxFxhahigk0coS7IGkpD28uzBZMZHvKUulsjbbN7Odl2mgWfL5pDz/4gma7PWH+DnGRATdW7GRoCzj75h14DtYTEwD9H4QuKrroW/YQtna8xzHb5LthWd+oSeh1VKMzwObcM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1725977346552839.4210160584081; Tue, 10 Sep 2024 07:09:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1so1XB-00005C-85; Tue, 10 Sep 2024 10:07:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1so1X8-0008GV-3C for qemu-devel@nongnu.org; Tue, 10 Sep 2024 10:07:54 -0400 Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1so1X4-0006ZO-O9 for qemu-devel@nongnu.org; Tue, 10 Sep 2024 10:07:53 -0400 Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-a8a897bd4f1so581114566b.3 for ; Tue, 10 Sep 2024 07:07:50 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25cea3e1sm482516466b.167.2024.09.10.07.07.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 07:07:42 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 74CEF5F7B4; Tue, 10 Sep 2024 15:07:35 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725977269; x=1726582069; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tNcKpK3gqW5pd0AiX4NmCCbDvgLi1QOfUkQVya3+J3c=; b=bwZPAxUOz8fDk0nuJ8Nw6Ziy6JJ2cUV5PLew3t4woDjflcUzSlB+GA+CJopn2JcNQV kdHmbdGq/YmfXPH08F3Iyymi6NOWvGPH6630p1F6a1I8DGy5XjeTp4KxkEBiJayWGMYj S4pfHwb+iZGokZEvTLBYJN6ALTaZP95Qp0F/7aTt+q7Jb4ng++IoixfDDFzGUZneHz9Z QCUNJjLGuIGGK3PoJvcar5nBc9vnT3mD0L7WX8bebBOVDf79DUndlYTYRpR6Ip+wU64l eenF5XtsuKC8MjjKiHSNtdN/fD97Kho9MGhj2bdIkact0X6JFS2Sn0gJrcVaXm62sM/Z 7jcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725977269; x=1726582069; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tNcKpK3gqW5pd0AiX4NmCCbDvgLi1QOfUkQVya3+J3c=; b=n+20q5rLKkGkm+yuGi0RX9wpd7WY+SA+eKfyvkKngzJAzJEzv+ASFN51aoNqfdGLZU zH2BaUMPIJjeSG+5AzdHukIdhHqRdY6oxE3/qBp1vmd/Tw0cgopwqCBWaMsocJNwoaLs aBTT+j1cCqsvfG0ljy0zU3YNp5JDKrXezKXDGM0B4VAIXQkHUKXnWaVPG0WppASfq+yA FZrJ/P2mm9WksR+7hVMRFQhUvHN+lfkeinat4hBs0TrY+jjJNiVa4gaGqA2GFnr1GagO MZwxC5C4i9NFa2gqh8XI18vZ3Zs+2getsAH3Ay8L/AC4pcuoxHnMABYfwKyY+SlzWH+B O+xw== X-Gm-Message-State: AOJu0YzIXrhnO03xMvIwugfQWR7IuKqtZQ202aEwtSIn50rVnNdrqpnX Dcj/iIfkiZpyu3R9Tbh/QOUfvMi+QUt3KQColH64W3Q5cik4TiWntwr02VqBNLM= X-Google-Smtp-Source: AGHT+IF0irRXfjqUTLP0ADVFD7/rZSWwKBMZaLQ/m4gUJjLt0sjcRBJLb/Iyj9rBZ5om/rHGXGJGDw== X-Received: by 2002:a17:907:2684:b0:a72:9d25:8ad3 with SMTP id a640c23a62f3a-a8ffaa93bc5mr95735566b.9.1725977268733; Tue, 10 Sep 2024 07:07:48 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Zhao Liu , Marcel Apfelbaum , Beraldo Leal , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Alexandre Iooss , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Pierrick Bouvier , Yanan Wang , Peter Maydell , Mahmoud Mandour , Thomas Huth , qemu-arm@nongnu.org, devel@lists.libvirt.org, Jiaxun Yang , Paolo Bonzini , Richard Henderson , Wainer dos Santos Moschetta , Xingtao Yao Subject: [PATCH 18/26] tests/plugin/mem: add option to print memory accesses Date: Tue, 10 Sep 2024 15:07:25 +0100 Message-Id: <20240910140733.4007719-19-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240910140733.4007719-1-alex.bennee@linaro.org> References: <20240910140733.4007719-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::630; envelope-from=alex.bennee@linaro.org; helo=mail-ej1-x630.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1725977348770116600 From: Pierrick Bouvier By using "print-accesses=3Dtrue" option, mem plugin will now print every value accessed, with associated size, type (store vs load), symbol, instruction address and phys/virt address accessed. Reviewed-by: Richard Henderson Reviewed-by: Xingtao Yao Signed-off-by: Pierrick Bouvier Message-Id: <20240724194708.1843704-6-pierrick.bouvier@linaro.org> Signed-off-by: Alex Benn=C3=A9e --- tests/tcg/plugins/mem.c | 69 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 68 insertions(+), 1 deletion(-) diff --git a/tests/tcg/plugins/mem.c b/tests/tcg/plugins/mem.c index b650dddcce..086e6f5bdf 100644 --- a/tests/tcg/plugins/mem.c +++ b/tests/tcg/plugins/mem.c @@ -21,10 +21,15 @@ typedef struct { uint64_t io_count; } CPUCount; =20 +typedef struct { + uint64_t vaddr; + const char *sym; +} InsnInfo; + static struct qemu_plugin_scoreboard *counts; static qemu_plugin_u64 mem_count; static qemu_plugin_u64 io_count; -static bool do_inline, do_callback; +static bool do_inline, do_callback, do_print_accesses; static bool do_haddr; static enum qemu_plugin_mem_rw rw =3D QEMU_PLUGIN_MEM_RW; =20 @@ -60,6 +65,44 @@ static void vcpu_mem(unsigned int cpu_index, qemu_plugin= _meminfo_t meminfo, } } =20 +static void print_access(unsigned int cpu_index, qemu_plugin_meminfo_t mem= info, + uint64_t vaddr, void *udata) +{ + InsnInfo *insn_info =3D udata; + unsigned size =3D 8 << qemu_plugin_mem_size_shift(meminfo); + const char *type =3D qemu_plugin_mem_is_store(meminfo) ? "store" : "lo= ad"; + qemu_plugin_mem_value value =3D qemu_plugin_mem_get_value(meminfo); + uint64_t hwaddr =3D + qemu_plugin_hwaddr_phys_addr(qemu_plugin_get_hwaddr(meminfo, vaddr= )); + g_autoptr(GString) out =3D g_string_new(""); + g_string_printf(out, + "0x%"PRIx64",%s,0x%"PRIx64",0x%"PRIx64",%d,%s,", + insn_info->vaddr, insn_info->sym, + vaddr, hwaddr, size, type); + switch (value.type) { + case QEMU_PLUGIN_MEM_VALUE_U8: + g_string_append_printf(out, "0x%02"PRIx8, value.data.u8); + break; + case QEMU_PLUGIN_MEM_VALUE_U16: + g_string_append_printf(out, "0x%04"PRIx16, value.data.u16); + break; + case QEMU_PLUGIN_MEM_VALUE_U32: + g_string_append_printf(out, "0x%08"PRIx32, value.data.u32); + break; + case QEMU_PLUGIN_MEM_VALUE_U64: + g_string_append_printf(out, "0x%016"PRIx64, value.data.u64); + break; + case QEMU_PLUGIN_MEM_VALUE_U128: + g_string_append_printf(out, "0x%016"PRIx64"%016"PRIx64, + value.data.u128.high, value.data.u128.low); + break; + default: + g_assert_not_reached(); + } + g_string_append_printf(out, "\n"); + qemu_plugin_outs(out->str); +} + static void vcpu_tb_trans(qemu_plugin_id_t id, struct qemu_plugin_tb *tb) { size_t n =3D qemu_plugin_tb_n_insns(tb); @@ -79,6 +122,16 @@ static void vcpu_tb_trans(qemu_plugin_id_t id, struct q= emu_plugin_tb *tb) QEMU_PLUGIN_CB_NO_REGS, rw, NULL); } + if (do_print_accesses) { + /* we leak this pointer, to avoid locking to keep track of it = */ + InsnInfo *insn_info =3D g_malloc(sizeof(InsnInfo)); + const char *sym =3D qemu_plugin_insn_symbol(insn); + insn_info->sym =3D sym ? sym : ""; + insn_info->vaddr =3D qemu_plugin_insn_vaddr(insn); + qemu_plugin_register_vcpu_mem_cb(insn, print_access, + QEMU_PLUGIN_CB_NO_REGS, + rw, (void *) insn_info); + } } } =20 @@ -117,6 +170,12 @@ QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin= _id_t id, fprintf(stderr, "boolean argument parsing failed: %s\n", o= pt); return -1; } + } else if (g_strcmp0(tokens[0], "print-accesses") =3D=3D 0) { + if (!qemu_plugin_bool_parse(tokens[0], tokens[1], + &do_print_accesses)) { + fprintf(stderr, "boolean argument parsing failed: %s\n", o= pt); + return -1; + } } else { fprintf(stderr, "option parsing failed: %s\n", opt); return -1; @@ -129,6 +188,14 @@ QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin= _id_t id, return -1; } =20 + if (do_print_accesses) { + g_autoptr(GString) out =3D g_string_new(""); + g_string_printf(out, + "insn_vaddr,insn_symbol,mem_vaddr,mem_hwaddr," + "access_size,access_type,mem_value\n"); + qemu_plugin_outs(out->str); + } + counts =3D qemu_plugin_scoreboard_new(sizeof(CPUCount)); mem_count =3D qemu_plugin_scoreboard_u64_in_struct( counts, CPUCount, mem_count); --=20 2.39.2 From nobody Sun Nov 24 05:59:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1725977673; cv=none; d=zohomail.com; s=zohoarc; b=XKeq1ibQQ/GTZrFdlvSNc7+wDNfqciGiNfaoNCVurDzeomRz3lII21XCSEQFGiXEAGkMwxABur5tSjfbFO9V4Bn+m6G0yWfMkCdqn7OUZ6oAotWdIcOtPpMUrWvnWCifHNEiCc02urFIGk56k/2guphePutRRfej1NKzMgTKUXw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725977673; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=uAf+CXUcolH9rKHrNsjwgZNqlQIpEkE3qYyXUtlw504=; b=Czq+8/9LxSlHVRbji5h44xidw58Ri9UHvf2rLOyIaK8PsniWKexH/Q2OgrU60My7EwqZTIX6dy9eswuGe8oVp6RawrH0iSKRgAj9SzhKneL/WCgA3i1gTQgkwdcJh7jvtxO4tlrI3q8noK3h5/LAV5K5MK8b3C7HpX6a+uEJx44= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1725977673369890.5167885610067; Tue, 10 Sep 2024 07:14:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1so1cw-0002H1-Id; Tue, 10 Sep 2024 10:13:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1so1cv-0002Bs-6S for qemu-devel@nongnu.org; Tue, 10 Sep 2024 10:13:53 -0400 Received: from mail-lf1-x131.google.com ([2a00:1450:4864:20::131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1so1ct-0007Sc-B1 for qemu-devel@nongnu.org; Tue, 10 Sep 2024 10:13:52 -0400 Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-535be093a43so1123330e87.3 for ; Tue, 10 Sep 2024 07:13:50 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c3ebd41cd7sm4339984a12.3.2024.09.10.07.13.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 07:13:47 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 8E34C6343F; Tue, 10 Sep 2024 15:07:35 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725977629; x=1726582429; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=uAf+CXUcolH9rKHrNsjwgZNqlQIpEkE3qYyXUtlw504=; b=N+7ZwCV1JFEhV8XpLvuinDGsFEYMkrw2eyWVxJek6Ds/pAGrUNddetSPeV8IBIDB0j BLSaG4SOBP0yJdiMqkAbH5TFPWC7DzOryVtgAx/vCGSRXyG+SfCzS+BCJsUSehA9oDHc o8usauivhOuYWaGdEFmqGIDa2Kq1Yjuoe6z2pbnWFb8oNJsVuk4SMgCxTdYDNblv2eIi HznJk6XXu0I3DeOq/jRN/t/5fHJZsfhpmfH5MVMvnBcvR13HCbHpztInx5nU2S+Js/k9 c+Q0xOnOseOZYkvtryvx+2dMmVY9arG7ns6lt/gHotXf4GfrFfpVrgSjhJgECjWzkbGX tHGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725977629; x=1726582429; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uAf+CXUcolH9rKHrNsjwgZNqlQIpEkE3qYyXUtlw504=; b=Uv2iXTakex5qa0jlCAbDE4eEV127DxCihltGQHgVUn25m7t/t2rqzV4TGj7q3lcLVx ztEGmZfKkINAuVl27iLCUTA5iOwXRqmUf+kL+6WP4DguJBC54UTHWI9NS7+JOX4v71mz OnmEcicij0mv3cKF06azTlML146Q+BrUF+zyK9JKBICiBYPv50WvW291apO+2/Fxxj/1 /v3eGRtOevheKDV0Cu0lMJLiLk2u2pnPv1PrkkEtH6+sNlvBVAsE2/foPqOfVfhAKIar QeFu6fUCLiq+rtGT+kGrpDuTTpVWohQCrvdGBSLhiWbJPXzSH4ZNSRyoBiBxuf0vSPe/ c8Yw== X-Gm-Message-State: AOJu0Yy4NuYldCshN+eqEec9sOLtfqa57w/j28jsfyimRsXHAYY2+08J BPlFv6po19MGu2F4ehpruEUJWSGTmkamEzpMF+Nk8M2wivnVlcGDMWsgVjqUoSY= X-Google-Smtp-Source: AGHT+IFZd/MkBN6yfcK/74xW1ec/RETc6+NIIFo9aML0rb0CZNrc+9Bg02E6fjsfmXTG4cp4UJtSrg== X-Received: by 2002:a05:6512:3b22:b0:536:545c:bbf6 with SMTP id 2adb3069b0e04-536587a3fb8mr9036141e87.1.1725977628420; Tue, 10 Sep 2024 07:13:48 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Zhao Liu , Marcel Apfelbaum , Beraldo Leal , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Alexandre Iooss , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Pierrick Bouvier , Yanan Wang , Peter Maydell , Mahmoud Mandour , Thomas Huth , qemu-arm@nongnu.org, devel@lists.libvirt.org, Jiaxun Yang , Paolo Bonzini , Richard Henderson , Wainer dos Santos Moschetta Subject: [PATCH 19/26] tests/tcg: clean up output of memory system test Date: Tue, 10 Sep 2024 15:07:26 +0100 Message-Id: <20240910140733.4007719-20-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240910140733.4007719-1-alex.bennee@linaro.org> References: <20240910140733.4007719-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::131; envelope-from=alex.bennee@linaro.org; helo=mail-lf1-x131.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1725977674273116600 This is useful information when debugging memory issues so lets improve by: - include the ptr address for u8 fills (like the others) - indicate the number of operations for reads and writes - explicitly note when we are flushing - move the fill printf to after the reset Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Pierrick Bouvier --- tests/tcg/multiarch/system/memory.c | 47 ++++++++++++++++++----------- 1 file changed, 29 insertions(+), 18 deletions(-) diff --git a/tests/tcg/multiarch/system/memory.c b/tests/tcg/multiarch/syst= em/memory.c index 6eb2eb16f7..8f2371975d 100644 --- a/tests/tcg/multiarch/system/memory.c +++ b/tests/tcg/multiarch/system/memory.c @@ -63,12 +63,14 @@ static void init_test_data_u8(int unused_offset) int i; (void)(unused_offset); =20 - ml_printf("Filling test area with u8:"); + ml_printf("Filling test area with u8 (%p):", ptr); + for (i =3D 0; i < TEST_SIZE; i++) { *ptr++ =3D BYTE_NEXT(count); pdot(i); } - ml_printf("done\n"); + + ml_printf("done %d @ %p\n", i, ptr); } =20 /* @@ -94,7 +96,7 @@ static void init_test_data_s8(bool neg_first) *ptr++ =3D get_byte(i, !neg_first); pdot(i); } - ml_printf("done\n"); + ml_printf("done %d @ %p\n", i * 2, ptr); } =20 /* @@ -105,9 +107,18 @@ static void reset_start_data(int offset) { uint32_t *ptr =3D (uint32_t *) &test_data[0]; int i; + + if (!offset) { + return; + } + + ml_printf("Flushing %d bytes from %p: ", offset, ptr); + for (i =3D 0; i < offset; i++) { *ptr++ =3D 0; } + + ml_printf("done %d @ %p\n", i, ptr); } =20 static void init_test_data_u16(int offset) @@ -117,17 +128,17 @@ static void init_test_data_u16(int offset) const int max =3D (TEST_SIZE - offset) / sizeof(word); int i; =20 - ml_printf("Filling test area with u16 (offset %d, %p):", offset, ptr); - reset_start_data(offset); =20 + ml_printf("Filling test area with u16 (offset %d, %p):", offset, ptr); + for (i =3D 0; i < max; i++) { uint16_t low =3D BYTE_NEXT(count), high =3D BYTE_NEXT(count); word =3D BYTE_SHIFT(high, 1) | BYTE_SHIFT(low, 0); *ptr++ =3D word; pdot(i); } - ml_printf("done @ %p\n", ptr); + ml_printf("done %d @ %p\n", i, ptr); } =20 static void init_test_data_u32(int offset) @@ -137,10 +148,10 @@ static void init_test_data_u32(int offset) const int max =3D (TEST_SIZE - offset) / sizeof(word); int i; =20 - ml_printf("Filling test area with u32 (offset %d, %p):", offset, ptr); - reset_start_data(offset); =20 + ml_printf("Filling test area with u32 (offset %d, %p):", offset, ptr); + for (i =3D 0; i < max; i++) { uint32_t b4 =3D BYTE_NEXT(count), b3 =3D BYTE_NEXT(count); uint32_t b2 =3D BYTE_NEXT(count), b1 =3D BYTE_NEXT(count); @@ -149,7 +160,7 @@ static void init_test_data_u32(int offset) *ptr++ =3D word; pdot(i); } - ml_printf("done @ %p\n", ptr); + ml_printf("done %d @ %p\n", i, ptr); } =20 static void init_test_data_u64(int offset) @@ -159,10 +170,10 @@ static void init_test_data_u64(int offset) const int max =3D (TEST_SIZE - offset) / sizeof(word); int i; =20 - ml_printf("Filling test area with u64 (offset %d, %p):", offset, ptr); - reset_start_data(offset); =20 + ml_printf("Filling test area with u64 (offset %d, %p):", offset, ptr); + for (i =3D 0; i < max; i++) { uint64_t b8 =3D BYTE_NEXT(count), b7 =3D BYTE_NEXT(count); uint64_t b6 =3D BYTE_NEXT(count), b5 =3D BYTE_NEXT(count); @@ -174,7 +185,7 @@ static void init_test_data_u64(int offset) *ptr++ =3D word; pdot(i); } - ml_printf("done @ %p\n", ptr); + ml_printf("done %d @ %p\n", i, ptr); } =20 static bool read_test_data_u16(int offset) @@ -198,7 +209,7 @@ static bool read_test_data_u16(int offset) } =20 } - ml_printf("done @ %p\n", ptr); + ml_printf("done %d @ %p\n", i, ptr); return true; } =20 @@ -239,7 +250,7 @@ static bool read_test_data_u32(int offset) pdot(i); } } - ml_printf("done @ %p\n", ptr); + ml_printf("done %d @ %p\n", i, ptr); return true; } =20 @@ -293,7 +304,7 @@ static bool read_test_data_u64(int offset) pdot(i); } } - ml_printf("done @ %p\n", ptr); + ml_printf("done %d @ %p\n", i, ptr); return true; } =20 @@ -365,7 +376,7 @@ static bool read_test_data_s8(int offset, bool neg_firs= t) return false; } } - ml_printf("done @ %p\n", ptr); + ml_printf("done %d @ %p\n", i * 2, ptr); return true; } =20 @@ -398,7 +409,7 @@ static bool read_test_data_s16(int offset, bool neg_fir= st) return false; } } - ml_printf("done @ %p\n", ptr); + ml_printf("done %d @ %p\n", i, ptr); return true; } =20 @@ -431,7 +442,7 @@ static bool read_test_data_s32(int offset, bool neg_fir= st) return false; } } - ml_printf("done @ %p\n", ptr); + ml_printf("done %d @ %p\n", i, ptr); return true; } =20 --=20 2.39.2 From nobody Sun Nov 24 05:59:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1725977706; cv=none; d=zohomail.com; s=zohoarc; b=BR5VZSkVtrfaKEMmFN1y2luellCsvuu0BvuFnXlJ988VcmzWHXzUmOnDKo205fer9jAc0C61b5qucF0y6DAHdx4RdbJ2rBmYVzzQYw8hlEuNY66aK7/4y2KJsmcTIZ4k8MZKYye/KwkHUSCOwcOQkmkcq+cLKnix9G9esqwlYoA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725977706; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=VkzJlS4txjflyKkh4CCHIuVaip6qn2yADs/S0X5KKR8=; b=UiVo3+bAWr8NFCVoLu7EJCoEt/XWKEtw4KwuQ0xzmu5iRVwlcKLO28bM4NERCgTadetdYRQtuK0dOUTLTOHKazYv9BZpZw1jZEF/ZBtRKJLhXG1grHJktgGDXy163lHlS6vYqp+llWzmgY1YZpFqqtAgBBRlZD13cb94vUCht34= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1725977706770567.4516496803631; Tue, 10 Sep 2024 07:15:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1so1d4-0003Cd-Pl; Tue, 10 Sep 2024 10:14:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1so1d2-0002xU-Ul for qemu-devel@nongnu.org; Tue, 10 Sep 2024 10:14:00 -0400 Received: from mail-ej1-x62b.google.com ([2a00:1450:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1so1d1-0007Vq-4r for qemu-devel@nongnu.org; Tue, 10 Sep 2024 10:14:00 -0400 Received: by mail-ej1-x62b.google.com with SMTP id a640c23a62f3a-a8d6ac24a3bso27825066b.1 for ; Tue, 10 Sep 2024 07:13:57 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d259c1fa3sm487925166b.80.2024.09.10.07.13.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 07:13:53 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id A628E63460; Tue, 10 Sep 2024 15:07:35 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725977636; x=1726582436; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=VkzJlS4txjflyKkh4CCHIuVaip6qn2yADs/S0X5KKR8=; b=RNKA/M8m4PM+OZSubSJ6YOY/OyokkKEotNLgR1Xs3kpZZyL/vpSvQ5oJkNp0/GaazA mLxjAj/cZr9t0q10f16VreTvNMc38j5lWUq78MfLjT0znKyde6zDqLFDHojtZeL40YU4 E5UJy+tfruWKVfxNV8EoAB/ivT7mi4SLk3N3YIVHYDAMXihD4Zx3Q3zkg52slLuHOGkA nUxlwRRLUVqOYAlyjvT9HeDtJGsliOO32wrTTHLSzDbzApYDptT1h2BbhNXKF+z5axQ1 QGmDZGSAapdyEaHTHunAe5cpj4hcsjPo8GUHDwDGTd0rUWflg1/WSB6388sH5hhbhzYF HbHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725977636; x=1726582436; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VkzJlS4txjflyKkh4CCHIuVaip6qn2yADs/S0X5KKR8=; b=fcMq2MdVy9+Vd6O8ySERtBUKwg4xXfKVTlJV+aD+YqXwdYSulwCOGhD9E6r7lUcqJy H/YSzxGE5gNe9ZWpeWCg5HbJ9B38A7PkrMQIRXjM+TQ479NCO8HMXmNkKbIdRVkMxrMG 412jHFhVJcdFaqRm9PzLpiHSHDnlHlDNHMWpQXbSUxLYEWLwf0tTDyLhqMVR1FLP7AWH Wlw3an6FDo2xLkEZN73eJ4KZ+bguWeJLtENlOJ5uLSZmyeorj137TPXzvC6REHwwJN5b nhvYklFjyhtmCIm5tN6KMz2+40p3M8FuUXHH1vSB4R9jr7gBIQSlOseL8Km5emjEQMWT 9iJQ== X-Gm-Message-State: AOJu0Yz6hG5igd1c2Ad/SJt026ADH/76jXBMfbtMseQK/I2F9VdhXxWR OxuhTXe0eSOyTV2kDgsCmChSuvAZJGBYgE6nCtF4hNmFcVBInYijp0UptKq/RNA= X-Google-Smtp-Source: AGHT+IF0n41cF7B1EFfMC4EoXC2MXohjR9xo5rsGQgQXXAcqKVCZIXQA9xUQ/GKhQak3g2247joROQ== X-Received: by 2002:a17:907:e291:b0:a8d:505a:5458 with SMTP id a640c23a62f3a-a8ffb20f42amr123827766b.10.1725977636389; Tue, 10 Sep 2024 07:13:56 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Zhao Liu , Marcel Apfelbaum , Beraldo Leal , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Alexandre Iooss , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Pierrick Bouvier , Yanan Wang , Peter Maydell , Mahmoud Mandour , Thomas Huth , qemu-arm@nongnu.org, devel@lists.libvirt.org, Jiaxun Yang , Paolo Bonzini , Richard Henderson , Wainer dos Santos Moschetta Subject: [PATCH 20/26] tests/tcg: only read/write 64 bit words on 64 bit systems Date: Tue, 10 Sep 2024 15:07:27 +0100 Message-Id: <20240910140733.4007719-21-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240910140733.4007719-1-alex.bennee@linaro.org> References: <20240910140733.4007719-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 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1725977708482116600 While the compilers will generally happily synthesise a 64 bit value for you on 32 bit systems it doesn't exercise anything on QEMU. It also makes it hard to accurately compare the accesses to test_data when instrumenting. Signed-off-by: Alex Benn=C3=A9e Reviewed-by: Pierrick Bouvier --- tests/tcg/multiarch/system/memory.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/tests/tcg/multiarch/system/memory.c b/tests/tcg/multiarch/syst= em/memory.c index 8f2371975d..680dd4800b 100644 --- a/tests/tcg/multiarch/system/memory.c +++ b/tests/tcg/multiarch/system/memory.c @@ -163,6 +163,7 @@ static void init_test_data_u32(int offset) ml_printf("done %d @ %p\n", i, ptr); } =20 +#if __SIZEOF_POINTER__ =3D=3D 8 static void init_test_data_u64(int offset) { uint8_t count =3D 0; @@ -187,6 +188,7 @@ static void init_test_data_u64(int offset) } ml_printf("done %d @ %p\n", i, ptr); } +#endif =20 static bool read_test_data_u16(int offset) { @@ -254,6 +256,7 @@ static bool read_test_data_u32(int offset) return true; } =20 +#if __SIZEOF_POINTER__ =3D=3D 8 static bool read_test_data_u64(int offset) { uint64_t word, *ptr =3D (uint64_t *)&test_data[offset]; @@ -307,11 +310,16 @@ static bool read_test_data_u64(int offset) ml_printf("done %d @ %p\n", i, ptr); return true; } +#endif =20 /* Read the test data and verify at various offsets */ -read_ufn read_ufns[] =3D { read_test_data_u16, - read_test_data_u32, - read_test_data_u64 }; +read_ufn read_ufns[] =3D { + read_test_data_u16, + read_test_data_u32, +#if __SIZEOF_POINTER__ =3D=3D 8 + read_test_data_u64 +#endif +}; =20 bool do_unsigned_reads(int start_off) { @@ -476,10 +484,14 @@ bool do_signed_reads(bool neg_first) return ok; } =20 -init_ufn init_ufns[] =3D { init_test_data_u8, - init_test_data_u16, - init_test_data_u32, - init_test_data_u64 }; +init_ufn init_ufns[] =3D { + init_test_data_u8, + init_test_data_u16, + init_test_data_u32, +#if __SIZEOF_POINTER__ =3D=3D 8 + init_test_data_u64 +#endif +}; =20 int main(void) { --=20 2.39.2 From nobody Sun Nov 24 05:59:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1725977689; cv=none; d=zohomail.com; s=zohoarc; b=l/nHBJZVM7KeV/sFomjxc7oPNFddDVxcaQfSxDERbU+gVT78lPoJOnVGpths4tGotadMUJBrsqMaBelo/LcyM1LhsRXlVSOvIdEPIdxMQvxILwBqYVu7eqanHffPxA4kH1C4Q4Um948eq9hCd7kgJ9O1ap+AqvSj2+SxgNyAkWM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725977689; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Zroaak8xFFAJBnGJiz25P6JCeHv1e5w1wtwssc9iSGg=; b=eI9QvnfbTHlXw8YDKmeTZ0dl88hobzLpJRWVR2MSZuaPBt27IWhtkEG1FEBSsbwPBsC95GcDrRb1vwxjZaNBL4Ip2EjvPs19sk+2aY0K2Ff6pWh0yaqwcbLzF+xRrXYhjTKWTQfzVuIz3Z+md3eywyZqxuP5pUag77fg5k/r5t0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1725977689980660.6015669103168; Tue, 10 Sep 2024 07:14:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1so1d3-00030i-I2; Tue, 10 Sep 2024 10:14:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1so1d1-0002jy-6J for qemu-devel@nongnu.org; Tue, 10 Sep 2024 10:13:59 -0400 Received: from mail-lj1-x22c.google.com ([2a00:1450:4864:20::22c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1so1cx-0007Ub-Qh for qemu-devel@nongnu.org; Tue, 10 Sep 2024 10:13:58 -0400 Received: by mail-lj1-x22c.google.com with SMTP id 38308e7fff4ca-2f029e9c9cfso1351701fa.2 for ; Tue, 10 Sep 2024 07:13:55 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d2597a660sm485506266b.75.2024.09.10.07.13.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 07:13:47 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id BF45F5F78C; Tue, 10 Sep 2024 15:07:35 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725977634; x=1726582434; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Zroaak8xFFAJBnGJiz25P6JCeHv1e5w1wtwssc9iSGg=; b=HhONXx0xTryf6DjGZNASbMK047t84N9O8UJKqZCuUYU19vA8j0NS8xF/tVVu5+SI5P R1QOJeTk0J6IQL3IJfYQTFd4f+U8a1bB5ZUKL/H/MviOEpBhp7uFaGG5/boe+DEY8F6v Hp9SkSjpimURxO8iHN8lmd+HLS4RFmTOXuhDmTPMJCnHzrNUttDqQZStEt3hTeCr5krC tM6DKh2Q7l5/m5V3VwZrhxDfcGF92CrhWIAFttVOjHR8mKC960suk2AXVbykLe31hKPw YfCjghMQo799RitKPgSUqR77UQa9E7VFk3Y2C676pBKCxhD7dkSBapWGQmHjrVEa4RTG 4K0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725977634; x=1726582434; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Zroaak8xFFAJBnGJiz25P6JCeHv1e5w1wtwssc9iSGg=; b=wOYan0oF/eMlZ86FAOVZLOP+kSZKuLl5wjBo3J41+uLv9YX7EcmW6hqzB+rXhYvnky INcOQL/uxsODGUEwJwyuVgW761S2BNmpHbZH9bIkraaKTrAIJxflW+V34kIXG5bCJR5V GjNch1RdfRGyVjRPb4ioq/nFj7Bi55zHxr+8kuXMYRFMb+0jNIRS67xkXkZRABBd2UhJ FYB2fZjWvvDEs0J4TM1e6vQWNdRZHd5P+ytl8MZI0szW5c3KUdNW9zRHJTlG2Vm69Foo 9y0GnBYQKbxaYEw7TSduVJfDsLXp2Bt8jFs/CdFkx+y1ZrTT4UWrX8OjfEisRwZur0gb dzfg== X-Gm-Message-State: AOJu0YxYlZKnLHuDm/vN5ZrNKvI7PlrNJ+kjyX0zZARybn3npkKgDJm9 bBuiWJizGWVeZk7AleJuKyiMnlzJUvWWg1atQFc83hfn09eiIPLq/guZZG4ziPo= X-Google-Smtp-Source: AGHT+IGsJkcb234kPMUwzZHCkiUcDRpmtSNvGnEqJULGzYtF86etGrETcfSgYxqk0A37XstmKdzd3g== X-Received: by 2002:a2e:b88a:0:b0:2ee:52f4:266 with SMTP id 38308e7fff4ca-2f75a96c43bmr108676401fa.3.1725977633258; Tue, 10 Sep 2024 07:13:53 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Zhao Liu , Marcel Apfelbaum , Beraldo Leal , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Alexandre Iooss , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Pierrick Bouvier , Yanan Wang , Peter Maydell , Mahmoud Mandour , Thomas Huth , qemu-arm@nongnu.org, devel@lists.libvirt.org, Jiaxun Yang , Paolo Bonzini , Richard Henderson , Wainer dos Santos Moschetta Subject: [PATCH 21/26] tests/tcg: add a system test to check memory instrumentation Date: Tue, 10 Sep 2024 15:07:28 +0100 Message-Id: <20240910140733.4007719-22-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240910140733.4007719-1-alex.bennee@linaro.org> References: <20240910140733.4007719-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::22c; envelope-from=alex.bennee@linaro.org; helo=mail-lj1-x22c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1725977690537116600 At first I thought I could compile the user-mode test for system mode however we already have a fairly comprehensive test case for system mode in "memory" so lets use that. First we extend the test to report where the test_data region is. Then we expand the pdot() function to track the total number of reads and writes to the region. We have to add some addition pdot() calls to take into account multiple reads/writes in the test loops. As tracking every access will quickly build up with "print-access" we add a new mode to track groups of reads and writes to regions. Because the test_data is page aligned we can be sure all accesses to it are ones we can count. Finally we add a python script to integrate the data from the plugin and the output of the test and validate they both agree on the total counts. Signed-off-by: Alex Benn=C3=A9e --- v2 - aggressively align test_data on "region size" - sort the regions in the final report - ensure alpha-softmmu uses byte access when it can --- tests/tcg/multiarch/system/memory.c | 50 +++-- tests/tcg/plugins/mem.c | 178 +++++++++++++++++- tests/tcg/alpha/Makefile.softmmu-target | 2 +- .../multiarch/system/Makefile.softmmu-target | 6 + .../system/validate-memory-counts.py | 115 +++++++++++ 5 files changed, 332 insertions(+), 19 deletions(-) create mode 100755 tests/tcg/multiarch/system/validate-memory-counts.py diff --git a/tests/tcg/multiarch/system/memory.c b/tests/tcg/multiarch/syst= em/memory.c index 680dd4800b..ccff699015 100644 --- a/tests/tcg/multiarch/system/memory.c +++ b/tests/tcg/multiarch/system/memory.c @@ -14,26 +14,35 @@ =20 #include #include +#include #include =20 #ifndef CHECK_UNALIGNED # error "Target does not specify CHECK_UNALIGNED" #endif =20 +uint32_t test_read_count; +uint32_t test_write_count; + #define MEM_PAGE_SIZE 4096 /* nominal 4k "pages" */ #define TEST_SIZE (MEM_PAGE_SIZE * 4) /* 4 pages */ =20 #define ARRAY_SIZE(x) ((sizeof(x) / sizeof((x)[0]))) =20 -__attribute__((aligned(MEM_PAGE_SIZE))) +__attribute__((aligned(TEST_SIZE))) static uint8_t test_data[TEST_SIZE]; =20 typedef void (*init_ufn) (int offset); typedef bool (*read_ufn) (int offset); typedef bool (*read_sfn) (int offset, bool nf); =20 -static void pdot(int count) +static void pdot(int count, bool write) { + if (write) { + test_write_count++; + } else { + test_read_count++; + } if (count % 128 =3D=3D 0) { ml_printf("."); } @@ -67,7 +76,7 @@ static void init_test_data_u8(int unused_offset) =20 for (i =3D 0; i < TEST_SIZE; i++) { *ptr++ =3D BYTE_NEXT(count); - pdot(i); + pdot(i, true); } =20 ml_printf("done %d @ %p\n", i, ptr); @@ -93,8 +102,9 @@ static void init_test_data_s8(bool neg_first) neg_first ? "neg first" : "pos first"); for (i =3D 0; i < TEST_SIZE / 2; i++) { *ptr++ =3D get_byte(i, neg_first); + pdot(i, true); *ptr++ =3D get_byte(i, !neg_first); - pdot(i); + pdot(i, true); } ml_printf("done %d @ %p\n", i * 2, ptr); } @@ -116,6 +126,7 @@ static void reset_start_data(int offset) =20 for (i =3D 0; i < offset; i++) { *ptr++ =3D 0; + pdot(i, true); } =20 ml_printf("done %d @ %p\n", i, ptr); @@ -136,7 +147,7 @@ static void init_test_data_u16(int offset) uint16_t low =3D BYTE_NEXT(count), high =3D BYTE_NEXT(count); word =3D BYTE_SHIFT(high, 1) | BYTE_SHIFT(low, 0); *ptr++ =3D word; - pdot(i); + pdot(i, true); } ml_printf("done %d @ %p\n", i, ptr); } @@ -158,7 +169,7 @@ static void init_test_data_u32(int offset) word =3D BYTE_SHIFT(b1, 3) | BYTE_SHIFT(b2, 2) | BYTE_SHIFT(b3, 1)= | BYTE_SHIFT(b4, 0); *ptr++ =3D word; - pdot(i); + pdot(i, true); } ml_printf("done %d @ %p\n", i, ptr); } @@ -184,7 +195,7 @@ static void init_test_data_u64(int offset) BYTE_SHIFT(b4, 4) | BYTE_SHIFT(b5, 3) | BYTE_SHIFT(b6, 2) | BYTE_SHIFT(b7, 1) | BYTE_SHIFT(b8, 0); *ptr++ =3D word; - pdot(i); + pdot(i, true); } ml_printf("done %d @ %p\n", i, ptr); } @@ -207,7 +218,7 @@ static bool read_test_data_u16(int offset) ml_printf("Error %d < %d\n", high, low); return false; } else { - pdot(i); + pdot(i, false); } =20 } @@ -249,7 +260,7 @@ static bool read_test_data_u32(int offset) ml_printf("Error %d, %d, %d, %d", b1, b2, b3, b4); return false; } else { - pdot(i); + pdot(i, false); } } ml_printf("done %d @ %p\n", i, ptr); @@ -304,7 +315,7 @@ static bool read_test_data_u64(int offset) b1, b2, b3, b4, b5, b6, b7, b8); return false; } else { - pdot(i); + pdot(i, false); } } ml_printf("done %d @ %p\n", i, ptr); @@ -376,9 +387,11 @@ static bool read_test_data_s8(int offset, bool neg_fir= st) second =3D *ptr++; =20 if (neg_first && first < 0 && second > 0) { - pdot(i); + pdot(i, false); + pdot(i, false); } else if (!neg_first && first > 0 && second < 0) { - pdot(i); + pdot(i, false); + pdot(i, false); } else { ml_printf("Error %d %c %d\n", first, neg_first ? '<' : '>', se= cond); return false; @@ -409,9 +422,9 @@ static bool read_test_data_s16(int offset, bool neg_fir= st) int32_t data =3D *ptr++; =20 if (neg_first && data < 0) { - pdot(i); + pdot(i, false); } else if (!neg_first && data > 0) { - pdot(i); + pdot(i, false); } else { ml_printf("Error %d %c 0\n", data, neg_first ? '<' : '>'); return false; @@ -442,9 +455,9 @@ static bool read_test_data_s32(int offset, bool neg_fir= st) int64_t data =3D *ptr++; =20 if (neg_first && data < 0) { - pdot(i); + pdot(i, false); } else if (!neg_first && data > 0) { - pdot(i); + pdot(i, false); } else { ml_printf("Error %d %c 0\n", data, neg_first ? '<' : '>'); return false; @@ -498,6 +511,9 @@ int main(void) int i; bool ok =3D true; =20 + ml_printf("Test data start: 0x%"PRIxPTR"\n", &test_data[0]); + ml_printf("Test data end: 0x%"PRIxPTR"\n", &test_data[TEST_SIZE]); + /* Run through the unsigned tests first */ for (i =3D 0; i < ARRAY_SIZE(init_ufns) && ok; i++) { ok =3D do_unsigned_test(init_ufns[i]); @@ -513,6 +529,8 @@ int main(void) ok =3D do_signed_reads(true); } =20 + ml_printf("Test data read: %"PRId32"\n", test_read_count); + ml_printf("Test data write: %"PRId32"\n", test_write_count); ml_printf("Test complete: %s\n", ok ? "PASSED" : "FAILED"); return ok ? 0 : -1; } diff --git a/tests/tcg/plugins/mem.c b/tests/tcg/plugins/mem.c index 086e6f5bdf..42d735d5c8 100644 --- a/tests/tcg/plugins/mem.c +++ b/tests/tcg/plugins/mem.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include =20 @@ -26,13 +27,46 @@ typedef struct { const char *sym; } InsnInfo; =20 +/* + * For the "memory" system test we need to track accesses to + * individual regions. We mirror the data written to the region and + * then check when it is read that it matches up. + * + * We do this as regions rather than pages to save on complications + * with page crossing and the fact the test only cares about the + * test_data region. + */ +static uint64_t region_size =3D 4096 * 4; +static uint64_t region_mask; + +typedef struct { + uint64_t region_address; + uint64_t reads; + uint64_t writes; + uint8_t *data; + bool seen_all; /* Did we see every write and read with correct va= lues? */ +} RegionInfo; + static struct qemu_plugin_scoreboard *counts; static qemu_plugin_u64 mem_count; static qemu_plugin_u64 io_count; -static bool do_inline, do_callback, do_print_accesses; +static bool do_inline, do_callback, do_print_accesses, do_region_summary; static bool do_haddr; static enum qemu_plugin_mem_rw rw =3D QEMU_PLUGIN_MEM_RW; =20 + +static GMutex lock; +static GHashTable *regions; + +static gint addr_order(gconstpointer a, gconstpointer b) +{ + RegionInfo *na =3D (RegionInfo *) a; + RegionInfo *nb =3D (RegionInfo *) b; + + return na->region_address > nb->region_address ? 1 : -1; +} + + static void plugin_exit(qemu_plugin_id_t id, void *p) { g_autoptr(GString) out =3D g_string_new(""); @@ -46,9 +80,129 @@ static void plugin_exit(qemu_plugin_id_t id, void *p) qemu_plugin_u64_sum(io_count)); } qemu_plugin_outs(out->str); + + + if (do_region_summary) { + GList *counts =3D g_hash_table_get_values(regions); + + counts =3D g_list_sort(counts, addr_order); + + g_string_printf(out, "Region Base, Reads, Writes, Seen all\n"); + + if (counts && g_list_next(counts)) { + for (/* counts */; counts->next; counts =3D counts->next) { + RegionInfo *ri =3D (RegionInfo *) counts->data; + + g_string_append_printf(out, + "0x%016"PRIx64", " + "%"PRId64", %"PRId64", %s\n", + ri->region_address, + ri->reads, + ri->writes, + ri->seen_all ? "true" : "false"); + } + } + qemu_plugin_outs(out->str); + } + qemu_plugin_scoreboard_free(counts); } =20 +/* + * Update the region tracking info for the access. We split up accesses + * that span regions even though the plugin infrastructure will deliver + * it as a single access. + */ +static void update_region_info(uint64_t region, uint64_t offset, + qemu_plugin_meminfo_t meminfo, + qemu_plugin_mem_value value, + unsigned size) +{ + bool be =3D qemu_plugin_mem_is_big_endian(meminfo); + bool is_store =3D qemu_plugin_mem_is_store(meminfo); + RegionInfo *ri; + bool unseen_data =3D false; + + g_assert(offset + size <=3D region_size); + + g_mutex_lock(&lock); + ri =3D (RegionInfo *) g_hash_table_lookup(regions, GUINT_TO_POINTER(re= gion)); + + if (!ri) { + ri =3D g_new0(RegionInfo, 1); + ri->region_address =3D region; + ri->data =3D g_malloc0(region_size); + ri->seen_all =3D true; + g_hash_table_insert(regions, GUINT_TO_POINTER(region), (gpointer) = ri); + } + + if (is_store) { + ri->writes++; + } else { + ri->reads++; + } + + switch (value.type) { + case QEMU_PLUGIN_MEM_VALUE_U8: + if (is_store) { + ri->data[offset] =3D value.data.u8; + } else if (ri->data[offset] !=3D value.data.u8) { + unseen_data =3D true; + } + break; + case QEMU_PLUGIN_MEM_VALUE_U16: + { + uint16_t *p =3D (uint16_t *) &ri->data[offset]; + if (is_store) { + *p =3D be ? be16toh(value.data.u16) : value.data.u16; + } else if (*p !=3D value.data.u16) { + unseen_data =3D true; + } + break; + } + case QEMU_PLUGIN_MEM_VALUE_U32: + { + uint32_t *p =3D (uint32_t *) &ri->data[offset]; + if (is_store) { + *p =3D be ? be32toh(value.data.u32) : value.data.u32; + } else if (*p !=3D value.data.u32) { + unseen_data =3D true; + } + break; + } + case QEMU_PLUGIN_MEM_VALUE_U64: + { + uint64_t *p =3D (uint64_t *) &ri->data[offset]; + if (is_store) { + *p =3D be ? be64toh(value.data.u64) : value.data.u64; + } else if (*p !=3D value.data.u64) { + unseen_data =3D true; + } + break; + } + case QEMU_PLUGIN_MEM_VALUE_U128: + /* skip */ + break; + default: + g_assert_not_reached(); + } + + /* + * This is expected for regions initialised by QEMU (.text etc) but we + * expect to see all data read and written to the test_data region + * of the memory test. + */ + if (unseen_data && ri->seen_all) { + g_autoptr(GString) error =3D g_string_new("Warning: "); + g_string_append_printf(error, "0x%016"PRIx64":%"PRId64" read an un= -instrumented value\n", + region, offset); + qemu_plugin_outs(error->str); + ri->seen_all =3D false; + } + + g_mutex_unlock(&lock); +} + static void vcpu_mem(unsigned int cpu_index, qemu_plugin_meminfo_t meminfo, uint64_t vaddr, void *udata) { @@ -63,6 +217,15 @@ static void vcpu_mem(unsigned int cpu_index, qemu_plugi= n_meminfo_t meminfo, } else { qemu_plugin_u64_add(mem_count, cpu_index, 1); } + + if (do_region_summary) { + uint64_t region =3D vaddr & ~region_mask; + uint64_t offset =3D vaddr & region_mask; + qemu_plugin_mem_value value =3D qemu_plugin_mem_get_value(meminfo); + unsigned size =3D 1 << qemu_plugin_mem_size_shift(meminfo); + + update_region_info(region, offset, meminfo, value, size); + } } =20 static void print_access(unsigned int cpu_index, qemu_plugin_meminfo_t mem= info, @@ -117,7 +280,7 @@ static void vcpu_tb_trans(qemu_plugin_id_t id, struct q= emu_plugin_tb *tb) QEMU_PLUGIN_INLINE_ADD_U64, mem_count, 1); } - if (do_callback) { + if (do_callback || do_region_summary) { qemu_plugin_register_vcpu_mem_cb(insn, vcpu_mem, QEMU_PLUGIN_CB_NO_REGS, rw, NULL); @@ -176,6 +339,12 @@ QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin= _id_t id, fprintf(stderr, "boolean argument parsing failed: %s\n", o= pt); return -1; } + } else if (g_strcmp0(tokens[0], "region-summary") =3D=3D 0) { + if (!qemu_plugin_bool_parse(tokens[0], tokens[1], + &do_region_summary)) { + fprintf(stderr, "boolean argument parsing failed: %s\n", o= pt); + return -1; + } } else { fprintf(stderr, "option parsing failed: %s\n", opt); return -1; @@ -196,6 +365,11 @@ QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin= _id_t id, qemu_plugin_outs(out->str); } =20 + if (do_region_summary) { + region_mask =3D (region_size - 1); + regions =3D g_hash_table_new(NULL, g_direct_equal); + } + counts =3D qemu_plugin_scoreboard_new(sizeof(CPUCount)); mem_count =3D qemu_plugin_scoreboard_u64_in_struct( counts, CPUCount, mem_count); diff --git a/tests/tcg/alpha/Makefile.softmmu-target b/tests/tcg/alpha/Make= file.softmmu-target index a0eca4d6ea..a944102a3c 100644 --- a/tests/tcg/alpha/Makefile.softmmu-target +++ b/tests/tcg/alpha/Makefile.softmmu-target @@ -28,7 +28,7 @@ LDFLAGS+=3D-static -nostdlib $(CRT_OBJS) $(MINILIB_OBJS) = -lgcc %: %.c $(LINK_SCRIPT) $(CRT_OBJS) $(MINILIB_OBJS) $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS) =20 -memory: CFLAGS+=3D-DCHECK_UNALIGNED=3D0 +memory: CFLAGS+=3D-DCHECK_UNALIGNED=3D0 -mbwx =20 # Running QEMU_OPTS+=3D-serial chardev:output -kernel diff --git a/tests/tcg/multiarch/system/Makefile.softmmu-target b/tests/tcg= /multiarch/system/Makefile.softmmu-target index 32dc0f9830..07be001102 100644 --- a/tests/tcg/multiarch/system/Makefile.softmmu-target +++ b/tests/tcg/multiarch/system/Makefile.softmmu-target @@ -65,3 +65,9 @@ endif =20 MULTIARCH_RUNS +=3D run-gdbstub-memory run-gdbstub-interrupt \ run-gdbstub-untimely-packet run-gdbstub-registers + +# Test plugin memory access instrumentation +run-plugin-memory-with-libmem.so: \ + PLUGIN_ARGS=3D$(COMMA)region-summary=3Dtrue +run-plugin-memory-with-libmem.so: \ + CHECK_PLUGIN_OUTPUT_COMMAND=3D$(MULTIARCH_SYSTEM_SRC)/validate-memory-cou= nts.py $@.out diff --git a/tests/tcg/multiarch/system/validate-memory-counts.py b/tests/t= cg/multiarch/system/validate-memory-counts.py new file mode 100755 index 0000000000..16c2788384 --- /dev/null +++ b/tests/tcg/multiarch/system/validate-memory-counts.py @@ -0,0 +1,115 @@ +#!/usr/bin/env python3 +# +# validate-memory-counts.py: check we instrumented memory properly +# +# This program takes two inputs: +# - the mem plugin output +# - the memory binary output +# +# Copyright (C) 2024 Linaro Ltd +# +# SPDX-License-Identifier: GPL-2.0-or-later + +import sys + +def extract_counts(path): + """ + Load the output from path and extract the lines containing: + + Test data start: 0x40214000 + Test data end: 0x40218001 + Test data read: 2522280 + Test data write: 262111 + + From the stream of data. Extract the values for use in the + validation function. + """ + start_address =3D None + end_address =3D None + read_count =3D 0 + write_count =3D 0 + with open(path, 'r') as f: + for line in f: + if line.startswith("Test data start:"): + start_address =3D int(line.split(':')[1].strip(), 16) + elif line.startswith("Test data end:"): + end_address =3D int(line.split(':')[1].strip(), 16) + elif line.startswith("Test data read:"): + read_count =3D int(line.split(':')[1].strip()) + elif line.startswith("Test data write:"): + write_count =3D int(line.split(':')[1].strip()) + return start_address, end_address, read_count, write_count + + +def parse_plugin_output(path, start, end): + """ + Load the plugin output from path in the form of: + + Region Base, Reads, Writes, Seen all + 0x0000000040004000, 31093, 0, false + 0x0000000040214000, 2522280, 278579, true + 0x0000000040000000, 137398, 0, false + 0x0000000040210000, 54727397, 33721956, false + + And extract the ranges that match test data start and end and + return the results. + """ + total_reads =3D 0 + total_writes =3D 0 + seen_all =3D False + + with open(path, 'r') as f: + next(f) # Skip the header + for line in f: + + if line.startswith("Region Base"): + continue + + parts =3D line.strip().split(', ') + if len(parts) !=3D 4: + continue + + region_base =3D int(parts[0], 16) + reads =3D int(parts[1]) + writes =3D int(parts[2]) + + if start <=3D region_base < end: # Checking if within range + total_reads +=3D reads + total_writes +=3D writes + seen_all =3D parts[3] =3D=3D "true" + + return total_reads, total_writes, seen_all + +def main(): + if len(sys.argv) !=3D 3: + print("Usage: .py ") + sys.exit(1) + + memory_binary_output_path =3D sys.argv[1] + mem_plugin_output_path =3D sys.argv[2] + + # Extract counts from memory binary + start, end, expected_reads, expected_writes =3D extract_counts(memory_= binary_output_path) + + if start is None or end is None: + print("Failed to extract start or end address from memory binary o= utput.") + sys.exit(1) + + # Parse plugin output + actual_reads, actual_writes, seen_all =3D parse_plugin_output(mem_plug= in_output_path, start, end) + + if not seen_all: + print("Fail: didn't instrument all accesses to test_data.") + sys.exit(1) + + # Compare and report + if actual_reads =3D=3D expected_reads and actual_writes =3D=3D expecte= d_writes: + sys.exit(0) + else: + print("Fail: The memory reads and writes count does not match.") + print(f"Expected Reads: {expected_reads}, Actual Reads: {actual_re= ads}") + print(f"Expected Writes: {expected_writes}, Actual Writes: {actual= _writes}") + sys.exit(1) + +if __name__ =3D=3D "__main__": + main() --=20 2.39.2 From nobody Sun Nov 24 05:59:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1725977701; cv=none; d=zohomail.com; s=zohoarc; b=Uyff+vyCNZU4T5YE0HRSKy5fMe7j4SViHugZTyJtzZCt9xvnWb/S3gkyhf45Nai9YiKyDt9XU+WbdsBoBg6FBIWigJPEpCz92J9mgrqF8lctW3gHwH3AosbqKR4ePHnRNxCdMKJFbgYgm+QyEwF70Lwhop1KGV5VOKgEFbluyq0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725977701; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=cRFhj2SyvQ/EIwHMRij/KsWIl6x9+a8v4XWFbD+c1P0=; b=fN1bMSlBsEUbAYiA4JWhoeCtWjtvUYysa5sk293hj4xyF8alDzpaN8CvieAtGcV8VWUypK3XcJr8yoKzlz6eJgCDNnizr1ReyRxaTHpATYJX//0OdfA7gRErTKP/FKJV4Ujv6eiMV6Mo5aKjk0yxbeD8ey6Tby7DL52yTUIw/G4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1725977701101654.5047352321199; Tue, 10 Sep 2024 07:15:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1so1d2-0002t8-CI; Tue, 10 Sep 2024 10:14:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1so1d1-0002mZ-HG for qemu-devel@nongnu.org; Tue, 10 Sep 2024 10:13:59 -0400 Received: from mail-ed1-x52d.google.com ([2a00:1450:4864:20::52d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1so1cz-0007Vl-Qu for qemu-devel@nongnu.org; Tue, 10 Sep 2024 10:13:59 -0400 Received: by mail-ed1-x52d.google.com with SMTP id 4fb4d7f45d1cf-5c40942358eso746300a12.1 for ; Tue, 10 Sep 2024 07:13:57 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c3ebd46909sm4504892a12.25.2024.09.10.07.13.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 07:13:53 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id D603D6349A; Tue, 10 Sep 2024 15:07:35 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725977636; x=1726582436; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=cRFhj2SyvQ/EIwHMRij/KsWIl6x9+a8v4XWFbD+c1P0=; b=KgandcclTTA7JUISr/s1Py/KBi6AnHZW5BEsTRWNbdoLy7oH9i6AlrQVkZ+7Yv/C5T Vx0pTHxifAvl1AGCleEuBvGCyqjN5GGLixvJGHii37LNTcsy4jJEN0ZGSHizTCJe2IHa P0SgdOOeXpVF5Z/bpDI2AnqTPNBWfFIkACq+YJ/rDpKZ5D89sV/sRRJ8uGemJozmBaAK 6U/HQmEbUmqSTpdfaz1ILRngrjkZAIih4K0CgP50MFvVDW8U1IVBiiryAK1fXi+W1QzW NXQaD2YNay0LWaIczfuB+gmqj5nKS6vZTurleTkhbvoQSvwd8e1Q0pmSUKVUv7TODPvX en+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725977636; x=1726582436; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cRFhj2SyvQ/EIwHMRij/KsWIl6x9+a8v4XWFbD+c1P0=; b=m70t36B+ciFW0KkxBjVBKmZcJOFF3rvOc7qJzIWEjtH1ObFemWD/0xEIY/Sjb2b3BY KlBSeFsRRoGgVdry1hIjmvdzZTL4jqz2Qlq+vIo7Jzw7yZKV4C82DvB2chEFpeRcnnsM npAUvajMgb7foL0DMmLmNzJHcTxur45nSravBHGN5vofjoF10/olWV9Kir6m6nnuX3ke 1DOFgSKALWieS1HSofwRfvmauF7gxk1DWajicKRUq/rhLfYAm7MgvPXQRGxTxgjW8Cvf MBXC/j4xBzESpDayriZ0i+tYbuS89i8+LrCvvu/iZBQhL4xiJiOgpkUJ1GuxnrG4fSSB REzg== X-Gm-Message-State: AOJu0Yxx++ifEUspsYiWJw3W4qZfyRM+8Xy/VgyoZKIoOivdjPAYvqWJ RbRcMttR4Lr350aVUfEc3LtO9xoKD3jMIk19o0RxeozqvOqlee9U687Qxpcy52I= X-Google-Smtp-Source: AGHT+IGqyOALW4jSP1JBXx3YmjSCxwI7FGeD6xXprKRUMj5B+BRwN5RJL9njKC53FVAO2Otc50xf4Q== X-Received: by 2002:a05:6402:3596:b0:5c0:c559:ad6 with SMTP id 4fb4d7f45d1cf-5c4015df1d1mr3218510a12.6.1725977635809; Tue, 10 Sep 2024 07:13:55 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Zhao Liu , Marcel Apfelbaum , Beraldo Leal , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Alexandre Iooss , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Pierrick Bouvier , Yanan Wang , Peter Maydell , Mahmoud Mandour , Thomas Huth , qemu-arm@nongnu.org, devel@lists.libvirt.org, Jiaxun Yang , Paolo Bonzini , Richard Henderson , Wainer dos Santos Moschetta , Elisha Hollander Subject: [PATCH 22/26] util/timer: avoid deadlock when shutting down Date: Tue, 10 Sep 2024 15:07:29 +0100 Message-Id: <20240910140733.4007719-23-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240910140733.4007719-1-alex.bennee@linaro.org> References: <20240910140733.4007719-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::52d; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-x52d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1725977702416116600 When we shut down a guest we disable the timers. However this can cause deadlock if the guest has queued some async work that is trying to advance system time and spins forever trying to wind time forward. Pay attention to the return code and bail early if we can't wind time forward. Signed-off-by: Alex Benn=C3=A9e Reported-by: Elisha Hollander --- util/qemu-timer.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/util/qemu-timer.c b/util/qemu-timer.c index 213114be68..6b1533bc2a 100644 --- a/util/qemu-timer.c +++ b/util/qemu-timer.c @@ -685,10 +685,17 @@ int64_t qemu_clock_advance_virtual_time(int64_t dest) { int64_t clock =3D qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); AioContext *aio_context; + int64_t deadline; + aio_context =3D qemu_get_aio_context(); - while (clock < dest) { - int64_t deadline =3D qemu_clock_deadline_ns_all(QEMU_CLOCK_VIRTUAL, + + deadline =3D qemu_clock_deadline_ns_all(QEMU_CLOCK_VIRTUAL, QEMU_TIMER_ATTR_ALL); + /* + * A deadline of < 0 indicates this timer is not enabled, so we + * won't get far trying to run it forward. + */ + while (deadline >=3D 0 && clock < dest) { int64_t warp =3D qemu_soonest_timeout(dest - clock, deadline); =20 qemu_virtual_clock_set_ns(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + = warp); @@ -696,6 +703,9 @@ int64_t qemu_clock_advance_virtual_time(int64_t dest) qemu_clock_run_timers(QEMU_CLOCK_VIRTUAL); timerlist_run_timers(aio_context->tlg.tl[QEMU_CLOCK_VIRTUAL]); clock =3D qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); + + deadline =3D qemu_clock_deadline_ns_all(QEMU_CLOCK_VIRTUAL, + QEMU_TIMER_ATTR_ALL); } qemu_clock_notify(QEMU_CLOCK_VIRTUAL); =20 --=20 2.39.2 From nobody Sun Nov 24 05:59:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1725977687; cv=none; d=zohomail.com; s=zohoarc; b=lLj/9lABvLrICsMOuz33lwXIoQC4gosytPuNs4aKukHoApJlgzQWC+9T0ZpRqBi8tRkFChprsoc510uttiGqKy1IsCRPfMJkRy9VJoR/SHgMRGPYKw10qz12UTNFPBQ6K6aUZ1ZjYYCern4UQC+8uwGiT/3U/8lk4Eyu8aKd0Q4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725977687; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=S6DKrSbtb2UyOkFJWx3GO7dDs+1RREyLEnRKm6VRifM=; b=j0JPi/E5hN6yt3u3MG6RF88n1rmvkffmC2EpOUX1I4lPMVq9RB0mqvd5u722GWBd8tUMV6BUcInASVLoXLkqj7rQ8owDDSkiO/DvGKGmZVoNdkHoP4Yb9N/dpUmUplR+UaEL2iBiKi1r6SOyLHmnZzow9w99CVDAm/BsdWVrcwE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1725977687476855.4984231144736; Tue, 10 Sep 2024 07:14:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1so1d1-0002o5-OI; Tue, 10 Sep 2024 10:13:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1so1cy-0002R2-MX for qemu-devel@nongnu.org; Tue, 10 Sep 2024 10:13:56 -0400 Received: from mail-ed1-x52e.google.com ([2a00:1450:4864:20::52e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1so1ct-0007Sx-Oc for qemu-devel@nongnu.org; Tue, 10 Sep 2024 10:13:56 -0400 Received: by mail-ed1-x52e.google.com with SMTP id 4fb4d7f45d1cf-5c26852aff1so6524861a12.3 for ; Tue, 10 Sep 2024 07:13:51 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c3ebce3448sm4368461a12.0.2024.09.10.07.13.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 07:13:47 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id F2C9D634A2; Tue, 10 Sep 2024 15:07:35 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725977630; x=1726582430; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=S6DKrSbtb2UyOkFJWx3GO7dDs+1RREyLEnRKm6VRifM=; b=HJo7h8k0x5t/aNeCB1FTtjSocQHCZPj/t0EPjE+nzCfyc4Unvc6TIIJxGzfeHva++w aRcAow/vyzbuD60usyl8eyiR/Htp9iyFgVJNLiOIfwO6WIBoGfqzlHXlwFVRj3mc7cmg RCDeKO0uPm//yjn7+236/6g9FQzPTFlEp9k2Cf7WjKDUGdQXhH/G6y0+Ccty8wHP65sJ puGyho5ZspAEjiyWJfYrm57qAKRTU7Mzml+Sg8XNKhQEZK8t6ssJ8n2+wFAoe2/hpG7q HMKgoyDXcYK/516IZ11c+rISmvdNewjXugSxCShvPZhGnKvRcLAM2ZYc7xZ8lyI8LMW+ +p0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725977630; x=1726582430; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=S6DKrSbtb2UyOkFJWx3GO7dDs+1RREyLEnRKm6VRifM=; b=QbANkH72XSbr7akU3gz2VCIj5wCOfCV0Qf1EFqzjqq0qcKVv/4la3ROrfS8w+RX9R6 wFsf/zZAbz2oXgZa7LNpTVEwg0slXoaodokJTHucQ2eeDVKyJM9VlRu0uppTCQ9ZfKNV flYhywR/+JDG+ncvANxYfRdrYf3SdzZWzFuL97G0tELm1qvX+bNbIkBQh7v1ruRvhM2f byts6ItQnoOePhTU4YWZkT+BdYBm2fSpeFlRzkRUbO9jIdXkQEd7khA0Fc3DpgoDmJ2S mLpvwRcEnFLXMVUaC6/iFy2c7oPGgP/v3MprDX7xydbUS7omC6f4/oGU2YibLsx99r3a VtxQ== X-Gm-Message-State: AOJu0Yyhk4Jccuwfz3dHfygi3TkpVqo5Op2DeXMhRGDs5JkSoPN9eUoW 8OUoHYxe9La4tL12C+x/Bs41ThNSq2Acn85AsM48WyzP1YZeeiyj04pSCjRyHuE= X-Google-Smtp-Source: AGHT+IF5KrELJLIlD3YioUixACIgWYs8AgZ0uiRx0KCPrBRDFcGJOhZt0fYSh0pG54+TAZBbX9ottw== X-Received: by 2002:a05:6402:4015:b0:5c3:cd88:a0a with SMTP id 4fb4d7f45d1cf-5c3e963621dmr9118972a12.18.1725977629785; Tue, 10 Sep 2024 07:13:49 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Zhao Liu , Marcel Apfelbaum , Beraldo Leal , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Alexandre Iooss , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Pierrick Bouvier , Yanan Wang , Peter Maydell , Mahmoud Mandour , Thomas Huth , qemu-arm@nongnu.org, devel@lists.libvirt.org, Jiaxun Yang , Paolo Bonzini , Richard Henderson , Wainer dos Santos Moschetta , Akihiko Odaki , Yotaro Nada Subject: [PATCH 23/26] contrib/plugins: Add a plugin to generate basic block vectors Date: Tue, 10 Sep 2024 15:07:30 +0100 Message-Id: <20240910140733.4007719-24-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240910140733.4007719-1-alex.bennee@linaro.org> References: <20240910140733.4007719-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::52e; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-x52e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1725977688386116600 From: Akihiko Odaki SimPoint is a widely used tool to find the ideal microarchitecture simulation points so Valgrind[2] and Pin[3] support generating basic block vectors for use with them. Let's add a corresponding plugin to QEMU too. Note that this plugin has a different goal with tests/plugin/bb.c. This plugin creates a vector for each constant interval instead of counting the execution of basic blocks for the entire run and able to describe the change of execution behavior. Its output is also syntactically simple and better suited for parsing, while the output of tests/plugin/bb.c is more human-readable. [1] https://cseweb.ucsd.edu/~calder/simpoint/ [2] https://valgrind.org/docs/manual/bbv-manual.html [3] https://www.intel.com/content/www/us/en/developer/articles/tool/pin-a-d= ynamic-binary-instrumentation-tool.html Signed-off-by: Yotaro Nada Signed-off-by: Akihiko Odaki Reviewed-by: Pierrick Bouvier Message-Id: <20240816-bb-v3-1-b9aa4a5c75c5@daynix.com> Signed-off-by: Alex Benn=C3=A9e --- docs/about/emulation.rst | 30 ++++++++ contrib/plugins/bbv.c | 158 +++++++++++++++++++++++++++++++++++++++ contrib/plugins/Makefile | 1 + 3 files changed, 189 insertions(+) create mode 100644 contrib/plugins/bbv.c diff --git a/docs/about/emulation.rst b/docs/about/emulation.rst index eea1261baa..a4470127c9 100644 --- a/docs/about/emulation.rst +++ b/docs/about/emulation.rst @@ -272,6 +272,36 @@ Behaviour can be tweaked with the following arguments: * - idle=3Dtrue|false - Dump the current execution stats whenever the guest vCPU idles =20 +Basic Block Vectors +................... + +``contrib/plugins/bbv.c`` + +The bbv plugin allows you to generate basic block vectors for use with the +`SimPoint `__ analysis tool. + +.. list-table:: Basic block vectors arguments + :widths: 20 80 + :header-rows: 1 + + * - Option + - Description + * - interval=3DN + - The interval to generate a basic block vector specified by the numbe= r of + instructions (Default: N =3D 100000000) + * - outfile=3DPATH + - The path to output files. + It will be suffixed with ``.N.bb`` where ``N`` is a vCPU index. + +Example:: + + $ qemu-aarch64 \ + -plugin contrib/plugins/libbbv.so,interval=3D100,outfile=3Dsha1 \ + tests/tcg/aarch64-linux-user/sha1 + SHA1=3D15dd99a1991e0b3826fede3deffc1feba42278e6 + $ du sha1.0.bb + 23128 sha1.0.bb + Instruction ........... =20 diff --git a/contrib/plugins/bbv.c b/contrib/plugins/bbv.c new file mode 100644 index 0000000000..a5256517dd --- /dev/null +++ b/contrib/plugins/bbv.c @@ -0,0 +1,158 @@ +/* + * Generate basic block vectors for use with the SimPoint analysis tool. + * SimPoint: https://cseweb.ucsd.edu/~calder/simpoint/ + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include +#include + +#include + +typedef struct Bb { + uint64_t vaddr; + struct qemu_plugin_scoreboard *count; + unsigned int index; +} Bb; + +typedef struct Vcpu { + uint64_t count; + FILE *file; +} Vcpu; + +QEMU_PLUGIN_EXPORT int qemu_plugin_version =3D QEMU_PLUGIN_VERSION; +static GHashTable *bbs; +static GRWLock bbs_lock; +static char *filename; +static struct qemu_plugin_scoreboard *vcpus; +static uint64_t interval =3D 100000000; + +static void plugin_exit(qemu_plugin_id_t id, void *p) +{ + for (int i =3D 0; i < qemu_plugin_num_vcpus(); i++) { + fclose(((Vcpu *)qemu_plugin_scoreboard_find(vcpus, i))->file); + } + + g_hash_table_unref(bbs); + g_free(filename); + qemu_plugin_scoreboard_free(vcpus); +} + +static void free_bb(void *data) +{ + qemu_plugin_scoreboard_free(((Bb *)data)->count); + g_free(data); +} + +static qemu_plugin_u64 count_u64(void) +{ + return qemu_plugin_scoreboard_u64_in_struct(vcpus, Vcpu, count); +} + +static qemu_plugin_u64 bb_count_u64(Bb *bb) +{ + return qemu_plugin_scoreboard_u64(bb->count); +} + +static void vcpu_init(qemu_plugin_id_t id, unsigned int vcpu_index) +{ + g_autofree gchar *vcpu_filename =3D NULL; + Vcpu *vcpu =3D qemu_plugin_scoreboard_find(vcpus, vcpu_index); + + vcpu_filename =3D g_strdup_printf("%s.%u.bb", filename, vcpu_index); + vcpu->file =3D fopen(vcpu_filename, "w"); +} + +static void vcpu_interval_exec(unsigned int vcpu_index, void *udata) +{ + Vcpu *vcpu =3D qemu_plugin_scoreboard_find(vcpus, vcpu_index); + GHashTableIter iter; + void *value; + + if (!vcpu->file) { + return; + } + + vcpu->count -=3D interval; + + fputc('T', vcpu->file); + + g_rw_lock_reader_lock(&bbs_lock); + g_hash_table_iter_init(&iter, bbs); + + while (g_hash_table_iter_next(&iter, NULL, &value)) { + Bb *bb =3D value; + uint64_t bb_count =3D qemu_plugin_u64_get(bb_count_u64(bb), vcpu_i= ndex); + + if (!bb_count) { + continue; + } + + fprintf(vcpu->file, ":%u:%" PRIu64 " ", bb->index, bb_count); + qemu_plugin_u64_set(bb_count_u64(bb), vcpu_index, 0); + } + + g_rw_lock_reader_unlock(&bbs_lock); + fputc('\n', vcpu->file); +} + +static void vcpu_tb_trans(qemu_plugin_id_t id, struct qemu_plugin_tb *tb) +{ + uint64_t n_insns =3D qemu_plugin_tb_n_insns(tb); + uint64_t vaddr =3D qemu_plugin_tb_vaddr(tb); + Bb *bb; + + g_rw_lock_writer_lock(&bbs_lock); + bb =3D g_hash_table_lookup(bbs, &vaddr); + if (!bb) { + bb =3D g_new(Bb, 1); + bb->vaddr =3D vaddr; + bb->count =3D qemu_plugin_scoreboard_new(sizeof(uint64_t)); + bb->index =3D g_hash_table_size(bbs); + g_hash_table_replace(bbs, &bb->vaddr, bb); + } + g_rw_lock_writer_unlock(&bbs_lock); + + qemu_plugin_register_vcpu_tb_exec_inline_per_vcpu( + tb, QEMU_PLUGIN_INLINE_ADD_U64, count_u64(), n_insns); + + qemu_plugin_register_vcpu_tb_exec_inline_per_vcpu( + tb, QEMU_PLUGIN_INLINE_ADD_U64, bb_count_u64(bb), n_insns); + + qemu_plugin_register_vcpu_tb_exec_cond_cb( + tb, vcpu_interval_exec, QEMU_PLUGIN_CB_NO_REGS, + QEMU_PLUGIN_COND_GE, count_u64(), interval, NULL); +} + +QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin_id_t id, + const qemu_info_t *info, + int argc, char **argv) +{ + for (int i =3D 0; i < argc; i++) { + char *opt =3D argv[i]; + g_auto(GStrv) tokens =3D g_strsplit(opt, "=3D", 2); + if (g_strcmp0(tokens[0], "interval") =3D=3D 0) { + interval =3D g_ascii_strtoull(tokens[1], NULL, 10); + } else if (g_strcmp0(tokens[0], "outfile") =3D=3D 0) { + filename =3D tokens[1]; + tokens[1] =3D NULL; + } else { + fprintf(stderr, "option parsing failed: %s\n", opt); + return -1; + } + } + + if (!filename) { + fputs("outfile unspecified\n", stderr); + return -1; + } + + bbs =3D g_hash_table_new_full(g_int64_hash, g_int64_equal, NULL, free_= bb); + vcpus =3D qemu_plugin_scoreboard_new(sizeof(Vcpu)); + qemu_plugin_register_atexit_cb(id, plugin_exit, NULL); + qemu_plugin_register_vcpu_init_cb(id, vcpu_init); + qemu_plugin_register_vcpu_tb_trans_cb(id, vcpu_tb_trans); + + return 0; +} diff --git a/contrib/plugins/Makefile b/contrib/plugins/Makefile index d4ac599f93..bbddd4800f 100644 --- a/contrib/plugins/Makefile +++ b/contrib/plugins/Makefile @@ -13,6 +13,7 @@ TOP_SRC_PATH =3D $(SRC_PATH)/../.. VPATH +=3D $(SRC_PATH) =20 NAMES :=3D +NAMES +=3D bbv NAMES +=3D execlog NAMES +=3D hotblocks NAMES +=3D hotpages --=20 2.39.2 From nobody Sun Nov 24 05:59:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1725977689; cv=none; d=zohomail.com; s=zohoarc; b=DIjxrjffGRoHCQPHxPzs0rDgXU6tSdniOTFSP0zvvG/qK5BuQifPLmFlRbQovTS1xziKh8t3pu7bdk7WAnVICnROFfsK8OtSjLoFdzR9A2s4/SXJI6Akdlzd3p4rsbCKAW3pA1TiwwWNtJKJnyVqWvBULdtaMczYMIDTUXil6HA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725977689; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Nn1a9HFZduZ/RNVuj0xIuaKX/DLxfqqaJjOeCmylyL8=; b=O4wazUdG3B9S8izG/qZf7ielofgoJB/Cok8FwmkIFjF9hqavVLWWWnOFdkG/YIhXVTIi/hppnYnqaPT3Sp6lNaJpItixmVLM8Gb9TNmn5tJAgCM6NGZMmW96Q/HmI0gkqlrPQG8z4OnekBFaOE37sQ6O8MEMBKTEfHAsUWQofM8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1725977689241442.2678185305201; Tue, 10 Sep 2024 07:14:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1so1cy-0002Ol-58; Tue, 10 Sep 2024 10:13:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1so1cw-0002I1-MK for qemu-devel@nongnu.org; Tue, 10 Sep 2024 10:13:54 -0400 Received: from mail-lf1-x136.google.com ([2a00:1450:4864:20::136]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1so1ct-0007Si-Cg for qemu-devel@nongnu.org; Tue, 10 Sep 2024 10:13:54 -0400 Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-5365c512b00so1000309e87.3 for ; Tue, 10 Sep 2024 07:13:50 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25835b0bsm494599366b.12.2024.09.10.07.13.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 07:13:47 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 194AE5F762; Tue, 10 Sep 2024 15:07:36 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725977629; x=1726582429; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Nn1a9HFZduZ/RNVuj0xIuaKX/DLxfqqaJjOeCmylyL8=; b=WPltl21WGO9N3hcGsvsCoSPlhh/76ABa/ckkY8KCrQTmIjQrrkq32heOQ9Lch5mp2L PnO4WHSk6I6szUrQybFbHHV76WZwYFcpS7bw1dRiWsgRLwoaeh9xhiXRZYF7jzRijER4 jjJaknY8Rf+LwTi51DlgZELOcRvszyK/6CxqNh+nPSpmGl3cdBDZK9qVzO9Dgm49CUZo 856YetQMLJeBCoHuhz2ulZaFNrmA3wFmK8U+3EQLJoZsl33/WacXm6SMjQUQACUtzmZl a/0/rREtqQZvQUpmJftx8fiujm0vaNuaZsxWYzSjIebXSYDhD+7cYgYOUzmJs8QlErS+ jIDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725977629; x=1726582429; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Nn1a9HFZduZ/RNVuj0xIuaKX/DLxfqqaJjOeCmylyL8=; b=wlAyPjWGfK+mUlmfSUMRzATPTE47Xl7jUEgSZirxbQu/4Z9XInCCBpYnTPvFFMRxOP gh8+JMfRy2HKp6uzLinQYAKxi4MYSAdOe1hwFQcVAdEgE4/GJQGXKK1wRfqS6kkljXEN w/DXTDra9MFOqlxu3uaASm7d7EnlGFzdl7nwa6Q85oT8RBd825MsqN/ul9BISKSMgYTH xEtLaBW3Hgbs6rDg1ndECn33oVcHv3G2mTPyRVfHv9Uc22dJQirJ/HJUBQRzwWU9zzL4 zjo7dXGHrrf0EgYQLiR9IFNOGrHbyy1e4t65z8s1BpLBFJgp01tuUAx1LdDjrq0wCT3Q pfjQ== X-Gm-Message-State: AOJu0YymkTCmFHfNqtVbXSNnSBHEWwPUL32vsYvrDjlDkFi/eZbPL9Dr LMe0mZqaqiclcqzFkvbZQ9vvPlJN7vBDc+mI8tf2zMpfgihYK+yIFiwksunCB/Y= X-Google-Smtp-Source: AGHT+IEN+uEi+sSwcMNzkasXjCFA5pK06+FrmC3zf8g5auPFpnmNgxgFyaFJBnH9NaEfz20v42HnlQ== X-Received: by 2002:a05:6512:4025:b0:533:d3e:16e6 with SMTP id 2adb3069b0e04-536587b2adcmr10879582e87.25.1725977629182; Tue, 10 Sep 2024 07:13:49 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Zhao Liu , Marcel Apfelbaum , Beraldo Leal , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Alexandre Iooss , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Pierrick Bouvier , Yanan Wang , Peter Maydell , Mahmoud Mandour , Thomas Huth , qemu-arm@nongnu.org, devel@lists.libvirt.org, Jiaxun Yang , Paolo Bonzini , Richard Henderson , Wainer dos Santos Moschetta , Rowan Hart Subject: [PATCH 24/26] plugins: add plugin API to read guest memory Date: Tue, 10 Sep 2024 15:07:31 +0100 Message-Id: <20240910140733.4007719-25-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240910140733.4007719-1-alex.bennee@linaro.org> References: <20240910140733.4007719-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::136; envelope-from=alex.bennee@linaro.org; helo=mail-lf1-x136.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1725977690417116600 From: Rowan Hart Signed-off-by: Rowan Hart Reviewed-by: Pierrick Bouvier Message-Id: <20240827215329.248434-2-rowanbhart@gmail.com> [AJB: tweaked cpu_memory_rw_debug call] Signed-off-by: Alex Benn=C3=A9e --- vAJB: - explicit bool for cpu_memory_rw_debug --- include/qemu/qemu-plugin.h | 32 +++++++++++++++++++++++++++++++- plugins/api.c | 20 ++++++++++++++++++++ plugins/qemu-plugins.symbols | 1 + 3 files changed, 52 insertions(+), 1 deletion(-) diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h index 649ce89815..2015d6b409 100644 --- a/include/qemu/qemu-plugin.h +++ b/include/qemu/qemu-plugin.h @@ -57,11 +57,19 @@ typedef uint64_t qemu_plugin_id_t; * - Remove qemu_plugin_register_vcpu_{tb, insn, mem}_exec_inline. * Those functions are replaced by *_per_vcpu variants, which guarantee * thread-safety for operations. + * + * version 3: + * - modified arguments and return value of qemu_plugin_insn_data to copy + * the data into a user-provided buffer instead of returning a pointer + * to the data. + * + * version 4: + * - added qemu_plugin_read_memory_vaddr */ =20 extern QEMU_PLUGIN_EXPORT int qemu_plugin_version; =20 -#define QEMU_PLUGIN_VERSION 3 +#define QEMU_PLUGIN_VERSION 4 =20 /** * struct qemu_info_t - system information for plugins @@ -884,6 +892,28 @@ typedef struct { QEMU_PLUGIN_API GArray *qemu_plugin_get_registers(void); =20 +/** + * qemu_plugin_read_memory_vaddr() - read from memory using a virtual addr= ess + * + * @addr: A virtual address to read from + * @data: A byte array to store data into + * @len: The number of bytes to read, starting from @addr + * + * @len bytes of data is read starting at @addr and stored into @data. If = @data + * is not large enough to hold @len bytes, it will be expanded to the nece= ssary + * size, reallocating if necessary. @len must be greater than 0. + * + * This function does not ensure writes are flushed prior to reading, so + * callers should take care when calling this function in plugin callbacks= to + * avoid attempting to read data which may not yet be written and should u= se + * the memory callback API instead. + * + * Returns true on success and false on failure. + */ +QEMU_PLUGIN_API +bool qemu_plugin_read_memory_vaddr(uint64_t addr, + GByteArray *data, size_t len); + /** * qemu_plugin_read_register() - read register for current vCPU * diff --git a/plugins/api.c b/plugins/api.c index 3316d4a04d..24ea64e2de 100644 --- a/plugins/api.c +++ b/plugins/api.c @@ -560,6 +560,26 @@ GArray *qemu_plugin_get_registers(void) return create_register_handles(regs); } =20 +bool qemu_plugin_read_memory_vaddr(vaddr addr, GByteArray *data, size_t le= n) +{ + g_assert(current_cpu); + + if (len =3D=3D 0) { + return false; + } + + g_byte_array_set_size(data, len); + + int result =3D cpu_memory_rw_debug(current_cpu, addr, data->data, + data->len, false); + + if (result < 0) { + return false; + } + + return true; +} + int qemu_plugin_read_register(struct qemu_plugin_register *reg, GByteArray= *buf) { g_assert(current_cpu); diff --git a/plugins/qemu-plugins.symbols b/plugins/qemu-plugins.symbols index eed9d8abd9..032661f9ea 100644 --- a/plugins/qemu-plugins.symbols +++ b/plugins/qemu-plugins.symbols @@ -21,6 +21,7 @@ qemu_plugin_num_vcpus; qemu_plugin_outs; qemu_plugin_path_to_binary; + qemu_plugin_read_memory_vaddr; qemu_plugin_read_register; qemu_plugin_register_atexit_cb; qemu_plugin_register_flush_cb; --=20 2.39.2 From nobody Sun Nov 24 05:59:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1725977646; cv=none; d=zohomail.com; s=zohoarc; b=cgebsfDGQNiyRuAYG4NqqIihLpNHBx5FHcUdruDUDnUHrIrwHYv0TokLrNp0OvKTXkedN/G3vKJ5dQCYI0pm6siNGBH8GfhPWhAk0+cADK52nKrSHcXPsZkWNIm29wBiWvteb2sC3wVcJkNd7nxLoBlnyqiq3SFjHdXlNb9l+DI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725977646; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=hEZbqliSm3idSAY5YqSflW1IHfDQd2AMSDogcHs/b2s=; b=nodJjuxOsVYqCnaqJ4Wjk9YhhbMs5FCt0l3gOpI54b7cElm5sx9LbF+sS86IVk+CaTrXASRu4NlscWSJfmc1WBLV/1ebsviI3K23McQIbEK5HR1BvxWicgJWpbuoD6NMS5CSbJV030XiZQBXJ5MhLQ02o0sb75/eYIeb+JIS5Nk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1725977646777171.21406540923533; Tue, 10 Sep 2024 07:14:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1so1cz-0002Vk-Rb; Tue, 10 Sep 2024 10:13:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1so1cy-0002Qy-MJ for qemu-devel@nongnu.org; Tue, 10 Sep 2024 10:13:56 -0400 Received: from mail-lf1-x131.google.com ([2a00:1450:4864:20::131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1so1cw-0007UF-Ho for qemu-devel@nongnu.org; Tue, 10 Sep 2024 10:13:56 -0400 Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-5365cf5de24so4174560e87.1 for ; Tue, 10 Sep 2024 07:13:54 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d258339a2sm494195966b.19.2024.09.10.07.13.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 07:13:47 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 315E7634BF; Tue, 10 Sep 2024 15:07:36 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725977633; x=1726582433; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hEZbqliSm3idSAY5YqSflW1IHfDQd2AMSDogcHs/b2s=; b=rISTBAWtpxzbOkOoj5vC4Kt9GZtVT4MqdZ1EbNK57wkLQurm0VRPqp+uoZDhImqfjG yOwiCdtMi2eZQxIkN5gXcxectwz8Fc5gZ3vs6D3uaIUjHJOJgLkxr/5HLLeqEafEgplQ a49kAIvabGhutoQqYm52cUNDrmqkJ447Lg/lYdWNgu/hoVk2ULil2psrAeoY+Rn/PHZB MZW8wO5t0wGGE7qYsFWNFpHFV0ZAcM7OI/Z6OnQlIQmta9Gz31oEDa1Y2cE7mRGPczrm vlpbpM/oiIU9GpIBxgRkZRGfzrP8hkPNZnva/GdSpF+uVIxRHD0p7Gpv4keOLcHlWhYr o09w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725977633; x=1726582433; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hEZbqliSm3idSAY5YqSflW1IHfDQd2AMSDogcHs/b2s=; b=a7R0zqYBcFVyme2FxUUWs6Ldlv35nv2uw5SZv9F+zutMt+OalmU8PcV4xNes54gD3R XM+qmYsy1TDH+vgdyAP7eBPKDxfTey5lvg5Jx8mnr0rk8J/mo9u0j+w1iadh+Mv1QdAp mBNLGJnmBj/tjNGGpU+52bl5LVwBETxT4MJHpiIuGUwwZnCXH7q+yM8oALJeplFsA2PP vaiIMLxQAG3hCGqYbTS6p3JFiZoJdBbuIBeAa4YvwEbaTnrAX6RxsUxEZJt7ga5lniIF /11f6liaF5FCTmEprgczz8xrDiM/PsmTpTZKLn9JwSKSPwdCWc6ia9TBkH1P6+0ULLK+ CqtA== X-Gm-Message-State: AOJu0Yxh13NRIYSsCv3kLorPkom4jPZY68H30JAHdwNRb/U394RVtxYm nR6rsQ85ZiaA9BHEqAMMX6kMmxcFY4Q/dyJ2kTyhXAX1y/270MkBKOjYoHPp9vI= X-Google-Smtp-Source: AGHT+IEup74tz9U0Vo0Zg4049OhdGaaNOMyqndjACA2G6EY6LAsfYz8KN4z/rZQdsmPkEf1OeB7LEA== X-Received: by 2002:a05:6512:2207:b0:536:541e:31c8 with SMTP id 2adb3069b0e04-536587fc18cmr7829864e87.37.1725977632611; Tue, 10 Sep 2024 07:13:52 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Zhao Liu , Marcel Apfelbaum , Beraldo Leal , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Alexandre Iooss , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Pierrick Bouvier , Yanan Wang , Peter Maydell , Mahmoud Mandour , Thomas Huth , qemu-arm@nongnu.org, devel@lists.libvirt.org, Jiaxun Yang , Paolo Bonzini , Richard Henderson , Wainer dos Santos Moschetta , Rowan Hart Subject: [PATCH 25/26] plugins: add option to dump write argument to syscall plugin Date: Tue, 10 Sep 2024 15:07:32 +0100 Message-Id: <20240910140733.4007719-26-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240910140733.4007719-1-alex.bennee@linaro.org> References: <20240910140733.4007719-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::131; envelope-from=alex.bennee@linaro.org; helo=mail-lf1-x131.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1725977648180116600 From: Rowan Hart Signed-off-by: Rowan Hart Reviewed-by: Pierrick Bouvier Tested-by: Pierrick Bouvier Message-Id: <20240827215329.248434-3-rowanbhart@gmail.com> [AJB: tweak fmt string for vaddr] Signed-off-by: Alex Benn=C3=A9e --- vAJB - tweak fmt string for PRIu64 --- docs/about/emulation.rst | 14 ++++- tests/tcg/plugins/syscall.c | 117 ++++++++++++++++++++++++++++++++++++ 2 files changed, 130 insertions(+), 1 deletion(-) diff --git a/docs/about/emulation.rst b/docs/about/emulation.rst index a4470127c9..23e4949049 100644 --- a/docs/about/emulation.rst +++ b/docs/about/emulation.rst @@ -418,6 +418,19 @@ run:: 160 1 0 135 1 0 =20 +Behaviour can be tweaked with the following arguments: + +.. list-table:: Syscall plugin arguments + :widths: 20 80 + :header-rows: 1 + + * - Option + - Description + * - print=3Dtrue|false + - Print the number of times each syscall is called + * - log_writes=3Dtrue|false + - Log the buffer of each write syscall in hexdump format + Test inline operations ...................... =20 @@ -807,4 +820,3 @@ Other emulation features When running system emulation you can also enable deterministic execution which allows for repeatable record/replay debugging. See :ref:`Record/Replay` for more details. - diff --git a/tests/tcg/plugins/syscall.c b/tests/tcg/plugins/syscall.c index 72e1a5bf90..647f478090 100644 --- a/tests/tcg/plugins/syscall.c +++ b/tests/tcg/plugins/syscall.c @@ -22,8 +22,57 @@ typedef struct { int64_t errors; } SyscallStats; =20 +struct SyscallInfo { + const char *name; + int64_t write_sysno; +}; + +const struct SyscallInfo arch_syscall_info[] =3D { + { "aarch64", 64 }, + { "aarch64_be", 64 }, + { "alpha", 4 }, + { "arm", 4 }, + { "armeb", 4 }, + { "avr", -1 }, + { "cris", -1 }, + { "hexagon", 64 }, + { "hppa", -1 }, + { "i386", 4 }, + { "loongarch64", -1 }, + { "m68k", 4 }, + { "microblaze", 4 }, + { "microblazeel", 4 }, + { "mips", 1 }, + { "mips64", 1 }, + { "mips64el", 1 }, + { "mipsel", 1 }, + { "mipsn32", 1 }, + { "mipsn32el", 1 }, + { "or1k", -1 }, + { "ppc", 4 }, + { "ppc64", 4 }, + { "ppc64le", 4 }, + { "riscv32", 64 }, + { "riscv64", 64 }, + { "rx", -1 }, + { "s390x", -1 }, + { "sh4", -1 }, + { "sh4eb", -1 }, + { "sparc", 4 }, + { "sparc32plus", 4 }, + { "sparc64", 4 }, + { "tricore", -1 }, + { "x86_64", 1 }, + { "xtensa", 13 }, + { "xtensaeb", 13 }, + { NULL, -1 }, +}; + static GMutex lock; static GHashTable *statistics; +static GByteArray *memory_buffer; +static bool do_log_writes; +static int64_t write_sysno =3D -1; =20 static SyscallStats *get_or_create_entry(int64_t num) { @@ -39,6 +88,44 @@ static SyscallStats *get_or_create_entry(int64_t num) return entry; } =20 +/* + * Hex-dump a GByteArray to the QEMU plugin output in the format: + * 61 63 63 65 6c 09 09 20 20 20 66 70 75 09 09 09 | accel.....fpu... + * 20 6d 6f 64 75 6c 65 2d 63 6f 6d 6d 6f 6e 2e 63 | .module-common.c + */ +static void hexdump(const GByteArray *data) +{ + g_autoptr(GString) out =3D g_string_new(""); + + for (guint index =3D 0; index < data->len; index +=3D 16) { + for (guint col =3D 0; col < 16; col++) { + if (index + col < data->len) { + g_string_append_printf(out, "%02x ", data->data[index + co= l]); + } else { + g_string_append(out, " "); + } + } + + g_string_append(out, " | "); + + for (guint col =3D 0; col < 16; col++) { + if (index + col >=3D data->len) { + break; + } + + if (g_ascii_isgraph(data->data[index + col])) { + g_string_append_printf(out, "%c", data->data[index + col]); + } else { + g_string_append(out, "."); + } + } + + g_string_append(out, "\n"); + } + + qemu_plugin_outs(out->str); +} + static void vcpu_syscall(qemu_plugin_id_t id, unsigned int vcpu_index, int64_t num, uint64_t a1, uint64_t a2, uint64_t a3, uint64_t a4, uint64_t a5, @@ -54,6 +141,14 @@ static void vcpu_syscall(qemu_plugin_id_t id, unsigned = int vcpu_index, g_autofree gchar *out =3D g_strdup_printf("syscall #%" PRIi64 "\n"= , num); qemu_plugin_outs(out); } + + if (do_log_writes && num =3D=3D write_sysno) { + if (qemu_plugin_read_memory_vaddr(a2, memory_buffer, a3)) { + hexdump(memory_buffer); + } else { + fprintf(stderr, "Error reading memory from vaddr %"PRIu64"\n",= a2); + } + } } =20 static void vcpu_syscall_ret(qemu_plugin_id_t id, unsigned int vcpu_idx, @@ -127,6 +222,10 @@ QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin= _id_t id, if (!qemu_plugin_bool_parse(tokens[0], tokens[1], &do_print)) { fprintf(stderr, "boolean argument parsing failed: %s\n", o= pt); } + } else if (g_strcmp0(tokens[0], "log_writes") =3D=3D 0) { + if (!qemu_plugin_bool_parse(tokens[0], tokens[1], &do_log_writ= es)) { + fprintf(stderr, "boolean argument parsing failed: %s\n", o= pt); + } } else { fprintf(stderr, "unsupported argument: %s\n", argv[i]); return -1; @@ -137,6 +236,24 @@ QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin= _id_t id, statistics =3D g_hash_table_new_full(NULL, g_direct_equal, NULL, g= _free); } =20 + if (do_log_writes) { + for (const struct SyscallInfo *syscall_info =3D arch_syscall_info; + syscall_info->name !=3D NULL; syscall_info++) { + + if (g_strcmp0(syscall_info->name, info->target_name) =3D=3D 0)= { + write_sysno =3D syscall_info->write_sysno; + break; + } + } + + if (write_sysno =3D=3D -1) { + fprintf(stderr, "write syscall number not found\n"); + return -1; + } + + memory_buffer =3D g_byte_array_new(); + } + qemu_plugin_register_vcpu_syscall_cb(id, vcpu_syscall); qemu_plugin_register_vcpu_syscall_ret_cb(id, vcpu_syscall_ret); qemu_plugin_register_atexit_cb(id, plugin_exit, NULL); --=20 2.39.2 From nobody Sun Nov 24 05:59:32 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1725977339; cv=none; d=zohomail.com; s=zohoarc; b=ECU5335UW9Rk+Ca6jxPJ3gXHXq3PY8H68m+M2Jyk2sKn/hbidv4fZ1QNn9ntwsEkLzhle+z7iL6OwZQGFE3uifyMf+8ChIof6kaaTcPs+B9PK46MoO2lYXUhC9VJEUKeTAOxgh0yMHt2ByktThSGxI2IxgBscEaVt4cr7M7kWIE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725977339; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=fi/Ma4iZQyq9UPktSL9wJjpSik/SOJE+/JzqHwnFA1g=; b=URaBQBFlMo0KVHSpyzj2H4XEQqtE7JkLxq+4Sq+1LREIB36MXG+rconiiOFS26LnYU9VtU/s1hn/oEmWGnca7He+UECjf+zFVHyvso68Zts3Jb373drQOPj9p3iotZZd7l76Zv0CdGYjo4YEV2YzdpQADMp5yfaRJijRuhLPuuI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1725977339556692.6922420236937; Tue, 10 Sep 2024 07:08:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1so1XB-0008W3-47; Tue, 10 Sep 2024 10:07:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1so1X8-0008JR-Lg for qemu-devel@nongnu.org; Tue, 10 Sep 2024 10:07:54 -0400 Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1so1X4-0006Za-Vz for qemu-devel@nongnu.org; Tue, 10 Sep 2024 10:07:54 -0400 Received: by mail-ej1-x635.google.com with SMTP id a640c23a62f3a-a8d4979b843so376646766b.3 for ; Tue, 10 Sep 2024 07:07:50 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25cea3e1sm482519066b.167.2024.09.10.07.07.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Sep 2024 07:07:42 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id 515645F9CC; Tue, 10 Sep 2024 15:07:36 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725977269; x=1726582069; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=fi/Ma4iZQyq9UPktSL9wJjpSik/SOJE+/JzqHwnFA1g=; b=tg5bZNSfbSotM8fdcSiSDEBIPwa9kIh/c4uK6+X6JAqcPspkcIeL8Z11gEI1B17hw1 TtRRqM68v/KImy87Ff+Aqy+xF5DScQTP9bqT+n/0RMUB7exTrCc7/Tg1oZl5E3vSBTzG j0xMqS9RQU0yarV1uBM+JpXbZMk6W8YY9vHwE06ABT/hRHg90WZ8EJEGa3IwoonPIIMs Mpbc2a+lTbRLAujNvgGsSPPs+kp4C2cejDvJgQKgv9um/4z4ecgjjGwFRvDD0EGoUyGD /fKipiK4LdyNp+DVc6e3UTyh9Kyno2WvyMT4Tkj9PxmuU7TgY5ONiVBWo+l3Ki3lWObQ kQCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725977269; x=1726582069; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fi/Ma4iZQyq9UPktSL9wJjpSik/SOJE+/JzqHwnFA1g=; b=ZKKErK+Gc02kO3xG/JLcY4pKJD+sO8yJQPMiWmcKu8jxtCLscxHfCNY4gJkFwjKh75 TwnrDd4sb8ZphQ5slRAncVzifWeIonuVuWyZ8V6RfwCHlDr037VkNtgqDSjprUlC9K3p Cdh4EaHtQR5O7cNw/n+2tCaCNZAQqMKOHdclGb+6SNZZ9c46mOM5k6OrjXIm29THXCI7 noUg8aDhD9yRVgVv/5keuRoJmspIsspW4fDUlLP+8Xd9cXp4fe3ukssbQtbp02s635Yu 0Vo+O3Fi/8KTToPpi1RRlX3X5DD4zDTIqZ7Bz3P5bj290MoVOeMjcmSryZIx8tnQgxml ihPw== X-Gm-Message-State: AOJu0Yxbzz0RquUSFEHtLRfOcHdwypKHP2YFmbRrCiB7JFbB6+Xm+UEw Mhsx7Mpv0LNIkCg6BienOEKWWXHxwhMRHARk0BYsRE9ZJwFtojIELbdY/by9shg= X-Google-Smtp-Source: AGHT+IFtSnQC3W7zLRxuMIFpGHeZXAK0UXDTKpdYvut6xU65VLOm4bg437OH6NEMTMyIZQoIbEnnxw== X-Received: by 2002:a17:906:4fc4:b0:a86:8e3d:86e2 with SMTP id a640c23a62f3a-a8ffaaa4ae0mr97954566b.11.1725977269050; Tue, 10 Sep 2024 07:07:49 -0700 (PDT) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Eduardo Habkost , Zhao Liu , Marcel Apfelbaum , Beraldo Leal , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Alexandre Iooss , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Pierrick Bouvier , Yanan Wang , Peter Maydell , Mahmoud Mandour , Thomas Huth , qemu-arm@nongnu.org, devel@lists.libvirt.org, Jiaxun Yang , Paolo Bonzini , Richard Henderson , Wainer dos Santos Moschetta Subject: [PATCH 26/26] plugins: add ability to register a GDB triggered callback Date: Tue, 10 Sep 2024 15:07:33 +0100 Message-Id: <20240910140733.4007719-27-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240910140733.4007719-1-alex.bennee@linaro.org> References: <20240910140733.4007719-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::635; envelope-from=alex.bennee@linaro.org; helo=mail-ej1-x635.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1725977340650116600 Now gdbstub has gained the ability to extend its command tables we can allow it to trigger plugin callbacks. This is probably most useful for QEMU developers debugging plugins themselves but might be useful for other stuff. Trigger the callback by sending: maintenance packet Qqemu.plugin_cb I've extended the memory plugin to report on the packet. Signed-off-by: Alex Benn=C3=A9e --- include/qemu/plugin-event.h | 1 + include/qemu/qemu-plugin.h | 16 ++++++++++++++++ plugins/plugin.h | 9 +++++++++ plugins/api.c | 18 ++++++++++++++++++ plugins/core.c | 37 ++++++++++++++++++++++++++++++++++++ tests/tcg/plugins/mem.c | 11 +++++++++-- plugins/qemu-plugins.symbols | 1 + 7 files changed, 91 insertions(+), 2 deletions(-) diff --git a/include/qemu/plugin-event.h b/include/qemu/plugin-event.h index 7056d8427b..d9aa56cf4f 100644 --- a/include/qemu/plugin-event.h +++ b/include/qemu/plugin-event.h @@ -20,6 +20,7 @@ enum qemu_plugin_event { QEMU_PLUGIN_EV_VCPU_SYSCALL_RET, QEMU_PLUGIN_EV_FLUSH, QEMU_PLUGIN_EV_ATEXIT, + QEMU_PLUGIN_EV_GDBSTUB, QEMU_PLUGIN_EV_MAX, /* total number of plugin events we support */ }; =20 diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h index 2015d6b409..3592e142f8 100644 --- a/include/qemu/qemu-plugin.h +++ b/include/qemu/qemu-plugin.h @@ -802,6 +802,22 @@ QEMU_PLUGIN_API void qemu_plugin_register_atexit_cb(qemu_plugin_id_t id, qemu_plugin_udata_cb_t cb, void *userd= ata); =20 + +/** + * qemu_plugin_register_gdb_cb() - register a gdb callback + * @id: plugin ID + * @cb: callback + * @userdata: user data for callback + * + * When using the gdbstub to debug a guest you can send a command that + * will trigger the callback. This is useful if you want the plugin to + * print out collected state at particular points when debugging a + * program. + */ +QEMU_PLUGIN_API +void qemu_plugin_register_gdb_cb(qemu_plugin_id_t id, + qemu_plugin_udata_cb_t cb, void *userdata= ); + /* returns how many vcpus were started at this point */ int qemu_plugin_num_vcpus(void); =20 diff --git a/plugins/plugin.h b/plugins/plugin.h index 30e2299a54..f37667c9fb 100644 --- a/plugins/plugin.h +++ b/plugins/plugin.h @@ -118,4 +118,13 @@ struct qemu_plugin_scoreboard *plugin_scoreboard_new(s= ize_t element_size); =20 void plugin_scoreboard_free(struct qemu_plugin_scoreboard *score); =20 +/** + * plugin_register_gdbstub_commands - register gdbstub commands + * + * This should only be called once to register gdbstub commands so we + * can trigger callbacks if needed. + */ +void plugin_register_gdbstub_commands(void); + + #endif /* PLUGIN_H */ diff --git a/plugins/api.c b/plugins/api.c index 24ea64e2de..62141616f4 100644 --- a/plugins/api.c +++ b/plugins/api.c @@ -681,3 +681,21 @@ void qemu_plugin_update_ns(const void *handle, int64_t= new_time) } #endif } + +/* + * gdbstub hooks + */ + +static bool gdbstub_callbacks; + +void qemu_plugin_register_gdb_cb(qemu_plugin_id_t id, + qemu_plugin_udata_cb_t cb, + void *udata) +{ + plugin_register_cb_udata(id, QEMU_PLUGIN_EV_GDBSTUB, cb, udata); + + if (!gdbstub_callbacks) { + plugin_register_gdbstub_commands(); + gdbstub_callbacks =3D true; + } +} diff --git a/plugins/core.c b/plugins/core.c index bb105e8e68..e7fce08799 100644 --- a/plugins/core.c +++ b/plugins/core.c @@ -23,6 +23,7 @@ #include "qemu/xxhash.h" #include "qemu/rcu.h" #include "hw/core/cpu.h" +#include "gdbstub/commands.h" =20 #include "exec/exec-all.h" #include "exec/tb-flush.h" @@ -147,6 +148,7 @@ static void plugin_cb__udata(enum qemu_plugin_event ev) =20 switch (ev) { case QEMU_PLUGIN_EV_ATEXIT: + case QEMU_PLUGIN_EV_GDBSTUB: QLIST_FOREACH_SAFE_RCU(cb, &plugin.cb_lists[ev], entry, next) { qemu_plugin_udata_cb_t func =3D cb->f.udata; =20 @@ -768,3 +770,38 @@ void plugin_scoreboard_free(struct qemu_plugin_scorebo= ard *score) g_array_free(score->data, TRUE); g_free(score); } + +/* + * gdbstub integration + */ + +static void handle_plugin_cb(GArray *params, void *user_ctx) +{ + plugin_cb__udata(QEMU_PLUGIN_EV_GDBSTUB); + gdb_put_packet("OK"); +} + +enum Command { + PluginCallback, + NUM_GDB_CMDS +}; + +static const GdbCmdParseEntry cmd_handler_table[NUM_GDB_CMDS] =3D { + [PluginCallback] =3D { + .handler =3D handle_plugin_cb, + .cmd_startswith =3D true, + .cmd =3D "qemu.plugin_cb", + .schema =3D "s?", + }, +}; + +void plugin_register_gdbstub_commands(void) +{ + g_autoptr(GPtrArray) set_table =3D g_ptr_array_new(); + + for (int i =3D 0; i < NUM_GDB_CMDS; i++) { + g_ptr_array_add(set_table, (gpointer) &cmd_handler_table[PluginCal= lback]); + } + + gdb_extend_set_table(set_table); +} diff --git a/tests/tcg/plugins/mem.c b/tests/tcg/plugins/mem.c index 42d735d5c8..ee71bd02c9 100644 --- a/tests/tcg/plugins/mem.c +++ b/tests/tcg/plugins/mem.c @@ -66,8 +66,7 @@ static gint addr_order(gconstpointer a, gconstpointer b) return na->region_address > nb->region_address ? 1 : -1; } =20 - -static void plugin_exit(qemu_plugin_id_t id, void *p) +static void plugin_report(qemu_plugin_id_t id, void *p) { g_autoptr(GString) out =3D g_string_new(""); =20 @@ -81,6 +80,7 @@ static void plugin_exit(qemu_plugin_id_t id, void *p) } qemu_plugin_outs(out->str); =20 + g_mutex_lock(&lock); =20 if (do_region_summary) { GList *counts =3D g_hash_table_get_values(regions); @@ -105,6 +105,12 @@ static void plugin_exit(qemu_plugin_id_t id, void *p) qemu_plugin_outs(out->str); } =20 + g_mutex_unlock(&lock); +} + +static void plugin_exit(qemu_plugin_id_t id, void *p) +{ + plugin_report(id, p); qemu_plugin_scoreboard_free(counts); } =20 @@ -375,6 +381,7 @@ QEMU_PLUGIN_EXPORT int qemu_plugin_install(qemu_plugin_= id_t id, counts, CPUCount, mem_count); io_count =3D qemu_plugin_scoreboard_u64_in_struct(counts, CPUCount, io= _count); qemu_plugin_register_vcpu_tb_trans_cb(id, vcpu_tb_trans); + qemu_plugin_register_gdb_cb(id, plugin_report, NULL); qemu_plugin_register_atexit_cb(id, plugin_exit, NULL); return 0; } diff --git a/plugins/qemu-plugins.symbols b/plugins/qemu-plugins.symbols index 032661f9ea..d272e8e0f3 100644 --- a/plugins/qemu-plugins.symbols +++ b/plugins/qemu-plugins.symbols @@ -25,6 +25,7 @@ qemu_plugin_read_register; qemu_plugin_register_atexit_cb; qemu_plugin_register_flush_cb; + qemu_plugin_register_gdb_cb; qemu_plugin_register_vcpu_exit_cb; qemu_plugin_register_vcpu_idle_cb; qemu_plugin_register_vcpu_init_cb; --=20 2.39.2