From 136b6085f1dca34a472d09bfcc552f8060d243a2 Mon Sep 17 00:00:00 2001 From: Marcin Juszkiewicz Date: Wed, 15 Mar 2023 17:43:00 +0000 Subject: [PATCH 01/35] tests/avocado: update AArch64 tests to Alpine 3.17.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To test Alpine boot on SBSA-Ref target we need Alpine Linux 'standard' image as 'virt' one lacks kernel modules. So to minimalize Avocado cache I move test to 'standard' image. Signed-off-by: Marcin Juszkiewicz Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Alex Bennée Message-Id: <20230302191146.1790560-1-marcin.juszkiewicz@linaro.org> Message-Id: <20230315174331.2959-2-alex.bennee@linaro.org> --- tests/avocado/machine_aarch64_virt.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/avocado/machine_aarch64_virt.py b/tests/avocado/machine_aarch64_virt.py index 25dab8dc00a3..a90dc6ff4b47 100644 --- a/tests/avocado/machine_aarch64_virt.py +++ b/tests/avocado/machine_aarch64_virt.py @@ -38,11 +38,11 @@ def test_alpine_virt_tcg_gic_max(self): :avocado: tags=accel:tcg """ iso_url = ('https://dl-cdn.alpinelinux.org/' - 'alpine/v3.16/releases/aarch64/' - 'alpine-virt-3.16.3-aarch64.iso') + 'alpine/v3.17/releases/aarch64/' + 'alpine-standard-3.17.2-aarch64.iso') # Alpine use sha256 so I recalculated this myself - iso_sha1 = '0683bc089486d55c91bf6607d5ecb93925769bc0' + iso_sha1 = '76284fcd7b41fe899b0c2375ceb8470803eea839' iso_path = self.fetch_asset(iso_url, asset_hash=iso_sha1) self.vm.set_console() @@ -65,7 +65,7 @@ def test_alpine_virt_tcg_gic_max(self): self.vm.add_args('-object', 'rng-random,id=rng0,filename=/dev/urandom') self.vm.launch() - self.wait_for_console_pattern('Welcome to Alpine Linux 3.16') + self.wait_for_console_pattern('Welcome to Alpine Linux 3.17') def common_aarch64_virt(self, machine): From 80232dba16dc2e52f7b699af5051d100628ba857 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= Date: Tue, 21 Mar 2023 11:15:35 +0000 Subject: [PATCH 02/35] tests/avocado: probe for multi-process support before running test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A recent attempt to let avocado run more tests on the CentOS stream build failed because there was no gating on the multiprocess feature. Like missing accelerators avocado should gracefully skip when the feature is not enabled. In this case we use the existence of the proxy device as a proxy for multi-process support. Signed-off-by: Alex Bennée Reviewed-by: Philippe Mathieu-Daudé Cc: Elena Ufimtseva Cc: Jagannathan Raman Cc: John G Johnson Message-Id: <20230321111752.2681128-1-alex.bennee@linaro.org> --- tests/avocado/avocado_qemu/__init__.py | 10 ++++++++++ tests/avocado/multiprocess.py | 1 + 2 files changed, 11 insertions(+) diff --git a/tests/avocado/avocado_qemu/__init__.py b/tests/avocado/avocado_qemu/__init__.py index a313e88c07e3..cb71f50db91c 100644 --- a/tests/avocado/avocado_qemu/__init__.py +++ b/tests/avocado/avocado_qemu/__init__.py @@ -309,6 +309,16 @@ def require_netdev(self, netdevname): if netdevhelp.find('\n' + netdevname + '\n') < 0: self.cancel('no support for user networking') + def require_multiprocess(self): + """ + Test for the presence of the x-pci-proxy-dev which is required + to support multiprocess. + """ + devhelp = run_cmd([self.qemu_bin, + '-M', 'none', '-device', 'help'])[0]; + if devhelp.find('x-pci-proxy-dev') < 0: + self.cancel('no support for multiprocess device emulation') + def _new_vm(self, name, *args): self._sd = tempfile.TemporaryDirectory(prefix="qemu_") vm = QEMUMachine(self.qemu_bin, base_temp_dir=self.workdir, diff --git a/tests/avocado/multiprocess.py b/tests/avocado/multiprocess.py index 80a3b8f442b9..9112a4cacc6e 100644 --- a/tests/avocado/multiprocess.py +++ b/tests/avocado/multiprocess.py @@ -22,6 +22,7 @@ def do_test(self, kernel_url, initrd_url, kernel_command_line, machine_type): """Main test method""" self.require_accelerator('kvm') + self.require_multiprocess() # Create socketpair to connect proxy and remote processes proxy_sock, remote_sock = socket.socketpair(socket.AF_UNIX, From 9f95111474659aa28ec98a67118ff79bd05cc6e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= Date: Tue, 21 Mar 2023 18:05:30 +0000 Subject: [PATCH 03/35] tests/avocado: re-factor igb test to avoid timeouts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The core of the test was utilising "ethtool -t eth1 offline" to run through a test sequence. For reasons unknown the test hangs under some configurations of the build on centos8-stream. Fundamentally running the old fedora-31 cloud-init is just too much for something that is directed at testing one device. So we: - replace fedora with a custom kernel + buildroot rootfs - rename the test from IGB to NetDevEthtool - re-factor the common code, add (currently skipped) tests for other devices which support ethtool - remove the KVM limitation as its fast enough to run in KVM or TCG Signed-off-by: Alex Bennée Reviewed-by: Philippe Mathieu-Daudé Cc: Akihiko Odaki Message-Id: <20230322145529.4079753-1-alex.bennee@linaro.org> --- tests/avocado/igb.py | 38 ----------- tests/avocado/netdev-ethtool.py | 116 ++++++++++++++++++++++++++++++++ 2 files changed, 116 insertions(+), 38 deletions(-) delete mode 100644 tests/avocado/igb.py create mode 100644 tests/avocado/netdev-ethtool.py diff --git a/tests/avocado/igb.py b/tests/avocado/igb.py deleted file mode 100644 index abf5dfa07fb0..000000000000 --- a/tests/avocado/igb.py +++ /dev/null @@ -1,38 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-or-later -# ethtool tests for igb registers, interrupts, etc - -from avocado_qemu import LinuxTest - -class IGB(LinuxTest): - """ - :avocado: tags=accel:kvm - :avocado: tags=arch:x86_64 - :avocado: tags=distro:fedora - :avocado: tags=distro_version:31 - :avocado: tags=machine:q35 - """ - - timeout = 180 - - def test(self): - self.require_accelerator('kvm') - kernel_url = self.distro.pxeboot_url + 'vmlinuz' - kernel_hash = '5b6f6876e1b5bda314f93893271da0d5777b1f3c' - kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash) - initrd_url = self.distro.pxeboot_url + 'initrd.img' - initrd_hash = 'dd0340a1b39bd28f88532babd4581c67649ec5b1' - initrd_path = self.fetch_asset(initrd_url, asset_hash=initrd_hash) - - # Ideally we want to test MSI as well, but it is blocked by a bug - # fixed with: - # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=28e96556baca7056d11d9fb3cdd0aba4483e00d8 - kernel_params = self.distro.default_kernel_params + ' pci=nomsi' - - self.vm.add_args('-kernel', kernel_path, - '-initrd', initrd_path, - '-append', kernel_params, - '-accel', 'kvm', - '-device', 'igb') - self.launch_and_wait() - self.ssh_command('dnf -y install ethtool') - self.ssh_command('ethtool -t eth1 offline') diff --git a/tests/avocado/netdev-ethtool.py b/tests/avocado/netdev-ethtool.py new file mode 100644 index 000000000000..f7e94641842d --- /dev/null +++ b/tests/avocado/netdev-ethtool.py @@ -0,0 +1,116 @@ +# ethtool tests for emulated network devices +# +# This test leverages ethtool's --test sequence to validate network +# device behaviour. +# +# SPDX-License-Identifier: GPL-2.0-or-late + +from avocado import skip +from avocado_qemu import QemuSystemTest +from avocado_qemu import exec_command, exec_command_and_wait_for_pattern +from avocado_qemu import wait_for_console_pattern + +class NetDevEthtool(QemuSystemTest): + """ + :avocado: tags=arch:x86_64 + :avocado: tags=machine:q35 + """ + + # Runs in about 17s under KVM, 19s under TCG, 25s under GCOV + timeout = 45 + + # Fetch assets from the netdev-ethtool subdir of my shared test + # images directory on fileserver.linaro.org. + def get_asset(self, name, sha1): + base_url = ('https://fileserver.linaro.org/s/' + 'kE4nCFLdQcoBF9t/download?' + 'path=%2Fnetdev-ethtool&files=' ) + url = base_url + name + # use explicit name rather than failing to neatly parse the + # URL into a unique one + return self.fetch_asset(name=name, locations=(url), asset_hash=sha1) + + def common_test_code(self, netdev, extra_args=None, kvm=False): + + # This custom kernel has drivers for all the supported network + # devices we can emulate in QEMU + kernel = self.get_asset("bzImage", + "33469d7802732d5815226166581442395cb289e2") + + rootfs = self.get_asset("rootfs.squashfs", + "9793cea7021414ae844bda51f558bd6565b50cdc") + + append = 'printk.time=0 console=ttyS0 ' + append += 'root=/dev/sr0 rootfstype=squashfs ' + + # any additional kernel tweaks for the test + if extra_args: + append += extra_args + + # finally invoke ethtool directly + append += ' init=/usr/sbin/ethtool -- -t eth1 offline' + + # add the rootfs via a readonly cdrom image + drive = f"file={rootfs},if=ide,index=0,media=cdrom" + + self.vm.add_args('-kernel', kernel, + '-append', append, + '-drive', drive, + '-device', netdev) + + if kvm: + self.vm.add_args('-accel', 'kvm') + + self.vm.set_console(console_index=0) + self.vm.launch() + + wait_for_console_pattern(self, + "The test result is PASS", + "The test result is FAIL", + vm=None) + # no need to gracefully shutdown, just finish + self.vm.kill() + + # Skip testing for MSI for now. Allegedly it was fixed by: + # 28e96556ba (igb: Allocate MSI-X vector when testing) + # but I'm seeing oops in the kernel + @skip("Kernel bug with MSI enabled") + def test_igb(self): + """ + :avocado: tags=device:igb + """ + self.common_test_code("igb") + + def test_igb_nomsi(self): + """ + :avocado: tags=device:igb + """ + self.common_test_code("igb", "pci=nomsi") + + def test_igb_nomsi_kvm(self): + """ + :avocado: tags=device:igb + """ + self.require_accelerator('kvm') + self.common_test_code("igb", "pci=nomsi", True) + + # It seems the other popular cards we model in QEMU currently fail + # the pattern test with: + # + # pattern test failed (reg 0x00178): got 0x00000000 expected 0x00005A5A + # + # So for now we skip them. + + @skip("Incomplete reg 0x00178 support") + def test_e1000(self): + """ + :avocado: tags=device:e1000 + """ + self.common_test_code("e1000") + + @skip("Incomplete reg 0x00178 support") + def test_i82550(self): + """ + :avocado: tags=device:i82550 + """ + self.common_test_code("i82550") From 55154c57851ea3624e01d0e5c2f3622c9f87bc8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= Date: Wed, 15 Mar 2023 17:43:01 +0000 Subject: [PATCH 04/35] tests/docker: all add DOCKER_BUILDKIT to RUNC environment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It seems we also need to pass DOCKER_BUILDKIT as an argument to docker itself to get the full benefit of caching. Signed-off-by: Alex Bennée Suggested-by: Fabiano Rosas Tested-by: Richard Henderson Reviewed-by: Thomas Huth Message-Id: <20230315174331.2959-3-alex.bennee@linaro.org> --- tests/docker/Makefile.include | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/docker/Makefile.include b/tests/docker/Makefile.include index 54ed77f6715b..94015253254c 100644 --- a/tests/docker/Makefile.include +++ b/tests/docker/Makefile.include @@ -39,7 +39,7 @@ docker-qemu-src: $(DOCKER_SRC_COPY) # General rule for building docker images. docker-image-%: $(DOCKER_FILES_DIR)/%.docker $(call quiet-command, \ - $(RUNC) build \ + DOCKER_BUILDKIT=1 $(RUNC) build \ $(if $V,,--quiet) \ $(if $(NOCACHE),--no-cache, \ $(if $(DOCKER_REGISTRY),--cache-from $(DOCKER_REGISTRY)/qemu/$*)) \ From 6df250e1812652fa2024d5e5c88a706c4e973428 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= Date: Wed, 15 Mar 2023 17:43:02 +0000 Subject: [PATCH 05/35] scripts/ci: add libslirp-devel to build-environment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Without libslip enabled we won't have user networking which means the KVM tests won't run. Reviewed-by: Thomas Huth Signed-off-by: Alex Bennée Message-Id: <20230315174331.2959-4-alex.bennee@linaro.org> --- scripts/ci/org.centos/stream/8/build-environment.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/ci/org.centos/stream/8/build-environment.yml b/scripts/ci/org.centos/stream/8/build-environment.yml index 0d094d70c3b3..1ead77e2cbfd 100644 --- a/scripts/ci/org.centos/stream/8/build-environment.yml +++ b/scripts/ci/org.centos/stream/8/build-environment.yml @@ -55,6 +55,7 @@ - librados-devel - librbd-devel - libseccomp-devel + - libslirp-devel - libssh-devel - libxkbcommon-devel - lzo-devel From 82790dfefc98686fb268a75f76ba44a7f09f133c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= Date: Wed, 15 Mar 2023 17:43:03 +0000 Subject: [PATCH 06/35] scripts/ci: update gitlab-runner playbook to handle CentOS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This was broken when we moved to using the pre-built packages as we didn't take care to ensure we used RPMs where required. NB: I could never get this to complete on my test setup but I suspect this was down to network connectivity and timeouts while downloading. Fixes: 69c4befba1 (scripts/ci: update gitlab-runner playbook to use latest runner) Signed-off-by: Alex Bennée Message-Id: <20230315174331.2959-5-alex.bennee@linaro.org> --- scripts/ci/setup/gitlab-runner.yml | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/scripts/ci/setup/gitlab-runner.yml b/scripts/ci/setup/gitlab-runner.yml index 95d4199c033d..1a1b270ff2b2 100644 --- a/scripts/ci/setup/gitlab-runner.yml +++ b/scripts/ci/setup/gitlab-runner.yml @@ -48,13 +48,29 @@ - debug: msg: gitlab-runner arch is {{ gitlab_runner_arch }} - - name: Download the matching gitlab-runner + - name: Download the matching gitlab-runner (DEB) get_url: dest: "/root/" url: "https://gitlab-runner-downloads.s3.amazonaws.com/latest/deb/gitlab-runner_{{ gitlab_runner_arch }}.deb" + when: + - ansible_facts['distribution'] == 'Ubuntu' + + - name: Download the matching gitlab-runner (RPM) + get_url: + dest: "/root/" + url: "https://gitlab-runner-downloads.s3.amazonaws.com/latest/rpm/gitlab-runner_{{ gitlab_runner_arch }}.rpm" + when: + - ansible_facts['distribution'] == 'CentOS' - - name: Install gitlab-runner via package manager + - name: Install gitlab-runner via package manager (DEB) apt: deb="/root/gitlab-runner_{{ gitlab_runner_arch }}.deb" + when: + - ansible_facts['distribution'] == 'Ubuntu' + + - name: Install gitlab-runner via package manager (RPM) + yum: name="/root/gitlab-runner_{{ gitlab_runner_arch }}.rpm" + when: + - ansible_facts['distribution'] == 'CentOS' - name: Register the gitlab-runner command: "/usr/bin/gitlab-runner register --non-interactive --url {{ gitlab_runner_server_url }} --registration-token {{ gitlab_runner_registration_token }} --executor shell --tag-list {{ ansible_facts[\"architecture\"] }},{{ ansible_facts[\"distribution\"]|lower }}_{{ ansible_facts[\"distribution_version\"] }} --description '{{ ansible_facts[\"distribution\"] }} {{ ansible_facts[\"distribution_version\"] }} {{ ansible_facts[\"architecture\"] }} ({{ ansible_facts[\"os_family\"] }})'" From dbe9a9cdbb2881bd46f2ef5fd361cd75943941df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= Date: Wed, 15 Mar 2023 17:43:04 +0000 Subject: [PATCH 07/35] gitlab: update centos-8-stream job MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A couple of clean-ups here: - inherit from the custom runners job for artefacts - call check-avocado directly - add some comments to the top about setup Signed-off-by: Alex Bennée Reviewed-by: Thomas Huth Message-Id: <20230315174331.2959-6-alex.bennee@linaro.org> --- .../custom-runners/centos-stream-8-x86_64.yml | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/.gitlab-ci.d/custom-runners/centos-stream-8-x86_64.yml b/.gitlab-ci.d/custom-runners/centos-stream-8-x86_64.yml index 068b0c4335be..367424db781d 100644 --- a/.gitlab-ci.d/custom-runners/centos-stream-8-x86_64.yml +++ b/.gitlab-ci.d/custom-runners/centos-stream-8-x86_64.yml @@ -1,4 +1,9 @@ +# All centos-stream-8 jobs should run successfully in an environment +# setup by the scripts/ci/setup/stream/8/build-environment.yml task +# "Installation of extra packages to build QEMU" + centos-stream-8-x86_64: + extends: .custom_runner_template allow_failure: true needs: [] stage: build @@ -8,15 +13,6 @@ centos-stream-8-x86_64: rules: - if: '$CI_PROJECT_NAMESPACE == "qemu-project" && $CI_COMMIT_BRANCH =~ /^staging/' - if: "$CENTOS_STREAM_8_x86_64_RUNNER_AVAILABLE" - artifacts: - name: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG" - when: on_failure - expire_in: 7 days - paths: - - build/tests/results/latest/results.xml - - build/tests/results/latest/test-results - reports: - junit: build/tests/results/latest/results.xml before_script: - JOBS=$(expr $(nproc) + 1) script: @@ -25,6 +21,4 @@ centos-stream-8-x86_64: - ../scripts/ci/org.centos/stream/8/x86_64/configure || { cat config.log meson-logs/meson-log.txt; exit 1; } - make -j"$JOBS" - - make NINJA=":" check - || { cat meson-logs/testlog.txt; exit 1; } ; - - ../scripts/ci/org.centos/stream/8/x86_64/test-avocado + - make NINJA=":" check check-avocado From 32ba75adc009763db8a9686a57c268b82e774f48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= Date: Wed, 15 Mar 2023 17:43:05 +0000 Subject: [PATCH 08/35] include/qemu: add documentation for memory callbacks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some API documentation was missed, rectify that. Fixes: https://gitlab.com/qemu-project/qemu/-/issues/1497 Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson Reviewed-by: Thomas Huth Message-Id: <20230315174331.2959-7-alex.bennee@linaro.org> --- include/qemu/qemu-plugin.h | 47 ++++++++++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 4 deletions(-) diff --git a/include/qemu/qemu-plugin.h b/include/qemu/qemu-plugin.h index d0e9d03adfe3..50a995727988 100644 --- a/include/qemu/qemu-plugin.h +++ b/include/qemu/qemu-plugin.h @@ -481,17 +481,56 @@ uint64_t qemu_plugin_hwaddr_phys_addr(const struct qemu_plugin_hwaddr *haddr); */ const char *qemu_plugin_hwaddr_device_name(const struct qemu_plugin_hwaddr *h); -typedef void -(*qemu_plugin_vcpu_mem_cb_t)(unsigned int vcpu_index, - qemu_plugin_meminfo_t info, uint64_t vaddr, - void *userdata); +/** + * typedef qemu_plugin_vcpu_mem_cb_t - memory callback function type + * @vcpu_index: the executing vCPU + * @info: an opaque handle for further queries about the memory + * @vaddr: the virtual address of the transaction + * @userdata: any user data attached to the callback + */ +typedef void (*qemu_plugin_vcpu_mem_cb_t) (unsigned int vcpu_index, + qemu_plugin_meminfo_t info, + uint64_t vaddr, + void *userdata); +/** + * qemu_plugin_register_vcpu_mem_cb() - register memory access callback + * @insn: handle for instruction to instrument + * @cb: callback of type qemu_plugin_vcpu_mem_cb_t + * @flags: (currently unused) callback flags + * @rw: monitor reads, writes or both + * @userdata: opaque pointer for userdata + * + * This registers a full callback for every memory access generated by + * an instruction. If the instruction doesn't access memory no + * callback will be made. + * + * The callback reports the vCPU the access took place on, the virtual + * address of the access and a handle for further queries. The user + * can attach some userdata to the callback for additional purposes. + * + * Other execution threads will continue to execute during the + * callback so the plugin is responsible for ensuring it doesn't get + * confused by making appropriate use of locking if required. + */ void qemu_plugin_register_vcpu_mem_cb(struct qemu_plugin_insn *insn, qemu_plugin_vcpu_mem_cb_t cb, enum qemu_plugin_cb_flags flags, enum qemu_plugin_mem_rw rw, void *userdata); +/** + * qemu_plugin_register_vcpu_mem_inline() - register an inline op to any memory access + * @insn: handle for instruction to instrument + * @rw: apply to reads, writes or both + * @op: the op, of type qemu_plugin_op + * @ptr: pointer memory for the op + * @imm: immediate data for @op + * + * This registers a inline op every memory access generated by the + * instruction. This provides for a lightweight but not thread-safe + * way of counting the number of operations done. + */ void qemu_plugin_register_vcpu_mem_inline(struct qemu_plugin_insn *insn, enum qemu_plugin_mem_rw rw, enum qemu_plugin_op op, void *ptr, From 6f6ca067d2712261502346db6508b8de43adb1a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= Date: Wed, 15 Mar 2023 17:43:06 +0000 Subject: [PATCH 09/35] tests/tcg: add some help output for running individual tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit So you can do: cd tests/tcg/aarch64-linux-user make -f ../Makefile.target help To see the list of tests. You can then run each one individually. Signed-off-by: Alex Bennée Acked-by: Richard Henderson Reviewed-by: Thomas Huth Message-Id: <20230315174331.2959-8-alex.bennee@linaro.org> --- tests/tcg/Makefile.target | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/tcg/Makefile.target b/tests/tcg/Makefile.target index a3b0aaf8af1f..8318caf92471 100644 --- a/tests/tcg/Makefile.target +++ b/tests/tcg/Makefile.target @@ -201,3 +201,10 @@ clean: distclean: rm -f config-cc.mak config-target.mak ../config-$(TARGET).mak + +.PHONY: help +help: + @echo "TCG tests help $(TARGET_NAME)" + @echo "Built with $(CC)" + @echo "Available tests:" + @$(foreach t,$(RUN_TESTS),echo " $t";) From fb3af2d182b1aaba87fc1f26a0740bae0c7e2698 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= Date: Wed, 15 Mar 2023 17:43:09 +0000 Subject: [PATCH 10/35] tests/avocado: don't use tags to define drive MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We are abusing the avocado tags which are intended to provide test selection metadata to provide parameters to our test. This works OK up until the point you need to have ,'s in the field as this is the tag separator character which is the case for a number of the drive parameters. Fix this by making drive a parameter to the common helper function. Fixes: 267fe57c23 (tests: add tuxrun baseline test to avocado) Reviewed-by: David Woodhouse Signed-off-by: David Woodhouse Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Alex Bennée Message-Id: <20230315174331.2959-11-alex.bennee@linaro.org> --- tests/avocado/tuxrun_baselines.py | 60 +++++++++++++------------------ 1 file changed, 24 insertions(+), 36 deletions(-) diff --git a/tests/avocado/tuxrun_baselines.py b/tests/avocado/tuxrun_baselines.py index 30aaefc1d3fb..c3fb67f5dc1c 100644 --- a/tests/avocado/tuxrun_baselines.py +++ b/tests/avocado/tuxrun_baselines.py @@ -67,9 +67,6 @@ def setUp(self): # The name of the kernel Image file self.image = self.get_tag('image', "Image") - # The block device drive type - self.drive = self.get_tag('drive', "virtio-blk-device") - self.root = self.get_tag('root', "vda") # Occasionally we need extra devices to hook things up @@ -99,7 +96,7 @@ def fetch_tuxrun_assets(self, dt=None): return (kernel_image, self.workdir + "/rootfs.ext4", dtb) - def prepare_run(self, kernel, disk, dtb=None, console_index=0): + def prepare_run(self, kernel, disk, drive, dtb=None, console_index=0): """ Setup to run and add the common parameters to the system """ @@ -121,10 +118,8 @@ def prepare_run(self, kernel, disk, dtb=None, console_index=0): if self.extradev: self.vm.add_args('-device', self.extradev) - # Some machines already define a drive device - if self.drive != "none": - self.vm.add_args('-device', - f"{self.drive},drive=hd0") + self.vm.add_args('-device', + f"{drive},drive=hd0") # Some machines need an explicit DTB if dtb: @@ -154,7 +149,9 @@ def run_tuxtest_tests(self, haltmsg): else: self.vm.wait() - def common_tuxrun(self, dt=None, haltmsg="reboot: System halted", + def common_tuxrun(self, dt=None, + drive="virtio-blk-device", + haltmsg="reboot: System halted", console_index=0): """ Common path for LKFT tests. Unless we need to do something @@ -163,7 +160,7 @@ def common_tuxrun(self, dt=None, haltmsg="reboot: System halted", """ (kernel, disk, dtb) = self.fetch_tuxrun_assets(dt) - self.prepare_run(kernel, disk, dtb, console_index) + self.prepare_run(kernel, disk, drive, dtb, console_index) self.vm.launch() self.run_tuxtest_tests(haltmsg) @@ -206,11 +203,11 @@ def test_armv5(self): :avocado: tags=machine:versatilepb :avocado: tags=tuxboot:armv5 :avocado: tags=image:zImage - :avocado: tags=drive:virtio-blk-pci :avocado: tags=console:ttyAMA0 :avocado: tags=shutdown:nowait """ - self.common_tuxrun(dt="versatile-pb.dtb") + self.common_tuxrun(drive="virtio-blk-pci", + dt="versatile-pb.dtb") def test_armv7(self): """ @@ -244,10 +241,9 @@ def test_i386(self): :avocado: tags=machine:q35 :avocado: tags=tuxboot:i386 :avocado: tags=image:bzImage - :avocado: tags=drive:virtio-blk-pci :avocado: tags=shutdown:nowait """ - self.common_tuxrun() + self.common_tuxrun(drive="virtio-blk-pci") def test_mips32(self): """ @@ -257,11 +253,10 @@ def test_mips32(self): :avocado: tags=endian:big :avocado: tags=tuxboot:mips32 :avocado: tags=image:vmlinux - :avocado: tags=drive:driver=ide-hd,bus=ide.0,unit=0 :avocado: tags=root:sda :avocado: tags=shutdown:nowait """ - self.common_tuxrun() + self.common_tuxrun(drive="driver=ide-hd,bus=ide.0,unit=0") def test_mips32el(self): """ @@ -270,11 +265,10 @@ def test_mips32el(self): :avocado: tags=cpu:mips32r6-generic :avocado: tags=tuxboot:mips32el :avocado: tags=image:vmlinux - :avocado: tags=drive:driver=ide-hd,bus=ide.0,unit=0 :avocado: tags=root:sda :avocado: tags=shutdown:nowait """ - self.common_tuxrun() + self.common_tuxrun(drive="driver=ide-hd,bus=ide.0,unit=0") @skip("QEMU currently broken") # regression against stable QEMU def test_mips64(self): @@ -284,11 +278,10 @@ def test_mips64(self): :avocado: tags=tuxboot:mips64 :avocado: tags=endian:big :avocado: tags=image:vmlinux - :avocado: tags=drive:driver=ide-hd,bus=ide.0,unit=0 :avocado: tags=root:sda :avocado: tags=shutdown:nowait """ - self.common_tuxrun() + self.common_tuxrun(drive="driver=ide-hd,bus=ide.0,unit=0") def test_mips64el(self): """ @@ -296,11 +289,10 @@ def test_mips64el(self): :avocado: tags=machine:malta :avocado: tags=tuxboot:mips64el :avocado: tags=image:vmlinux - :avocado: tags=drive:driver=ide-hd,bus=ide.0,unit=0 :avocado: tags=root:sda :avocado: tags=shutdown:nowait """ - self.common_tuxrun() + self.common_tuxrun(drive="driver=ide-hd,bus=ide.0,unit=0") def test_ppc32(self): """ @@ -309,10 +301,9 @@ def test_ppc32(self): :avocado: tags=cpu:e500mc :avocado: tags=tuxboot:ppc32 :avocado: tags=image:uImage - :avocado: tags=drive:virtio-blk-pci :avocado: tags=shutdown:nowait """ - self.common_tuxrun() + self.common_tuxrun(drive="virtio-blk-pci") def test_ppc64(self): """ @@ -324,10 +315,9 @@ def test_ppc64(self): :avocado: tags=tuxboot:ppc64 :avocado: tags=image:vmlinux :avocado: tags=extradev:driver=spapr-vscsi - :avocado: tags=drive:scsi-hd :avocado: tags=root:sda """ - self.common_tuxrun() + self.common_tuxrun(drive="scsi-hd") def test_ppc64le(self): """ @@ -338,10 +328,9 @@ def test_ppc64le(self): :avocado: tags=tuxboot:ppc64le :avocado: tags=image:vmlinux :avocado: tags=extradev:driver=spapr-vscsi - :avocado: tags=drive:scsi-hd :avocado: tags=root:sda """ - self.common_tuxrun() + self.common_tuxrun(drive="scsi-hd") def test_riscv32(self): """ @@ -365,10 +354,10 @@ def test_s390(self): :avocado: tags=endian:big :avocado: tags=tuxboot:s390 :avocado: tags=image:bzImage - :avocado: tags=drive:virtio-blk-ccw :avocado: tags=shutdown:nowait """ - self.common_tuxrun(haltmsg="Requesting system halt") + self.common_tuxrun(drive="virtio-blk-ccw", + haltmsg="Requesting system halt") # Note: some segfaults caused by unaligned userspace access @skipIf(os.getenv('GITLAB_CI'), 'Skipping unstable test on GitLab') @@ -380,7 +369,6 @@ def test_sh4(self): :avocado: tags=tuxboot:sh4 :avocado: tags=image:zImage :avocado: tags=root:sda - :avocado: tags=drive:driver=ide-hd,bus=ide.0,unit=0 :avocado: tags=console:ttySC1 """ # The test is currently too unstable to do much in userspace @@ -388,7 +376,9 @@ def test_sh4(self): (kernel, disk, dtb) = self.fetch_tuxrun_assets() # the console comes on the second serial port - self.prepare_run(kernel, disk, console_index=1) + self.prepare_run(kernel, disk, + "driver=ide-hd,bus=ide.0,unit=0", + console_index=1) self.vm.launch() self.wait_for_console_pattern("Welcome to TuxTest") @@ -404,10 +394,9 @@ def test_sparc64(self): :avocado: tags=tuxboot:sparc64 :avocado: tags=image:vmlinux :avocado: tags=root:sda - :avocado: tags=drive:driver=ide-hd,bus=ide.0,unit=0 :avocado: tags=shutdown:nowait """ - self.common_tuxrun() + self.common_tuxrun(drive="driver=ide-hd,bus=ide.0,unit=0") def test_x86_64(self): """ @@ -417,7 +406,6 @@ def test_x86_64(self): :avocado: tags=tuxboot:x86_64 :avocado: tags=image:bzImage :avocado: tags=root:sda - :avocado: tags=drive:driver=ide-hd,bus=ide.0,unit=0 :avocado: tags=shutdown:nowait """ - self.common_tuxrun() + self.common_tuxrun(drive="driver=ide-hd,bus=ide.0,unit=0") From e04660afef2ac15d84ae941841da451c41d81607 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Wed, 15 Mar 2023 17:43:10 +0000 Subject: [PATCH 11/35] tcg: Clear plugin_mem_cbs on TB exit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Do this in cpu_tb_exec (normal exit) and cpu_loop_exit (exception), adjacent to where we reset can_do_io. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1381 Signed-off-by: Richard Henderson Message-Id: <20230310195252.210956-2-richard.henderson@linaro.org> Signed-off-by: Alex Bennée Message-Id: <20230315174331.2959-12-alex.bennee@linaro.org> Reviewed-by: Emilio Cota --- accel/tcg/cpu-exec-common.c | 2 ++ accel/tcg/cpu-exec.c | 5 +---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/accel/tcg/cpu-exec-common.c b/accel/tcg/cpu-exec-common.c index c7bc8c6efa14..176ea5728114 100644 --- a/accel/tcg/cpu-exec-common.c +++ b/accel/tcg/cpu-exec-common.c @@ -65,6 +65,8 @@ void cpu_loop_exit(CPUState *cpu) { /* Undo the setting in cpu_tb_exec. */ cpu->can_do_io = 1; + /* Undo any setting in generated code. */ + qemu_plugin_disable_mem_helpers(cpu); siglongjmp(cpu->jmp_env, 1); } diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 56aaf58b9d9a..c815f2dbfdf6 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -459,6 +459,7 @@ cpu_tb_exec(CPUState *cpu, TranslationBlock *itb, int *tb_exit) qemu_thread_jit_execute(); ret = tcg_qemu_tb_exec(env, tb_ptr); cpu->can_do_io = 1; + qemu_plugin_disable_mem_helpers(cpu); /* * TODO: Delay swapping back to the read-write region of the TB * until we actually need to modify the TB. The read-only copy, @@ -526,7 +527,6 @@ static void cpu_exec_exit(CPUState *cpu) if (cc->tcg_ops->cpu_exec_exit) { cc->tcg_ops->cpu_exec_exit(cpu); } - QEMU_PLUGIN_ASSERT(cpu->plugin_mem_cbs == NULL); } void cpu_exec_step_atomic(CPUState *cpu) @@ -580,7 +580,6 @@ void cpu_exec_step_atomic(CPUState *cpu) qemu_mutex_unlock_iothread(); } assert_no_pages_locked(); - qemu_plugin_disable_mem_helpers(cpu); } /* @@ -1004,7 +1003,6 @@ cpu_exec_loop(CPUState *cpu, SyncClocks *sc) cpu_loop_exec_tb(cpu, tb, pc, &last_tb, &tb_exit); - QEMU_PLUGIN_ASSERT(cpu->plugin_mem_cbs == NULL); /* Try to align the host and virtual clocks if the guest is in advance */ align_clocks(sc, cpu); @@ -1029,7 +1027,6 @@ static int cpu_exec_setjmp(CPUState *cpu, SyncClocks *sc) if (qemu_mutex_iothread_locked()) { qemu_mutex_unlock_iothread(); } - qemu_plugin_disable_mem_helpers(cpu); assert_no_pages_locked(); } From 10588491c1fbf3458b88fb632c8292f7989516d0 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Wed, 15 Mar 2023 17:43:11 +0000 Subject: [PATCH 12/35] tcg: Drop plugin_gen_disable_mem_helpers from tcg_gen_exit_tb MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Now that we call qemu_plugin_disable_mem_helpers in cpu_tb_exec, we don't need to do this in generated code as well. Signed-off-by: Richard Henderson Message-Id: <20230310195252.210956-3-richard.henderson@linaro.org> Signed-off-by: Alex Bennée Message-Id: <20230315174331.2959-13-alex.bennee@linaro.org> Reviewed-by: Emilio Cota --- tcg/tcg-op.c | 1 - 1 file changed, 1 deletion(-) diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c index ddab20a6a697..3136cef81a82 100644 --- a/tcg/tcg-op.c +++ b/tcg/tcg-op.c @@ -2808,7 +2808,6 @@ void tcg_gen_exit_tb(const TranslationBlock *tb, unsigned idx) tcg_debug_assert(idx == TB_EXIT_REQUESTED); } - plugin_gen_disable_mem_helpers(); tcg_gen_op1i(INDEX_op_exit_tb, val); } From e8956e0c6c2f61a235d896eb5b9941f474b6a57d Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Wed, 15 Mar 2023 17:43:12 +0000 Subject: [PATCH 13/35] include/qemu/plugin: Remove QEMU_PLUGIN_ASSERT MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This macro is no longer used. Signed-off-by: Richard Henderson Message-Id: <20230310195252.210956-4-richard.henderson@linaro.org> Signed-off-by: Alex Bennée Message-Id: <20230315174331.2959-14-alex.bennee@linaro.org> Reviewed-by: Emilio Cota --- include/qemu/plugin.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/include/qemu/plugin.h b/include/qemu/plugin.h index fb338ba576f2..e0ebedef84ff 100644 --- a/include/qemu/plugin.h +++ b/include/qemu/plugin.h @@ -59,8 +59,6 @@ get_plugin_meminfo_rw(qemu_plugin_meminfo_t i) #ifdef CONFIG_PLUGIN extern QemuOptsList qemu_plugin_opts; -#define QEMU_PLUGIN_ASSERT(cond) g_assert(cond) - static inline void qemu_plugin_add_opts(void) { qemu_add_opts(&qemu_plugin_opts); @@ -252,8 +250,6 @@ void qemu_plugin_user_postfork(bool is_child); #else /* !CONFIG_PLUGIN */ -#define QEMU_PLUGIN_ASSERT(cond) - static inline void qemu_plugin_add_opts(void) { } From cc37d98bfbc5dd1f1ad89536589dedf81fab3d84 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Wed, 15 Mar 2023 17:43:13 +0000 Subject: [PATCH 14/35] *: Add missing includes of qemu/error-report.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This had been pulled in via qemu/plugin.h from hw/core/cpu.h, but that will be removed. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20230310195252.210956-5-richard.henderson@linaro.org> [AJB: add various additional cases shown by CI] Signed-off-by: Alex Bennée Message-Id: <20230315174331.2959-15-alex.bennee@linaro.org> Reviewed-by: Emilio Cota --- accel/accel-softmmu.c | 2 +- block/monitor/block-hmp-cmds.c | 1 + dump/dump.c | 1 + dump/win_dump.c | 1 + gdbstub/gdbstub.c | 1 + hw/arm/collie.c | 2 ++ hw/arm/cubieboard.c | 1 + hw/arm/musicpal.c | 2 ++ hw/arm/npcm7xx_boards.c | 2 ++ hw/arm/nseries.c | 2 ++ hw/arm/omap_sx1.c | 2 ++ hw/arm/orangepi.c | 1 + hw/arm/palm.c | 2 ++ hw/core/loader.c | 1 + hw/core/machine-smp.c | 2 ++ hw/i386/kvm/xen_evtchn.c | 1 + hw/i386/kvm/xen_xenstore.c | 1 + hw/i386/sgx.c | 1 + hw/intc/apic.c | 1 + hw/loongarch/acpi-build.c | 1 + hw/loongarch/virt.c | 2 ++ hw/m68k/next-cube.c | 1 + hw/m68k/q800.c | 1 + hw/m68k/virt.c | 1 + hw/mem/memory-device.c | 1 + hw/mem/sparse-mem.c | 1 + hw/openrisc/boot.c | 1 + hw/ppc/ppc4xx_sdram.c | 1 + hw/ppc/spapr_softmmu.c | 2 ++ hw/riscv/opentitan.c | 1 + hw/riscv/shakti_c.c | 1 + hw/riscv/virt-acpi-build.c | 1 + hw/vfio/display.c | 1 + hw/vfio/igd.c | 1 + hw/vfio/migration.c | 1 + linux-user/elfload.c | 1 + migration/dirtyrate.c | 1 + migration/exec.c | 1 + target/i386/cpu.c | 1 + target/i386/host-cpu.c | 1 + target/i386/kvm/xen-emu.c | 1 + target/i386/sev.c | 1 + target/i386/whpx/whpx-apic.c | 1 + target/mips/cpu.c | 1 + target/s390x/cpu-sysemu.c | 1 + target/s390x/cpu_models.c | 1 + target/s390x/diag.c | 2 ++ ui/cocoa.m | 1 + 48 files changed, 58 insertions(+), 1 deletion(-) diff --git a/accel/accel-softmmu.c b/accel/accel-softmmu.c index f9cdafb148ac..9c804ba9e3b6 100644 --- a/accel/accel-softmmu.c +++ b/accel/accel-softmmu.c @@ -27,7 +27,7 @@ #include "qemu/accel.h" #include "hw/boards.h" #include "sysemu/cpus.h" - +#include "qemu/error-report.h" #include "accel-softmmu.h" int accel_init_machine(AccelState *accel, MachineState *ms) diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c index 6aa5f1be0c2a..2846083546f3 100644 --- a/block/monitor/block-hmp-cmds.c +++ b/block/monitor/block-hmp-cmds.c @@ -48,6 +48,7 @@ #include "qemu/option.h" #include "qemu/sockets.h" #include "qemu/cutils.h" +#include "qemu/error-report.h" #include "sysemu/sysemu.h" #include "monitor/monitor.h" #include "monitor/hmp.h" diff --git a/dump/dump.c b/dump/dump.c index 544d5bce3a6e..1f1a6edcab05 100644 --- a/dump/dump.c +++ b/dump/dump.c @@ -24,6 +24,7 @@ #include "qapi/qapi-commands-dump.h" #include "qapi/qapi-events-dump.h" #include "qapi/qmp/qerror.h" +#include "qemu/error-report.h" #include "qemu/main-loop.h" #include "hw/misc/vmcoreinfo.h" #include "migration/blocker.h" diff --git a/dump/win_dump.c b/dump/win_dump.c index 0152f7330a25..b7bfaff3794c 100644 --- a/dump/win_dump.c +++ b/dump/win_dump.c @@ -11,6 +11,7 @@ #include "qemu/osdep.h" #include "sysemu/dump.h" #include "qapi/error.h" +#include "qemu/error-report.h" #include "qapi/qmp/qerror.h" #include "exec/cpu-defs.h" #include "hw/core/cpu.h" diff --git a/gdbstub/gdbstub.c b/gdbstub/gdbstub.c index d9e9bf929455..2a66371aa576 100644 --- a/gdbstub/gdbstub.c +++ b/gdbstub/gdbstub.c @@ -27,6 +27,7 @@ #include "qemu/ctype.h" #include "qemu/cutils.h" #include "qemu/module.h" +#include "qemu/error-report.h" #include "trace.h" #include "exec/gdbstub.h" #include "gdbstub/syscalls.h" diff --git a/hw/arm/collie.c b/hw/arm/collie.c index 9edff593708e..a0ad1b8dc7e3 100644 --- a/hw/arm/collie.c +++ b/hw/arm/collie.c @@ -19,6 +19,8 @@ #include "exec/address-spaces.h" #include "cpu.h" #include "qom/object.h" +#include "qemu/error-report.h" + #define RAM_SIZE (512 * MiB) #define FLASH_SIZE (32 * MiB) diff --git a/hw/arm/cubieboard.c b/hw/arm/cubieboard.c index 71a7df150833..8c7fa91529ee 100644 --- a/hw/arm/cubieboard.c +++ b/hw/arm/cubieboard.c @@ -17,6 +17,7 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu/error-report.h" #include "hw/boards.h" #include "hw/qdev-properties.h" #include "hw/arm/allwinner-a10.h" diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c index 06d9add7c729..c9010b2ffbb6 100644 --- a/hw/arm/musicpal.c +++ b/hw/arm/musicpal.c @@ -37,6 +37,8 @@ #include "qemu/cutils.h" #include "qom/object.h" #include "hw/net/mv88w8618_eth.h" +#include "qemu/error-report.h" + #define MP_MISC_BASE 0x80002000 #define MP_MISC_SIZE 0x00001000 diff --git a/hw/arm/npcm7xx_boards.c b/hw/arm/npcm7xx_boards.c index 9b31207a06e9..2aef579aacc2 100644 --- a/hw/arm/npcm7xx_boards.c +++ b/hw/arm/npcm7xx_boards.c @@ -30,6 +30,8 @@ #include "sysemu/blockdev.h" #include "sysemu/sysemu.h" #include "sysemu/block-backend.h" +#include "qemu/error-report.h" + #define NPCM7XX_POWER_ON_STRAPS_DEFAULT ( \ NPCM7XX_PWRON_STRAP_SPI0F18 | \ diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c index c9df063a082e..9e49e9e17762 100644 --- a/hw/arm/nseries.c +++ b/hw/arm/nseries.c @@ -45,6 +45,8 @@ #include "hw/loader.h" #include "hw/sysbus.h" #include "qemu/log.h" +#include "qemu/error-report.h" + /* Nokia N8x0 support */ struct n800_s { diff --git a/hw/arm/omap_sx1.c b/hw/arm/omap_sx1.c index e7212920797a..4bf1579f8c1c 100644 --- a/hw/arm/omap_sx1.c +++ b/hw/arm/omap_sx1.c @@ -37,6 +37,8 @@ #include "exec/address-spaces.h" #include "cpu.h" #include "qemu/cutils.h" +#include "qemu/error-report.h" + /*****************************************************************************/ /* Siemens SX1 Cellphone V1 */ diff --git a/hw/arm/orangepi.c b/hw/arm/orangepi.c index 3ace4748704e..10653361ed5e 100644 --- a/hw/arm/orangepi.c +++ b/hw/arm/orangepi.c @@ -21,6 +21,7 @@ #include "qemu/units.h" #include "exec/address-spaces.h" #include "qapi/error.h" +#include "qemu/error-report.h" #include "hw/boards.h" #include "hw/qdev-properties.h" #include "hw/arm/allwinner-h3.h" diff --git a/hw/arm/palm.c b/hw/arm/palm.c index 1457f10c83a3..17c11ac4ceca 100644 --- a/hw/arm/palm.c +++ b/hw/arm/palm.c @@ -32,6 +32,8 @@ #include "cpu.h" #include "qemu/cutils.h" #include "qom/object.h" +#include "qemu/error-report.h" + static uint64_t static_read(void *opaque, hwaddr offset, unsigned size) { diff --git a/hw/core/loader.c b/hw/core/loader.c index 695d1acb15ba..8b7fd9e9e551 100644 --- a/hw/core/loader.c +++ b/hw/core/loader.c @@ -44,6 +44,7 @@ #include "qemu/osdep.h" #include "qemu/datadir.h" +#include "qemu/error-report.h" #include "qapi/error.h" #include "qapi/qapi-commands-machine.h" #include "qapi/type-helpers.h" diff --git a/hw/core/machine-smp.c b/hw/core/machine-smp.c index c3dab007dadc..89fe0cda4275 100644 --- a/hw/core/machine-smp.c +++ b/hw/core/machine-smp.c @@ -20,6 +20,8 @@ #include "qemu/osdep.h" #include "hw/boards.h" #include "qapi/error.h" +#include "qemu/error-report.h" + /* * Report information of a machine's supported CPU topology hierarchy. diff --git a/hw/i386/kvm/xen_evtchn.c b/hw/i386/kvm/xen_evtchn.c index 98a7b850472a..304832947424 100644 --- a/hw/i386/kvm/xen_evtchn.c +++ b/hw/i386/kvm/xen_evtchn.c @@ -15,6 +15,7 @@ #include "qemu/lockable.h" #include "qemu/main-loop.h" #include "qemu/log.h" +#include "qemu/error-report.h" #include "monitor/monitor.h" #include "monitor/hmp.h" #include "qapi/error.h" diff --git a/hw/i386/kvm/xen_xenstore.c b/hw/i386/kvm/xen_xenstore.c index 2cadafd56a8e..900679af8a15 100644 --- a/hw/i386/kvm/xen_xenstore.c +++ b/hw/i386/kvm/xen_xenstore.c @@ -15,6 +15,7 @@ #include "qemu/module.h" #include "qemu/main-loop.h" #include "qemu/cutils.h" +#include "qemu/error-report.h" #include "qapi/error.h" #include "qom/object.h" #include "migration/vmstate.h" diff --git a/hw/i386/sgx.c b/hw/i386/sgx.c index db004d17a65d..70305547d4ac 100644 --- a/hw/i386/sgx.c +++ b/hw/i386/sgx.c @@ -18,6 +18,7 @@ #include "monitor/monitor.h" #include "monitor/hmp-target.h" #include "qapi/error.h" +#include "qemu/error-report.h" #include "qapi/qapi-commands-misc-target.h" #include "exec/address-spaces.h" #include "sysemu/hw_accel.h" diff --git a/hw/intc/apic.c b/hw/intc/apic.c index 0ff060f72176..20b5a94073d8 100644 --- a/hw/intc/apic.c +++ b/hw/intc/apic.c @@ -18,6 +18,7 @@ */ #include "qemu/osdep.h" #include "qemu/thread.h" +#include "qemu/error-report.h" #include "hw/i386/apic_internal.h" #include "hw/i386/apic.h" #include "hw/intc/ioapic.h" diff --git a/hw/loongarch/acpi-build.c b/hw/loongarch/acpi-build.c index 6cb2472d3349..8e3ce0736725 100644 --- a/hw/loongarch/acpi-build.c +++ b/hw/loongarch/acpi-build.c @@ -7,6 +7,7 @@ #include "qemu/osdep.h" #include "qapi/error.h" +#include "qemu/error-report.h" #include "qemu/bitmap.h" #include "hw/pci/pci.h" #include "hw/core/cpu.h" diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c index 38ef7cc49f25..b702c3f51e93 100644 --- a/hw/loongarch/virt.c +++ b/hw/loongarch/virt.c @@ -44,6 +44,8 @@ #include "sysemu/tpm.h" #include "sysemu/block-backend.h" #include "hw/block/flash.h" +#include "qemu/error-report.h" + static void virt_flash_create(LoongArchMachineState *lams) { diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c index e0d4a94f9db3..ce8ee50b9e28 100644 --- a/hw/m68k/next-cube.c +++ b/hw/m68k/next-cube.c @@ -24,6 +24,7 @@ #include "hw/block/fdc.h" #include "hw/qdev-properties.h" #include "qapi/error.h" +#include "qemu/error-report.h" #include "ui/console.h" #include "target/m68k/cpu.h" #include "migration/vmstate.h" diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c index 9d52ca661317..b35ecafbc7c6 100644 --- a/hw/m68k/q800.c +++ b/hw/m68k/q800.c @@ -45,6 +45,7 @@ #include "hw/block/swim.h" #include "net/net.h" #include "qapi/error.h" +#include "qemu/error-report.h" #include "sysemu/qtest.h" #include "sysemu/runstate.h" #include "sysemu/reset.h" diff --git a/hw/m68k/virt.c b/hw/m68k/virt.c index 4cb5beef1a0c..754b9bdfcc84 100644 --- a/hw/m68k/virt.c +++ b/hw/m68k/virt.c @@ -23,6 +23,7 @@ #include "bootinfo.h" #include "net/net.h" #include "qapi/error.h" +#include "qemu/error-report.h" #include "sysemu/qtest.h" #include "sysemu/runstate.h" #include "sysemu/reset.h" diff --git a/hw/mem/memory-device.c b/hw/mem/memory-device.c index d9f8301711e2..1636db96799c 100644 --- a/hw/mem/memory-device.c +++ b/hw/mem/memory-device.c @@ -10,6 +10,7 @@ */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "hw/mem/memory-device.h" #include "qapi/error.h" #include "hw/boards.h" diff --git a/hw/mem/sparse-mem.c b/hw/mem/sparse-mem.c index 72f038d47daa..6e8f4f84fbd4 100644 --- a/hw/mem/sparse-mem.c +++ b/hw/mem/sparse-mem.c @@ -11,6 +11,7 @@ */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "hw/qdev-properties.h" #include "hw/sysbus.h" diff --git a/hw/openrisc/boot.c b/hw/openrisc/boot.c index 007e80cd5a0a..55475aa6d608 100644 --- a/hw/openrisc/boot.c +++ b/hw/openrisc/boot.c @@ -15,6 +15,7 @@ #include "sysemu/device_tree.h" #include "sysemu/qtest.h" #include "sysemu/reset.h" +#include "qemu/error-report.h" #include diff --git a/hw/ppc/ppc4xx_sdram.c b/hw/ppc/ppc4xx_sdram.c index 4501fb28a5ea..c0c87ff636a6 100644 --- a/hw/ppc/ppc4xx_sdram.c +++ b/hw/ppc/ppc4xx_sdram.c @@ -33,6 +33,7 @@ #include "qemu/units.h" #include "qapi/error.h" #include "qemu/log.h" +#include "qemu/error-report.h" #include "exec/address-spaces.h" /* get_system_memory() */ #include "hw/irq.h" #include "hw/qdev-properties.h" diff --git a/hw/ppc/spapr_softmmu.c b/hw/ppc/spapr_softmmu.c index 5170a33369e0..278666317ef2 100644 --- a/hw/ppc/spapr_softmmu.c +++ b/hw/ppc/spapr_softmmu.c @@ -1,12 +1,14 @@ #include "qemu/osdep.h" #include "qemu/cutils.h" #include "qemu/memalign.h" +#include "qemu/error-report.h" #include "cpu.h" #include "helper_regs.h" #include "hw/ppc/spapr.h" #include "mmu-hash64.h" #include "mmu-book3s-v3.h" + static inline bool valid_ptex(PowerPCCPU *cpu, target_ulong ptex) { /* diff --git a/hw/riscv/opentitan.c b/hw/riscv/opentitan.c index b06944d38252..bc678766e7c7 100644 --- a/hw/riscv/opentitan.c +++ b/hw/riscv/opentitan.c @@ -22,6 +22,7 @@ #include "qemu/cutils.h" #include "hw/riscv/opentitan.h" #include "qapi/error.h" +#include "qemu/error-report.h" #include "hw/boards.h" #include "hw/misc/unimp.h" #include "hw/riscv/boot.h" diff --git a/hw/riscv/shakti_c.c b/hw/riscv/shakti_c.c index e43cc9445cb1..12ea74b0324b 100644 --- a/hw/riscv/shakti_c.c +++ b/hw/riscv/shakti_c.c @@ -20,6 +20,7 @@ #include "hw/boards.h" #include "hw/riscv/shakti_c.h" #include "qapi/error.h" +#include "qemu/error-report.h" #include "hw/intc/sifive_plic.h" #include "hw/intc/riscv_aclint.h" #include "sysemu/sysemu.h" diff --git a/hw/riscv/virt-acpi-build.c b/hw/riscv/virt-acpi-build.c index 82da0a238c23..7331248f5928 100644 --- a/hw/riscv/virt-acpi-build.c +++ b/hw/riscv/virt-acpi-build.c @@ -29,6 +29,7 @@ #include "hw/acpi/aml-build.h" #include "hw/acpi/utils.h" #include "qapi/error.h" +#include "qemu/error-report.h" #include "sysemu/reset.h" #include "migration/vmstate.h" #include "hw/riscv/virt.h" diff --git a/hw/vfio/display.c b/hw/vfio/display.c index 78f4d82c1c35..bec864f482f4 100644 --- a/hw/vfio/display.c +++ b/hw/vfio/display.c @@ -14,6 +14,7 @@ #include #include +#include "qemu/error-report.h" #include "hw/display/edid.h" #include "ui/console.h" #include "qapi/error.h" diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c index afe3fe7efc40..b31ee79c60b5 100644 --- a/hw/vfio/igd.c +++ b/hw/vfio/igd.c @@ -12,6 +12,7 @@ #include "qemu/osdep.h" #include "qemu/units.h" +#include "qemu/error-report.h" #include "qapi/error.h" #include "hw/hw.h" #include "hw/nvram/fw_cfg.h" diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c index 1a1a8659c859..6b58dddb8859 100644 --- a/hw/vfio/migration.c +++ b/hw/vfio/migration.c @@ -11,6 +11,7 @@ #include "qemu/main-loop.h" #include "qemu/cutils.h" #include "qemu/units.h" +#include "qemu/error-report.h" #include #include diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 150d1d450396..1dbc1f0f9baa 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -18,6 +18,7 @@ #include "qemu/units.h" #include "qemu/selfmap.h" #include "qapi/error.h" +#include "qemu/error-report.h" #include "target_signal.h" #include "accel/tcg/debuginfo.h" diff --git a/migration/dirtyrate.c b/migration/dirtyrate.c index 575d48c3970a..180ba38c7a80 100644 --- a/migration/dirtyrate.c +++ b/migration/dirtyrate.c @@ -11,6 +11,7 @@ */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include #include "qapi/error.h" #include "cpu.h" diff --git a/migration/exec.c b/migration/exec.c index 38604d73a69a..2bf882bbe12b 100644 --- a/migration/exec.c +++ b/migration/exec.c @@ -18,6 +18,7 @@ */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "channel.h" #include "exec.h" #include "migration.h" diff --git a/target/i386/cpu.c b/target/i386/cpu.c index cab1e2a957e4..6576287e5b6c 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -29,6 +29,7 @@ #include "kvm/kvm_i386.h" #include "sev.h" #include "qapi/error.h" +#include "qemu/error-report.h" #include "qapi/qapi-visit-machine.h" #include "qapi/qmp/qerror.h" #include "standard-headers/asm-x86/kvm_para.h" diff --git a/target/i386/host-cpu.c b/target/i386/host-cpu.c index 10f8aba86e53..92ecb7254b83 100644 --- a/target/i386/host-cpu.c +++ b/target/i386/host-cpu.c @@ -11,6 +11,7 @@ #include "cpu.h" #include "host-cpu.h" #include "qapi/error.h" +#include "qemu/error-report.h" #include "sysemu/sysemu.h" /* Note: Only safe for use on x86(-64) hosts */ diff --git a/target/i386/kvm/xen-emu.c b/target/i386/kvm/xen-emu.c index 0bb6c601c948..d7c7eb8d9c8e 100644 --- a/target/i386/kvm/xen-emu.c +++ b/target/i386/kvm/xen-emu.c @@ -12,6 +12,7 @@ #include "qemu/osdep.h" #include "qemu/log.h" #include "qemu/main-loop.h" +#include "qemu/error-report.h" #include "hw/xen/xen.h" #include "sysemu/kvm_int.h" #include "sysemu/kvm_xen.h" diff --git a/target/i386/sev.c b/target/i386/sev.c index 0ec970496e5d..859e06f6ad77 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -23,6 +23,7 @@ #include "qemu/base64.h" #include "qemu/module.h" #include "qemu/uuid.h" +#include "qemu/error-report.h" #include "crypto/hash.h" #include "sysemu/kvm.h" #include "sev.h" diff --git a/target/i386/whpx/whpx-apic.c b/target/i386/whpx/whpx-apic.c index c15df35ad60a..8710e37567d0 100644 --- a/target/i386/whpx/whpx-apic.c +++ b/target/i386/whpx/whpx-apic.c @@ -11,6 +11,7 @@ * See the COPYING file in the top-level directory. */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "cpu.h" #include "hw/i386/apic_internal.h" #include "hw/i386/apic-msidef.h" diff --git a/target/mips/cpu.c b/target/mips/cpu.c index 543da911e381..01e0fbe10db2 100644 --- a/target/mips/cpu.c +++ b/target/mips/cpu.c @@ -21,6 +21,7 @@ #include "qemu/osdep.h" #include "qemu/cutils.h" #include "qemu/qemu-print.h" +#include "qemu/error-report.h" #include "qapi/error.h" #include "cpu.h" #include "internal.h" diff --git a/target/s390x/cpu-sysemu.c b/target/s390x/cpu-sysemu.c index 948e4bd3e09e..97d6c760a826 100644 --- a/target/s390x/cpu-sysemu.c +++ b/target/s390x/cpu-sysemu.c @@ -21,6 +21,7 @@ */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qapi/error.h" #include "cpu.h" #include "s390x-internal.h" diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c index 065ec6d66cdb..457b5cb10c48 100644 --- a/target/s390x/cpu_models.c +++ b/target/s390x/cpu_models.c @@ -17,6 +17,7 @@ #include "sysemu/kvm.h" #include "sysemu/tcg.h" #include "qapi/error.h" +#include "qemu/error-report.h" #include "qapi/visitor.h" #include "qemu/module.h" #include "qemu/hw-version.h" diff --git a/target/s390x/diag.c b/target/s390x/diag.c index 76b01dcd68bb..e5f0df19e764 100644 --- a/target/s390x/diag.c +++ b/target/s390x/diag.c @@ -22,6 +22,8 @@ #include "hw/s390x/pv.h" #include "sysemu/kvm.h" #include "kvm/kvm_s390x.h" +#include "qemu/error-report.h" + int handle_diag_288(CPUS390XState *env, uint64_t r1, uint64_t r3) { diff --git a/ui/cocoa.m b/ui/cocoa.m index 985a0f50696b..168170a8a68a 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -46,6 +46,7 @@ #include "qemu/cutils.h" #include "qemu/main-loop.h" #include "qemu/module.h" +#include "qemu/error-report.h" #include #include "hw/core/cpu.h" From 720ace24ae54dffca8d2cf8a5ba019dcfc86d8d9 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Wed, 15 Mar 2023 17:43:14 +0000 Subject: [PATCH 15/35] *: Add missing includes of qemu/plugin.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This had been pulled in from hw/core/cpu.h, but that will be removed. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20230310195252.210956-6-richard.henderson@linaro.org> [AJB: also syscall-trace.h] Signed-off-by: Alex Bennée Message-Id: <20230315174331.2959-16-alex.bennee@linaro.org> Reviewed-by: Emilio Cota --- accel/tcg/cpu-exec-common.c | 1 + cpu.c | 1 + include/user/syscall-trace.h | 1 + linux-user/exit.c | 1 + linux-user/syscall.c | 1 + 5 files changed, 5 insertions(+) diff --git a/accel/tcg/cpu-exec-common.c b/accel/tcg/cpu-exec-common.c index 176ea5728114..e7962c934897 100644 --- a/accel/tcg/cpu-exec-common.c +++ b/accel/tcg/cpu-exec-common.c @@ -21,6 +21,7 @@ #include "sysemu/cpus.h" #include "sysemu/tcg.h" #include "exec/exec-all.h" +#include "qemu/plugin.h" bool tcg_allowed; diff --git a/cpu.c b/cpu.c index 567b23af46c2..849bac062cfa 100644 --- a/cpu.c +++ b/cpu.c @@ -42,6 +42,7 @@ #include "hw/core/accel-cpu.h" #include "trace/trace-root.h" #include "qemu/accel.h" +#include "qemu/plugin.h" uintptr_t qemu_host_page_size; intptr_t qemu_host_page_mask; diff --git a/include/user/syscall-trace.h b/include/user/syscall-trace.h index c5a220da34e4..90bda7631c89 100644 --- a/include/user/syscall-trace.h +++ b/include/user/syscall-trace.h @@ -11,6 +11,7 @@ #define SYSCALL_TRACE_H #include "exec/user/abitypes.h" +#include "qemu/plugin.h" #include "trace/trace-root.h" /* diff --git a/linux-user/exit.c b/linux-user/exit.c index fd49d76f450f..3017d28a3c3b 100644 --- a/linux-user/exit.c +++ b/linux-user/exit.c @@ -21,6 +21,7 @@ #include "gdbstub/syscalls.h" #include "qemu.h" #include "user-internals.h" +#include "qemu/plugin.h" #ifdef CONFIG_GPROF #include #endif diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 24cea6fb6a63..27871641f417 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -22,6 +22,7 @@ #include "qemu/path.h" #include "qemu/memfd.h" #include "qemu/queue.h" +#include "qemu/plugin.h" #include "target_mman.h" #include #include From aa4cf6eb82954fa9d4bb7c5dfee9bad830bfa91d Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Wed, 15 Mar 2023 17:43:15 +0000 Subject: [PATCH 16/35] include/qemu: Split out plugin-event.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The usage in hw/core/cpu.h only requires QEMU_PLUGIN_EV_MAX. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20230310195252.210956-7-richard.henderson@linaro.org> Signed-off-by: Alex Bennée Message-Id: <20230315174331.2959-17-alex.bennee@linaro.org> Reviewed-by: Emilio Cota --- include/hw/core/cpu.h | 2 +- include/qemu/plugin-event.h | 26 ++++++++++++++++++++++++++ include/qemu/plugin.h | 17 +---------------- 3 files changed, 28 insertions(+), 17 deletions(-) create mode 100644 include/qemu/plugin-event.h diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 75689bff0231..821e937020b5 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -30,7 +30,7 @@ #include "qemu/rcu_queue.h" #include "qemu/queue.h" #include "qemu/thread.h" -#include "qemu/plugin.h" +#include "qemu/plugin-event.h" #include "qom/object.h" typedef int (*WriteCoreDumpFunction)(const void *buf, size_t size, diff --git a/include/qemu/plugin-event.h b/include/qemu/plugin-event.h new file mode 100644 index 000000000000..7056d8427b7e --- /dev/null +++ b/include/qemu/plugin-event.h @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2017, Emilio G. Cota + * + * License: GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ +#ifndef QEMU_PLUGIN_EVENT_H +#define QEMU_PLUGIN_EVENT_H + +/* + * Events that plugins can subscribe to. + */ +enum qemu_plugin_event { + QEMU_PLUGIN_EV_VCPU_INIT, + QEMU_PLUGIN_EV_VCPU_EXIT, + QEMU_PLUGIN_EV_VCPU_TB_TRANS, + QEMU_PLUGIN_EV_VCPU_IDLE, + QEMU_PLUGIN_EV_VCPU_RESUME, + QEMU_PLUGIN_EV_VCPU_SYSCALL, + QEMU_PLUGIN_EV_VCPU_SYSCALL_RET, + QEMU_PLUGIN_EV_FLUSH, + QEMU_PLUGIN_EV_ATEXIT, + QEMU_PLUGIN_EV_MAX, /* total number of plugin events we support */ +}; + +#endif /* QEMU_PLUGIN_EVENT_H */ diff --git a/include/qemu/plugin.h b/include/qemu/plugin.h index e0ebedef84ff..6bf4bce1883d 100644 --- a/include/qemu/plugin.h +++ b/include/qemu/plugin.h @@ -12,24 +12,9 @@ #include "qemu/error-report.h" #include "qemu/queue.h" #include "qemu/option.h" +#include "qemu/plugin-event.h" #include "exec/memopidx.h" -/* - * Events that plugins can subscribe to. - */ -enum qemu_plugin_event { - QEMU_PLUGIN_EV_VCPU_INIT, - QEMU_PLUGIN_EV_VCPU_EXIT, - QEMU_PLUGIN_EV_VCPU_TB_TRANS, - QEMU_PLUGIN_EV_VCPU_IDLE, - QEMU_PLUGIN_EV_VCPU_RESUME, - QEMU_PLUGIN_EV_VCPU_SYSCALL, - QEMU_PLUGIN_EV_VCPU_SYSCALL_RET, - QEMU_PLUGIN_EV_FLUSH, - QEMU_PLUGIN_EV_ATEXIT, - QEMU_PLUGIN_EV_MAX, /* total number of plugin events we support */ -}; - /* * Option parsing/processing. * Note that we can load an arbitrary number of plugins. From 507271d4680d1c3b6041b6c65d975824624b149a Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Wed, 15 Mar 2023 17:43:16 +0000 Subject: [PATCH 17/35] include/qemu/plugin: Inline qemu_plugin_disable_mem_helpers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Now that we've broken the include loop with cpu.h, we can bring this inline. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20230310195252.210956-8-richard.henderson@linaro.org> Signed-off-by: Alex Bennée Message-Id: <20230315174331.2959-18-alex.bennee@linaro.org> Reviewed-by: Emilio Cota --- include/qemu/plugin.h | 6 +++++- plugins/core.c | 11 ----------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/include/qemu/plugin.h b/include/qemu/plugin.h index 6bf4bce1883d..bc0781cab887 100644 --- a/include/qemu/plugin.h +++ b/include/qemu/plugin.h @@ -14,6 +14,7 @@ #include "qemu/option.h" #include "qemu/plugin-event.h" #include "exec/memopidx.h" +#include "hw/core/cpu.h" /* * Option parsing/processing. @@ -204,7 +205,10 @@ void qemu_plugin_atexit_cb(void); void qemu_plugin_add_dyn_cb_arr(GArray *arr); -void qemu_plugin_disable_mem_helpers(CPUState *cpu); +static inline void qemu_plugin_disable_mem_helpers(CPUState *cpu) +{ + cpu->plugin_mem_cbs = NULL; +} /** * qemu_plugin_user_exit(): clean-up callbacks before calling exit callbacks diff --git a/plugins/core.c b/plugins/core.c index 04632886b905..9912f2cfdbb2 100644 --- a/plugins/core.c +++ b/plugins/core.c @@ -553,17 +553,6 @@ void qemu_plugin_user_postfork(bool is_child) } } - -/* - * Call this function after longjmp'ing to the main loop. It's possible that the - * last instruction of a TB might have used helpers, and therefore the - * "disable" instruction will never execute because it ended up as dead code. - */ -void qemu_plugin_disable_mem_helpers(CPUState *cpu) -{ - cpu->plugin_mem_cbs = NULL; -} - static bool plugin_dyn_cb_arr_cmp(const void *ap, const void *bp) { return ap == bp; From 3b67f43cf301ce8920a68e90a2ec3fc8cbe4e36d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Wed, 22 Mar 2023 12:36:38 +0000 Subject: [PATCH 18/35] tests/vm: skip X11 in openbsd installation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As a VM used only for automated testing there is no need to install the X11 stack. Signed-off-by: Daniel P. Berrangé Reviewed-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20230322123639.836104-2-berrange@redhat.com> Signed-off-by: Alex Bennée --- tests/vm/openbsd | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/vm/openbsd b/tests/vm/openbsd index eaeb201e9103..6af7afac0d31 100755 --- a/tests/vm/openbsd +++ b/tests/vm/openbsd @@ -106,8 +106,7 @@ class OpenBSDVM(basevm.BaseVM): self.console_wait("Password for root account") self.console_send("%s\n" % self._config["root_pass"]) self.console_wait_send("Start sshd(8)", "yes\n") - self.console_wait_send("X Window System", "\n") - self.console_wait_send("xenodm", "\n") + self.console_wait_send("X Window System", "no\n") self.console_wait_send("console to com0", "\n") self.console_wait_send("Which speed", "\n") From 85b983485be712e3bf74d2352cbd451cb1163c21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Wed, 22 Mar 2023 12:36:39 +0000 Subject: [PATCH 19/35] tests/vm: custom openbsd partitioning to increase /home space MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The openbsd image is 20GB in size, but the automatic partitioning done by the installer leaves /home with a mere ~3.5 GB of space, wasting free space across many other partitions that are not used by our build process: openbsd$ df Filesystem 512-blocks Used Avail Capacity Mounted on /dev/sd0a 1229692 213592 954616 18% / /dev/sd0k 7672220 40 7288572 0% /home /dev/sd0d 1736604 24 1649752 0% /tmp /dev/sd0f 4847676 2505124 2100172 54% /usr /dev/sd0g 1326684 555656 704696 44% /usr/X11R6 /dev/sd0h 4845436 1445932 3157236 31% /usr/local /dev/sd0j 10898972 4 10354020 0% /usr/obj /dev/sd0i 3343644 4 3176460 0% /usr/src /dev/sd0e 2601212 19840 2451312 1% /var This change tells the installer todo custom partitioning with 4 GB on /, 256 MB swap, and the remaining ~15GB for /home openbsd$ df Filesystem 512-blocks Used Avail Capacity Mounted on /dev/sd0a 7932412 4740204 2795588 63% / /dev/sd0d 32164636 40 30556368 0% /home This will avoid ENOSPC failures when tests that need to create big files (disk images) run in parallel. Signed-off-by: Daniel P. Berrangé Acked-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20230322123639.836104-3-berrange@redhat.com> Signed-off-by: Alex Bennée --- tests/vm/openbsd | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/tests/vm/openbsd b/tests/vm/openbsd index 6af7afac0d31..6b4fc29793b7 100755 --- a/tests/vm/openbsd +++ b/tests/vm/openbsd @@ -123,7 +123,32 @@ class OpenBSDVM(basevm.BaseVM): self.console_wait_send("timezone", "UTC\n") self.console_wait_send("root disk", "\n") self.console_wait_send("(W)hole disk", "\n") - self.console_wait_send("(A)uto layout", "\n") + self.console_wait_send("(A)uto layout", "c\n") + + # 4000 MB / as /dev/sd0a, at start of disk + self.console_wait_send("sd0>", "a a\n") + self.console_wait_send("offset:", "\n") + self.console_wait_send("size:", "4000M\n") + self.console_wait_send("FS type", "4.2BSD\n") + self.console_wait_send("mount point:", "/\n") + + # 256 MB swap as /dev/sd0b + self.console_wait_send("sd0*>", "a b\n") + self.console_wait_send("offset:", "\n") + self.console_wait_send("size:", "256M\n") + self.console_wait_send("FS type", "swap\n") + + # All remaining space for /home as /dev/sd0d + # NB, 'c' isn't allowed to be used. + self.console_wait_send("sd0*>", "a d\n") + self.console_wait_send("offset:", "\n") + self.console_wait_send("size:", "\n") + self.console_wait_send("FS type", "4.2BSD\n") + self.console_wait_send("mount point:", "/home\n") + + self.console_wait_send("sd0*>", "q\n") + self.console_wait_send("Write new label?:", "y\n") + self.console_wait_send("Location of sets", "cd0\n") self.console_wait_send("Pathname to the sets", "\n") self.console_wait_send("Set name(s)", "\n") From 0c8076b024cd55c8b59323f3aa7c88481436eb3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Wed, 15 Mar 2023 17:43:17 +0000 Subject: [PATCH 20/35] iotests: explicitly pass source/build dir to 'check' command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The 'check' script has some rather dubious logic whereby it assumes that if invoked as a symlink, then it is running from a separate source tree and build tree, otherwise it assumes the current working directory is a combined source and build tree. This doesn't work if you want to invoke the 'check' script using its full source tree path while still using a split source and build tree layout. This would be a typical situation with meson if you ask it to find the 'check' script path using files('check'). Rather than trying to make the logic more magical, add support for explicitly passing the dirs using --source-dir and --build-dir. If either is omitted the current logic is maintained. Signed-off-by: Daniel P. Berrangé Reviewed-by: Thomas Huth Acked-by: Hanna Czenczek Tested-by: Thomas Huth Message-Id: <20230303160727.3977246-2-berrange@redhat.com> Signed-off-by: Alex Bennée Message-Id: <20230315174331.2959-19-alex.bennee@linaro.org> --- tests/qemu-iotests/check | 25 +++++++++++++++++++++++-- tests/qemu-iotests/testenv.py | 13 ++++--------- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check index 9bdda1394e73..da7e8a87fed7 100755 --- a/tests/qemu-iotests/check +++ b/tests/qemu-iotests/check @@ -26,9 +26,23 @@ from findtests import TestFinder from testenv import TestEnv from testrunner import TestRunner +def get_default_path(follow_link=False): + """ + Try to automagically figure out the path we are running from. + """ + # called from the build tree? + if os.path.islink(sys.argv[0]): + if follow_link: + return os.path.dirname(os.readlink(sys.argv[0])) + else: + return os.path.dirname(os.path.abspath(sys.argv[0])) + else: # or source tree? + return os.getcwd() def make_argparser() -> argparse.ArgumentParser: - p = argparse.ArgumentParser(description="Test run options") + p = argparse.ArgumentParser( + description="Test run options", + formatter_class=argparse.ArgumentDefaultsHelpFormatter) p.add_argument('-n', '--dry-run', action='store_true', help='show me, do not run tests') @@ -113,6 +127,11 @@ def make_argparser() -> argparse.ArgumentParser: 'middle of the process.') g_sel.add_argument('tests', metavar='TEST_FILES', nargs='*', help='tests to run, or "--" followed by a command') + g_sel.add_argument('--build-dir', default=get_default_path(), + help='Path to iotests build directory') + g_sel.add_argument('--source-dir', + default=get_default_path(follow_link=True), + help='Path to iotests build directory') return p @@ -120,7 +139,9 @@ def make_argparser() -> argparse.ArgumentParser: if __name__ == '__main__': args = make_argparser().parse_args() - env = TestEnv(imgfmt=args.imgfmt, imgproto=args.imgproto, + env = TestEnv(source_dir=args.source_dir, + build_dir=args.build_dir, + imgfmt=args.imgfmt, imgproto=args.imgproto, aiomode=args.aiomode, cachemode=args.cachemode, imgopts=args.imgopts, misalign=args.misalign, debug=args.debug, valgrind=args.valgrind, diff --git a/tests/qemu-iotests/testenv.py b/tests/qemu-iotests/testenv.py index a864c74b1234..aa9d73541458 100644 --- a/tests/qemu-iotests/testenv.py +++ b/tests/qemu-iotests/testenv.py @@ -170,7 +170,8 @@ def root(*names: str) -> str: if not isxfile(b): sys.exit('Not executable: ' + b) - def __init__(self, imgfmt: str, imgproto: str, aiomode: str, + def __init__(self, source_dir: str, build_dir: str, + imgfmt: str, imgproto: str, aiomode: str, cachemode: Optional[str] = None, imgopts: Optional[str] = None, misalign: bool = False, @@ -211,14 +212,8 @@ def __init__(self, imgfmt: str, imgproto: str, aiomode: str, # which are needed to initialize some environment variables. They are # used by init_*() functions as well. - if os.path.islink(sys.argv[0]): - # called from the build tree - self.source_iotests = os.path.dirname(os.readlink(sys.argv[0])) - self.build_iotests = os.path.dirname(os.path.abspath(sys.argv[0])) - else: - # called from the source tree - self.source_iotests = os.getcwd() - self.build_iotests = self.source_iotests + self.source_iotests = source_dir + self.build_iotests = build_dir self.build_root = os.path.join(self.build_iotests, '..', '..') From a9e21786da4f83d90d1ad82ce071b592abfca1b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Wed, 15 Mar 2023 17:43:18 +0000 Subject: [PATCH 21/35] iotests: allow test discovery before building MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The 'check' script can be invoked in "dry run" mode, in which case it merely does test discovery and prints out all their names. Despite only doing test discovery it still validates that the various QEMU binaries can be found. This makes it impossible todo test discovery prior to building QEMU. This is a desirable feature to support, because it will let meson discover tests. Fortunately the code in the TestEnv constructor is ordered in a way that makes this fairly trivial to achieve. We can just short circuit the constructor after the basic directory paths have been set. Reviewed-by: Thomas Huth Reviewed-by: Alex Bennée Signed-off-by: Daniel P. Berrangé Acked-by: Hanna Czenczek Tested-by: Thomas Huth Message-Id: <20230303160727.3977246-3-berrange@redhat.com> Signed-off-by: Alex Bennée Message-Id: <20230315174331.2959-20-alex.bennee@linaro.org> --- tests/qemu-iotests/check | 3 ++- tests/qemu-iotests/testenv.py | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check index da7e8a87fed7..bb294ef556d2 100755 --- a/tests/qemu-iotests/check +++ b/tests/qemu-iotests/check @@ -145,7 +145,8 @@ if __name__ == '__main__': aiomode=args.aiomode, cachemode=args.cachemode, imgopts=args.imgopts, misalign=args.misalign, debug=args.debug, valgrind=args.valgrind, - gdb=args.gdb, qprint=args.print) + gdb=args.gdb, qprint=args.print, + dry_run=args.dry_run) if len(sys.argv) > 1 and sys.argv[-len(args.tests)-1] == '--': if not args.tests: diff --git a/tests/qemu-iotests/testenv.py b/tests/qemu-iotests/testenv.py index aa9d73541458..9a37ad915291 100644 --- a/tests/qemu-iotests/testenv.py +++ b/tests/qemu-iotests/testenv.py @@ -178,7 +178,8 @@ def __init__(self, source_dir: str, build_dir: str, debug: bool = False, valgrind: bool = False, gdb: bool = False, - qprint: bool = False) -> None: + qprint: bool = False, + dry_run: bool = False) -> None: self.imgfmt = imgfmt self.imgproto = imgproto self.aiomode = aiomode @@ -218,6 +219,10 @@ def __init__(self, source_dir: str, build_dir: str, self.build_root = os.path.join(self.build_iotests, '..', '..') self.init_directories() + + if dry_run: + return + self.init_binaries() self.malloc_perturb_ = os.getenv('MALLOC_PERTURB_', From 663755b02247b848d4a342072a528ae1d402611c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Wed, 15 Mar 2023 17:43:19 +0000 Subject: [PATCH 22/35] iotests: strip subdir path when listing tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When asking 'check' to list individual tests by invoking it in dry run mode, it prints the paths to the tests relative to the base of the I/O test directory. When asking 'check' to run an individual test, however, it mandates that only the unqualified test name is given, without any path prefix. This inconsistency makes it harder to ask for a list of tests and then invoke each one. Thus the test listing code is change to flatten the test names, by printing only the base name, which can be directly invoked. Reviewed-by: Alex Bennée Signed-off-by: Daniel P. Berrangé Acked-by: Hanna Czenczek Tested-by: Thomas Huth Message-Id: <20230303160727.3977246-4-berrange@redhat.com> Signed-off-by: Alex Bennée Message-Id: <20230315174331.2959-21-alex.bennee@linaro.org> --- tests/qemu-iotests/check | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check index bb294ef556d2..f2e9d27dcf54 100755 --- a/tests/qemu-iotests/check +++ b/tests/qemu-iotests/check @@ -184,7 +184,7 @@ if __name__ == '__main__': sys.exit(str(e)) if args.dry_run: - print('\n'.join(tests)) + print('\n'.join([os.path.basename(t) for t in tests])) else: with TestRunner(env, tap=args.tap, color=args.color) as tr: From 6e5792a1f6ecc155fc977e3813e75fc8ede478ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Wed, 15 Mar 2023 17:43:20 +0000 Subject: [PATCH 23/35] iotests: print TAP protocol version when reporting tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Recently meson started complaining that TAP test reports don't include the TAP protocol version. While this warning is bogus and has since been removed from Meson, it looks like good practice to include this header going forward. The GLib library test harness has started unconditionally printing the version, so this brings the I/O tests into line. Reviewed-by: Thomas Huth Reviewed-by: Alex Bennée Signed-off-by: Daniel P. Berrangé Acked-by: Hanna Czenczek Tested-by: Thomas Huth Message-Id: <20230303160727.3977246-5-berrange@redhat.com> Signed-off-by: Alex Bennée Message-Id: <20230315174331.2959-22-alex.bennee@linaro.org> --- tests/qemu-iotests/testrunner.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/qemu-iotests/testrunner.py b/tests/qemu-iotests/testrunner.py index 5a771da86ed3..e734800b3da0 100644 --- a/tests/qemu-iotests/testrunner.py +++ b/tests/qemu-iotests/testrunner.py @@ -391,6 +391,7 @@ def run_tests(self, tests: List[str], jobs: int = 1) -> bool: casenotrun = [] if self.tap: + print('TAP version 13') self.env.print_env('# ') print('1..%d' % len(tests)) else: From cb845eaa88eb266c5023af06989e94d95c712871 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Wed, 15 Mar 2023 17:43:21 +0000 Subject: [PATCH 24/35] iotests: connect stdin to /dev/null when running tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently the tests have their stdin inherited from the test harness, meaning they are connected to a TTY. The QEMU processes spawned by certain tests, however, modify TTY settings and if the test exits abnormally the settings might not be restored. The python test harness thus has some logic which will capture the initial TTY settings and restore them once all tests are finished. This does not, however, take into account the possibility of many copies of the 'check' program running in parallel. With parallel execution, a later invokation may save the TTY state that QEMU has already modified, and thus restore bad state leaving the TTY non-functional. None of the I/O tests shnould actually be interactive requiring user input and so they should not require a TTY at all. To avoid this while TTY save/restore complexity we can connect the test stdin to /dev/null instead. Signed-off-by: Daniel P. Berrangé Reviewed-by: Thomas Huth Acked-by: Hanna Czenczek Tested-by: Thomas Huth Message-Id: <20230303160727.3977246-6-berrange@redhat.com> Signed-off-by: Alex Bennée Message-Id: <20230315174331.2959-23-alex.bennee@linaro.org> --- tests/qemu-iotests/testrunner.py | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/tests/qemu-iotests/testrunner.py b/tests/qemu-iotests/testrunner.py index e734800b3da0..81519ed6e2ed 100644 --- a/tests/qemu-iotests/testrunner.py +++ b/tests/qemu-iotests/testrunner.py @@ -24,12 +24,10 @@ import subprocess import contextlib import json -import termios import shutil import sys from multiprocessing import Pool -from contextlib import contextmanager -from typing import List, Optional, Iterator, Any, Sequence, Dict, \ +from typing import List, Optional, Any, Sequence, Dict, \ ContextManager from testenv import TestEnv @@ -56,22 +54,6 @@ def file_diff(file1: str, file2: str) -> List[str]: return res -# We want to save current tty settings during test run, -# since an aborting qemu call may leave things screwed up. -@contextmanager -def savetty() -> Iterator[None]: - isterm = sys.stdin.isatty() - if isterm: - fd = sys.stdin.fileno() - attr = termios.tcgetattr(fd) - - try: - yield - finally: - if isterm: - termios.tcsetattr(fd, termios.TCSADRAIN, attr) - - class LastElapsedTime(ContextManager['LastElapsedTime']): """ Cache for elapsed time for tests, to show it during new test run @@ -169,7 +151,6 @@ def __enter__(self) -> 'TestRunner': self._stack = contextlib.ExitStack() self._stack.enter_context(self.env) self._stack.enter_context(self.last_elapsed) - self._stack.enter_context(savetty()) return self def __exit__(self, exc_type: Any, exc_value: Any, traceback: Any) -> None: @@ -294,6 +275,7 @@ def do_run_test(self, test: str, mp: bool) -> TestResult: t0 = time.time() with f_bad.open('w', encoding="utf-8") as f: with subprocess.Popen(args, cwd=str(f_test.parent), env=env, + stdin=subprocess.DEVNULL, stdout=f, stderr=subprocess.STDOUT) as proc: try: proc.wait() From 5ba7db0938c8b8e6e457b9aab8c6c625913d773f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Wed, 15 Mar 2023 17:43:22 +0000 Subject: [PATCH 25/35] iotests: always use a unique sub-directory per test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The current test runner is only safe against parallel execution within a single instance of the 'check' process, and only if -j is given a value greater than 2. This prevents running multiple copies of the 'check' process for different test scenarios. This change switches the output / socket directories to always include the test name, image format and image protocol. This should allow full parallelism of all distinct test scenarios. eg running both qcow2 and raw tests at the same time, or both file and nbd tests at the same time. It would be possible to allow for parallelism of the same test scenario by including the pid, but that would potentially let many directories accumulate over time on failures, so is not done. Signed-off-by: Daniel P. Berrangé Reviewed-by: Thomas Huth Acked-by: Hanna Czenczek Tested-by: Thomas Huth Message-Id: <20230303160727.3977246-7-berrange@redhat.com> Signed-off-by: Alex Bennée Message-Id: <20230315174331.2959-24-alex.bennee@linaro.org> --- tests/qemu-iotests/testrunner.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/qemu-iotests/testrunner.py b/tests/qemu-iotests/testrunner.py index 81519ed6e2ed..7b322272e920 100644 --- a/tests/qemu-iotests/testrunner.py +++ b/tests/qemu-iotests/testrunner.py @@ -228,13 +228,11 @@ def find_reference(self, test: str) -> str: return f'{test}.out' - def do_run_test(self, test: str, mp: bool) -> TestResult: + def do_run_test(self, test: str) -> TestResult: """ Run one test :param test: test file path - :param mp: if true, we are in a multiprocessing environment, use - personal subdirectories for test run Note: this method may be called from subprocess, so it does not change ``self`` object in any way! @@ -257,12 +255,14 @@ def do_run_test(self, test: str, mp: bool) -> TestResult: args = [str(f_test.resolve())] env = self.env.prepare_subprocess(args) - if mp: - # Split test directories, so that tests running in parallel don't - # break each other. - for d in ['TEST_DIR', 'SOCK_DIR']: - env[d] = os.path.join(env[d], f_test.name) - Path(env[d]).mkdir(parents=True, exist_ok=True) + + # Split test directories, so that tests running in parallel don't + # break each other. + for d in ['TEST_DIR', 'SOCK_DIR']: + env[d] = os.path.join( + env[d], + f"{self.env.imgfmt}-{self.env.imgproto}-{f_test.name}") + Path(env[d]).mkdir(parents=True, exist_ok=True) test_dir = env['TEST_DIR'] f_bad = Path(test_dir, f_test.name + '.out.bad') @@ -347,7 +347,7 @@ def run_test(self, test: str, testname = os.path.basename(test) print(f'# running {self.env.imgfmt} {testname}') - res = self.do_run_test(test, mp) + res = self.do_run_test(test) end = datetime.datetime.now().strftime('%H:%M:%S') self.test_print_one_line(test=test, From 51ab5f8bd795d8980351f8531e54995ff9e6d163 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Wed, 15 Mar 2023 17:43:23 +0000 Subject: [PATCH 26/35] iotests: register each I/O test separately with meson MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently meson registers a single test that invokes an entire group of I/O tests, hiding the test granularity from meson. There are various downsides of doing this * You cannot ask 'meson test' to invoke a single I/O test * The meson test timeout can't be applied to the individual tests * Meson only gets a pass/fail for the overall I/O test group not individual tests * If a CI job gets killed by the GitLab timeout, we don't get visibility into how far through the I/O tests execution got. This switches meson to perform test discovery by invoking 'check' in dry-run mode. It then registers one meson test case for each I/O test. Parallel execution remains disabled since the I/O tests do not use self contained execution environments and thus conflict with each other. Signed-off-by: Daniel P. Berrangé Reviewed-by: Thomas Huth Acked-by: Hanna Czenczek Tested-by: Thomas Huth Message-Id: <20230303160727.3977246-8-berrange@redhat.com> Signed-off-by: Alex Bennée Message-Id: <20230315174331.2959-25-alex.bennee@linaro.org> --- tests/qemu-iotests/meson.build | 35 ++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/tests/qemu-iotests/meson.build b/tests/qemu-iotests/meson.build index 323a4acb6a3f..a162f683ef61 100644 --- a/tests/qemu-iotests/meson.build +++ b/tests/qemu-iotests/meson.build @@ -32,16 +32,39 @@ foreach k, v : emulators endif endforeach +qemu_iotests_check_cmd = files('check') + foreach format, speed: qemu_iotests_formats if speed == 'quick' suites = 'block' else suites = ['block-' + speed, speed] endif - test('qemu-iotests ' + format, sh, args: [files('../check-block.sh'), format], - depends: qemu_iotests_binaries, env: qemu_iotests_env, - protocol: 'tap', - suite: suites, - timeout: 0, - is_parallel: false) + + args = ['-tap', '-' + format] + if speed == 'quick' + args += ['-g', 'auto'] + endif + + rc = run_command( + [qemu_iotests_check_cmd] + args + ['-n'], + check: true, + ) + + foreach item: rc.stdout().strip().split() + args = ['-tap', '-' + format, item, + '--source-dir', meson.current_source_dir(), + '--build-dir', meson.current_build_dir()] + # Some individual tests take as long as 45 seconds + # Bump the timeout to 3 minutes for some headroom + # on slow machines to minimize spurious failures + test('io-' + format + '-' + item, + qemu_iotests_check_cmd, + args: args, + depends: qemu_iotests_binaries, + env: qemu_iotests_env, + protocol: 'tap', + timeout: 180, + suite: suites) + endforeach endforeach From 0d01a2f8a4e2d4ddc6229f8a3a84197ac7db6b3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Wed, 15 Mar 2023 17:43:24 +0000 Subject: [PATCH 27/35] iotests: remove the check-block.sh script MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Now that meson directly invokes the individual I/O tests, the check-block.sh wrapper script is no longer required. Signed-off-by: Daniel P. Berrangé Reviewed-by: Thomas Huth Acked-by: Hanna Czenczek Tested-by: Thomas Huth Message-Id: <20230303160727.3977246-9-berrange@redhat.com> Signed-off-by: Alex Bennée Message-Id: <20230315174331.2959-26-alex.bennee@linaro.org> --- tests/check-block.sh | 43 ------------------------------------------- 1 file changed, 43 deletions(-) delete mode 100755 tests/check-block.sh diff --git a/tests/check-block.sh b/tests/check-block.sh deleted file mode 100755 index 5de2c1ba0b30..000000000000 --- a/tests/check-block.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/sh - -if [ "$#" -eq 0 ]; then - echo "Usage: $0 fmt..." >&2 - exit 99 -fi - -# Honor the SPEED environment variable, just like we do it for "meson test" -format_list="$@" -if [ "$SPEED" = "slow" ] || [ "$SPEED" = "thorough" ]; then - group= -else - group="-g auto" -fi - -skip() { - echo "1..0 #SKIP $*" - exit 0 -} - -if [ -z "$(find . -name 'qemu-system-*' -print)" ]; then - skip "No qemu-system binary available ==> Not running the qemu-iotests." -fi - -cd tests/qemu-iotests - -# QEMU_CHECK_BLOCK_AUTO is used to disable some unstable sub-tests -export QEMU_CHECK_BLOCK_AUTO=1 -export PYTHONUTF8=1 -# If make was called with -jN we want to call ./check with -j N. Extract the -# flag from MAKEFLAGS, so that if it absent (or MAKEFLAGS is not defined), JOBS -# would be an empty line otherwise JOBS is prepared string of flag with value: -# "-j N" -# Note, that the following works even if make was called with "-j N" or even -# "--jobs N", as all these variants becomes simply "-jN" in MAKEFLAGS variable. -JOBS=$(echo "$MAKEFLAGS" | sed -n 's/\(^\|.* \)-j\([0-9]\+\)\( .*\|$\)/-j \2/p') - -ret=0 -for fmt in $format_list ; do - ${PYTHON} ./check $JOBS -tap -$fmt $group || ret=1 -done - -exit $ret From e00c621bbab17a3a0b282c2dcc37ac4d94579107 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= Date: Wed, 15 Mar 2023 17:43:25 +0000 Subject: [PATCH 28/35] contrib/gitdm: Add ASPEED Technology to the domain map MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We have a number of contributors from this domain which is a corporate endeavour. Signed-off-by: Alex Bennée Cc: Steven Lee Cc: Troy Lee Cc: Howard Chiu Cc: Jamin Lin Reviewed-by: Troy Lee Message-Id: <20230315174331.2959-27-alex.bennee@linaro.org> --- contrib/gitdm/domain-map | 1 + 1 file changed, 1 insertion(+) diff --git a/contrib/gitdm/domain-map b/contrib/gitdm/domain-map index 8913a886c97a..65e40fe8e16b 100644 --- a/contrib/gitdm/domain-map +++ b/contrib/gitdm/domain-map @@ -5,6 +5,7 @@ # amd.com AMD +aspeedtech.com ASPEED Technology Inc. baidu.com Baidu bytedance.com ByteDance cmss.chinamobile.com China Mobile From b89b72de16c95ad9363e7274728657d8dbc47e9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= Date: Wed, 15 Mar 2023 17:43:26 +0000 Subject: [PATCH 29/35] contrib/gitdm: Add SYRMIA to the domain map MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The company website lists QEMU amongst the things they work on so I assume these are corporate contributions. Signed-off-by: Alex Bennée Cc: Milica Lazarevic Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20230315174331.2959-28-alex.bennee@linaro.org> --- contrib/gitdm/domain-map | 1 + 1 file changed, 1 insertion(+) diff --git a/contrib/gitdm/domain-map b/contrib/gitdm/domain-map index 65e40fe8e16b..4a988c5b5f44 100644 --- a/contrib/gitdm/domain-map +++ b/contrib/gitdm/domain-map @@ -39,6 +39,7 @@ siemens.com Siemens sifive.com SiFive suse.com SUSE suse.de SUSE +syrmia.com SYRMIA ventanamicro.com Ventana Micro Systems virtuozzo.com Virtuozzo vrull.eu VRULL From 8bc9e104b7415f6bd5d47006cdb9587ba3da519f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= Date: Wed, 15 Mar 2023 17:43:27 +0000 Subject: [PATCH 30/35] contrib/gitdm: add Amazon to the domain map MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We have multiple contributors from both .co.uk and .com versions of the address. Also add .de for completeness sake. Signed-off-by: Alex Bennée Cc: Alexander Graf Cc: Paul Durrant Cc: David Wooodhouse Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Paul Durrant Reviewed-by: Alexander Graf Message-Id: <20230315174331.2959-29-alex.bennee@linaro.org> --- contrib/gitdm/domain-map | 3 +++ 1 file changed, 3 insertions(+) diff --git a/contrib/gitdm/domain-map b/contrib/gitdm/domain-map index 4a988c5b5f44..1dd8d8c71f0a 100644 --- a/contrib/gitdm/domain-map +++ b/contrib/gitdm/domain-map @@ -4,6 +4,9 @@ # This maps email domains to nice easy to read company names # +amazon.com Amazon +amazon.co.uk Amazon +amazon.de Amazon amd.com AMD aspeedtech.com ASPEED Technology Inc. baidu.com Baidu From 111fc86241fcd51aef38c1a41d069548ed491244 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= Date: Wed, 15 Mar 2023 17:43:28 +0000 Subject: [PATCH 31/35] contrib/gitdm: add Alibaba to the domain-map MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This replaces the previous attempt to add c-sky.com. Group everything under Alibaba now. Added as requested by LIU Zhiwei. Signed-off-by: Alex Bennée Acked-by: Guo Ren Reviewed-by: Xuan Zhuo Reviewed-by: LIU Zhiwei Message-Id: <20230315174331.2959-30-alex.bennee@linaro.org> --- contrib/gitdm/domain-map | 1 + contrib/gitdm/group-map-alibaba | 7 +++++++ gitdm.config | 1 + 3 files changed, 9 insertions(+) create mode 100644 contrib/gitdm/group-map-alibaba diff --git a/contrib/gitdm/domain-map b/contrib/gitdm/domain-map index 1dd8d8c71f0a..4df8a8bcf60c 100644 --- a/contrib/gitdm/domain-map +++ b/contrib/gitdm/domain-map @@ -4,6 +4,7 @@ # This maps email domains to nice easy to read company names # +linux.alibaba.com Alibaba amazon.com Amazon amazon.co.uk Amazon amazon.de Amazon diff --git a/contrib/gitdm/group-map-alibaba b/contrib/gitdm/group-map-alibaba new file mode 100644 index 000000000000..4c34446d34bf --- /dev/null +++ b/contrib/gitdm/group-map-alibaba @@ -0,0 +1,7 @@ +# +# Alibaba contributors including its subsidiaries +# + +# c-sky.com, now part of T-Head, wholly-owned entity of Alibaba Group +ren_guo@c-sky.com +zhiwei_liu@c-sky.com diff --git a/gitdm.config b/gitdm.config index 907ffde01794..df4ba829ca7c 100644 --- a/gitdm.config +++ b/gitdm.config @@ -31,6 +31,7 @@ EmailMap contrib/gitdm/domain-map # identifiable corporate emails. Please keep this list sorted. # +GroupMap contrib/gitdm/group-map-alibaba Alibaba GroupMap contrib/gitdm/group-map-cadence Cadence Design Systems GroupMap contrib/gitdm/group-map-codeweavers CodeWeavers GroupMap contrib/gitdm/group-map-facebook Facebook From bfa2e7aacb0063676e120e6f04f034c036eeafc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= Date: Wed, 15 Mar 2023 17:43:29 +0000 Subject: [PATCH 32/35] contrib/gitdm: add revng to domain map MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Alex Bennée Cc: Anton Johansson Cc: Niccolò Izzo Cc: Paolo Montesel Reviewed-by: Alessandro Di Federico Message-Id: <20230315174331.2959-31-alex.bennee@linaro.org> --- contrib/gitdm/domain-map | 1 + 1 file changed, 1 insertion(+) diff --git a/contrib/gitdm/domain-map b/contrib/gitdm/domain-map index 4df8a8bcf60c..afd9fae8754d 100644 --- a/contrib/gitdm/domain-map +++ b/contrib/gitdm/domain-map @@ -37,6 +37,7 @@ oracle.com Oracle proxmox.com Proxmox quicinc.com Qualcomm Innovation Center redhat.com Red Hat +rev.ng rev.ng Labs rt-rk.com RT-RK samsung.com Samsung siemens.com Siemens From 3556c1034dfe342255bf9444abcd2b7e3e9c6d7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= Date: Wed, 15 Mar 2023 17:43:30 +0000 Subject: [PATCH 33/35] contrib/gitdm: add more individual contributors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I've only added the names explicitly acked. Signed-off-by: Alex Bennée Acked-by: Bin Meng Acked-by: Jason A. Donenfeld Acked-by: Strahinja Jankovic Acked-by: Bernhard Beschow Reviewed-by: Thomas Huth Message-Id: <20230315174331.2959-32-alex.bennee@linaro.org> --- contrib/gitdm/group-map-individuals | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/contrib/gitdm/group-map-individuals b/contrib/gitdm/group-map-individuals index e2263a5ee313..d7116f5444f1 100644 --- a/contrib/gitdm/group-map-individuals +++ b/contrib/gitdm/group-map-individuals @@ -38,3 +38,7 @@ paul@nowt.org git@xen0n.name simon@simonsafar.com research_trasio@irq.a4lg.com +shentey@gmail.com +bmeng@tinylab.org +strahinja.p.jankovic@gmail.com +Jason@zx2c4.com From 6205a70b9251d63142d0e60ca03fd88959e87a85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= Date: Wed, 15 Mar 2023 17:43:31 +0000 Subject: [PATCH 34/35] contrib/gitdm: add group map for AMD MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit AMD recently acquired Xilinx and contributors have been transitioning their emails across. Signed-off-by: Alex Bennée Cc: Vikram Garhwal Cc: Stefano Stabellini Cc: Sai Pavan Boddu Cc: Tong Ho Reviewed-by: Francisco Iglesias Message-Id: <20230315174331.2959-33-alex.bennee@linaro.org> --- contrib/gitdm/domain-map | 1 - contrib/gitdm/group-map-amd | 8 ++++++++ gitdm.config | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 contrib/gitdm/group-map-amd diff --git a/contrib/gitdm/domain-map b/contrib/gitdm/domain-map index afd9fae8754d..3e31a0624534 100644 --- a/contrib/gitdm/domain-map +++ b/contrib/gitdm/domain-map @@ -50,6 +50,5 @@ virtuozzo.com Virtuozzo vrull.eu VRULL wdc.com Western Digital windriver.com Wind River -xilinx.com Xilinx yadro.com YADRO yandex-team.ru Yandex diff --git a/contrib/gitdm/group-map-amd b/contrib/gitdm/group-map-amd new file mode 100644 index 000000000000..bda4239a8ae1 --- /dev/null +++ b/contrib/gitdm/group-map-amd @@ -0,0 +1,8 @@ +# AMD acquired Xilinx and contributors have been slowly updating emails + +edgar.iglesias@xilinx.com +fnu.vikram@xilinx.com +francisco.iglesias@xilinx.com +sai.pavan.boddu@xilinx.com +stefano.stabellini@xilinx.com +tong.ho@xilinx.com diff --git a/gitdm.config b/gitdm.config index df4ba829ca7c..9db43ca1422b 100644 --- a/gitdm.config +++ b/gitdm.config @@ -32,6 +32,7 @@ EmailMap contrib/gitdm/domain-map # GroupMap contrib/gitdm/group-map-alibaba Alibaba +GroupMap contrib/gitdm/group-map-amd AMD GroupMap contrib/gitdm/group-map-cadence Cadence Design Systems GroupMap contrib/gitdm/group-map-codeweavers CodeWeavers GroupMap contrib/gitdm/group-map-facebook Facebook From e35b9a2e81ccce86db6f1417b1d73bb97d7cbc17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Fri, 17 Mar 2023 17:05:53 +0000 Subject: [PATCH 35/35] qtests: avoid printing comments before g_test_init() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The TAP protocol version line must be the first thing printed on stdout. The migration test failed that requirement in certain scenarios: # Skipping test: Userfault not available (builtdtime) TAP version 13 # random seed: R02Sc120c807f11053eb90bfea845ba1e368 1..32 # Start of x86_64 tests # Start of migration tests .... The TAP version is printed by g_test_init(), so we need to make sure that any methods which print are run after that. Signed-off-by: Daniel P. Berrangé Reviewed-by: Peter Maydell Message-Id: <20230317170553.592707-1-berrange@redhat.com> Signed-off-by: Alex Bennée Reviewed-by: Thomas Huth --- tests/qtest/migration-test.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index 75d4f1d4a988..3b615b0da993 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -2462,14 +2462,18 @@ static bool kvm_dirty_ring_supported(void) int main(int argc, char **argv) { - const bool has_kvm = qtest_has_accel("kvm"); - const bool has_uffd = ufd_version_check(); - const char *arch = qtest_get_arch(); + bool has_kvm; + bool has_uffd; + const char *arch; g_autoptr(GError) err = NULL; int ret; g_test_init(&argc, &argv, NULL); + has_kvm = qtest_has_accel("kvm"); + has_uffd = ufd_version_check(); + arch = qtest_get_arch(); + /* * On ppc64, the test only works with kvm-hv, but not with kvm-pr and TCG * is touchy due to race conditions on dirty bits (especially on PPC for