From d9458f990afa1633b99d0d897d3e48689d6a01ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Date: Tue, 11 Jul 2023 17:14:40 +0200 Subject: s390x: Fix QEMU abort by selecting S390_FLIC_KVM MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If QEMU is built with --without-default-devices, the s390-flic-kvm device is missing and QEMU aborts when started with the KVM accelerator. Make sure it's available by selecting S390_FLIC_KVM in Kconfig. Consequently, this also fixes an abort in tests/qtest/migration-test. Signed-off-by: Cédric Le Goater Message-Id: <20230711151440.716822-1-clg@redhat.com> Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Thomas Huth --- hw/intc/Kconfig | 1 - hw/s390x/Kconfig | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/intc/Kconfig b/hw/intc/Kconfig index 21441d0a0c..97d550b06b 100644 --- a/hw/intc/Kconfig +++ b/hw/intc/Kconfig @@ -49,7 +49,6 @@ config S390_FLIC config S390_FLIC_KVM bool - default y depends on S390_FLIC && KVM config OMPIC diff --git a/hw/s390x/Kconfig b/hw/s390x/Kconfig index e8d4d68ece..4c068d7960 100644 --- a/hw/s390x/Kconfig +++ b/hw/s390x/Kconfig @@ -8,6 +8,7 @@ config S390_CCW_VIRTIO imply PCIE_DEVICES select PCI_EXPRESS select S390_FLIC + select S390_FLIC_KVM if KVM select SCLPCONSOLE select VIRTIO_CCW select MSI_NONBROKEN -- cgit v1.2.3 From 7f114a580710b3b2a7e3a3a30e2096e804b0fcb6 Mon Sep 17 00:00:00 2001 From: Ilya Leoshkevich Date: Tue, 27 Jun 2023 17:13:33 +0200 Subject: linux-user/elfload: Fix /proc/cpuinfo features: on s390x elf_hwcap_str() takes a bit number, but compares it for equality with the HWCAP_S390_* masks. This causes /proc/cpuinfo to display incorrect hwcaps. Fix by introducing the HWCAP_S390_NR_* constants and using them in elf_hwcap_str() instead of the HWCAP_S390_*. While at it, add the missing nnpa, pcimio and sie hwcaps from the latest kernel. Output before: features : esan3 zarch stfle msa Output after: features : esan3 zarch stfle msa ldisp eimm etf3eh highgprs vx vxe Fixes: e19807bee357 ("linux-user/elfload: Introduce elf_hwcap_str() on s390x") Signed-off-by: Ilya Leoshkevich Message-Id: <20230627151356.273259-1-iii@linux.ibm.com> Reviewed-by: Richard Henderson Signed-off-by: Thomas Huth --- include/elf.h | 66 +++++++++++++++++++++++++++++++++++++--------------- linux-user/elfload.c | 41 +++++++++++++++++--------------- 2 files changed, 69 insertions(+), 38 deletions(-) diff --git a/include/elf.h b/include/elf.h index 2f4d0e56d1..ec9755e73b 100644 --- a/include/elf.h +++ b/include/elf.h @@ -596,25 +596,53 @@ typedef struct { /* Bits present in AT_HWCAP for s390. */ -#define HWCAP_S390_ESAN3 1 -#define HWCAP_S390_ZARCH 2 -#define HWCAP_S390_STFLE 4 -#define HWCAP_S390_MSA 8 -#define HWCAP_S390_LDISP 16 -#define HWCAP_S390_EIMM 32 -#define HWCAP_S390_DFP 64 -#define HWCAP_S390_HPAGE 128 -#define HWCAP_S390_ETF3EH 256 -#define HWCAP_S390_HIGH_GPRS 512 -#define HWCAP_S390_TE 1024 -#define HWCAP_S390_VXRS 2048 -#define HWCAP_S390_VXRS_BCD 4096 -#define HWCAP_S390_VXRS_EXT 8192 -#define HWCAP_S390_GS 16384 -#define HWCAP_S390_VXRS_EXT2 32768 -#define HWCAP_S390_VXRS_PDE 65536 -#define HWCAP_S390_SORT 131072 -#define HWCAP_S390_DFLT 262144 +#define HWCAP_S390_NR_ESAN3 0 +#define HWCAP_S390_NR_ZARCH 1 +#define HWCAP_S390_NR_STFLE 2 +#define HWCAP_S390_NR_MSA 3 +#define HWCAP_S390_NR_LDISP 4 +#define HWCAP_S390_NR_EIMM 5 +#define HWCAP_S390_NR_DFP 6 +#define HWCAP_S390_NR_HPAGE 7 +#define HWCAP_S390_NR_ETF3EH 8 +#define HWCAP_S390_NR_HIGH_GPRS 9 +#define HWCAP_S390_NR_TE 10 +#define HWCAP_S390_NR_VXRS 11 +#define HWCAP_S390_NR_VXRS_BCD 12 +#define HWCAP_S390_NR_VXRS_EXT 13 +#define HWCAP_S390_NR_GS 14 +#define HWCAP_S390_NR_VXRS_EXT2 15 +#define HWCAP_S390_NR_VXRS_PDE 16 +#define HWCAP_S390_NR_SORT 17 +#define HWCAP_S390_NR_DFLT 18 +#define HWCAP_S390_NR_VXRS_PDE2 19 +#define HWCAP_S390_NR_NNPA 20 +#define HWCAP_S390_NR_PCI_MIO 21 +#define HWCAP_S390_NR_SIE 22 + +#define HWCAP_S390_ESAN3 (1 << HWCAP_S390_NR_ESAN3) +#define HWCAP_S390_ZARCH (1 << HWCAP_S390_NR_ZARCH) +#define HWCAP_S390_STFLE (1 << HWCAP_S390_NR_STFLE) +#define HWCAP_S390_MSA (1 << HWCAP_S390_NR_MSA) +#define HWCAP_S390_LDISP (1 << HWCAP_S390_NR_LDISP) +#define HWCAP_S390_EIMM (1 << HWCAP_S390_NR_EIMM) +#define HWCAP_S390_DFP (1 << HWCAP_S390_NR_DFP) +#define HWCAP_S390_HPAGE (1 << HWCAP_S390_NR_HPAGE) +#define HWCAP_S390_ETF3EH (1 << HWCAP_S390_NR_ETF3EH) +#define HWCAP_S390_HIGH_GPRS (1 << HWCAP_S390_NR_HIGH_GPRS) +#define HWCAP_S390_TE (1 << HWCAP_S390_NR_TE) +#define HWCAP_S390_VXRS (1 << HWCAP_S390_NR_VXRS) +#define HWCAP_S390_VXRS_BCD (1 << HWCAP_S390_NR_VXRS_BCD) +#define HWCAP_S390_VXRS_EXT (1 << HWCAP_S390_NR_VXRS_EXT) +#define HWCAP_S390_GS (1 << HWCAP_S390_NR_GS) +#define HWCAP_S390_VXRS_EXT2 (1 << HWCAP_S390_NR_VXRS_EXT2) +#define HWCAP_S390_VXRS_PDE (1 << HWCAP_S390_NR_VXRS_PDE) +#define HWCAP_S390_SORT (1 << HWCAP_S390_NR_SORT) +#define HWCAP_S390_DFLT (1 << HWCAP_S390_NR_DFLT) +#define HWCAP_S390_VXRS_PDE2 (1 << HWCAP_S390_NR_VXRS_PDE2) +#define HWCAP_S390_NNPA (1 << HWCAP_S390_NR_NNPA) +#define HWCAP_S390_PCI_MIO (1 << HWCAP_S390_NR_PCI_MIO) +#define HWCAP_S390_SIE (1 << HWCAP_S390_NR_SIE) /* M68K specific definitions. */ /* We use the top 24 bits to encode information about the diff --git a/linux-user/elfload.c b/linux-user/elfload.c index a26200d9f3..861ec07abc 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -1621,25 +1621,28 @@ uint32_t get_elf_hwcap(void) const char *elf_hwcap_str(uint32_t bit) { static const char *hwcap_str[] = { - [HWCAP_S390_ESAN3] = "esan3", - [HWCAP_S390_ZARCH] = "zarch", - [HWCAP_S390_STFLE] = "stfle", - [HWCAP_S390_MSA] = "msa", - [HWCAP_S390_LDISP] = "ldisp", - [HWCAP_S390_EIMM] = "eimm", - [HWCAP_S390_DFP] = "dfp", - [HWCAP_S390_HPAGE] = "edat", - [HWCAP_S390_ETF3EH] = "etf3eh", - [HWCAP_S390_HIGH_GPRS] = "highgprs", - [HWCAP_S390_TE] = "te", - [HWCAP_S390_VXRS] = "vx", - [HWCAP_S390_VXRS_BCD] = "vxd", - [HWCAP_S390_VXRS_EXT] = "vxe", - [HWCAP_S390_GS] = "gs", - [HWCAP_S390_VXRS_EXT2] = "vxe2", - [HWCAP_S390_VXRS_PDE] = "vxp", - [HWCAP_S390_SORT] = "sort", - [HWCAP_S390_DFLT] = "dflt", + [HWCAP_S390_NR_ESAN3] = "esan3", + [HWCAP_S390_NR_ZARCH] = "zarch", + [HWCAP_S390_NR_STFLE] = "stfle", + [HWCAP_S390_NR_MSA] = "msa", + [HWCAP_S390_NR_LDISP] = "ldisp", + [HWCAP_S390_NR_EIMM] = "eimm", + [HWCAP_S390_NR_DFP] = "dfp", + [HWCAP_S390_NR_HPAGE] = "edat", + [HWCAP_S390_NR_ETF3EH] = "etf3eh", + [HWCAP_S390_NR_HIGH_GPRS] = "highgprs", + [HWCAP_S390_NR_TE] = "te", + [HWCAP_S390_NR_VXRS] = "vx", + [HWCAP_S390_NR_VXRS_BCD] = "vxd", + [HWCAP_S390_NR_VXRS_EXT] = "vxe", + [HWCAP_S390_NR_GS] = "gs", + [HWCAP_S390_NR_VXRS_EXT2] = "vxe2", + [HWCAP_S390_NR_VXRS_PDE] = "vxp", + [HWCAP_S390_NR_SORT] = "sort", + [HWCAP_S390_NR_DFLT] = "dflt", + [HWCAP_S390_NR_NNPA] = "nnpa", + [HWCAP_S390_NR_PCI_MIO] = "pcimio", + [HWCAP_S390_NR_SIE] = "sie", }; return bit < ARRAY_SIZE(hwcap_str) ? hwcap_str[bit] : NULL; -- cgit v1.2.3 From 94aaf6d8a589490706e8cdc1ae725743f101124a Mon Sep 17 00:00:00 2001 From: Fabiano Rosas Date: Tue, 11 Jul 2023 18:21:31 -0300 Subject: tests/qtest: Fix typo in multifd cancel test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This wasn't noticed because the test is currently disabled. Fixes: 02f56e3de ("tests/qtest: massively speed up migration-test") Signed-off-by: Fabiano Rosas Message-Id: <20230711212131.2370-1-farosas@suse.de> Reviewed-by: Daniel P. Berrangé Signed-off-by: Thomas Huth --- tests/qtest/migration-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/qtest/migration-test.c b/tests/qtest/migration-test.c index efa8c729db..e256da1216 100644 --- a/tests/qtest/migration-test.c +++ b/tests/qtest/migration-test.c @@ -2481,7 +2481,7 @@ static void test_multifd_tcp_cancel(void) migrate_qmp(from, uri, "{}"); - migrate_wait_for_dirty_mem(from, to); + migrate_wait_for_dirty_mem(from, to2); migrate_ensure_converge(from); -- cgit v1.2.3 From 03e596de1789af2d6d3ef222268642ee34c08a1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Tue, 11 Jul 2023 16:49:19 +0200 Subject: tests/lcitool: Generate distribution packages list in JSON format MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add the generate_pkglist() helper to generate a list of packages required by a distribution to build QEMU. Since we can not add a "THIS FILE WAS AUTO-GENERATED" comment in JSON, create the files under tests/vm/generated/ sub-directory; add a README mentioning the files are generated. Suggested-by: Erik Skultety Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Daniel P. Berrangé Reviewed-by: Warner Losh Message-Id: <20230711144922.67491-2-philmd@linaro.org> Signed-off-by: Thomas Huth --- tests/lcitool/refresh | 11 +++++++++++ tests/vm/generated/README | 5 +++++ 2 files changed, 16 insertions(+) create mode 100644 tests/vm/generated/README diff --git a/tests/lcitool/refresh b/tests/lcitool/refresh index b54566edcc..4584870ea1 100755 --- a/tests/lcitool/refresh +++ b/tests/lcitool/refresh @@ -84,6 +84,12 @@ def generate_cirrus(target, trailer=None): generate(filename, cmd, trailer) +def generate_pkglist(vm, target): + filename = Path(src_dir, "tests", "vm", "generated", vm + ".json") + cmd = lcitool_cmd + ["variables", "--format", "json", target, "qemu"] + generate(filename, cmd, None) + + # Netmap still needs to be manually built as it is yet to be packaged # into a distro. We also add cscope and gtags which are used in the CI # test @@ -191,6 +197,11 @@ try: generate_cirrus("freebsd-13") generate_cirrus("macos-12") + # + # VM packages lists + # + generate_pkglist("freebsd", "freebsd-13") + sys.exit(0) except Exception as ex: print(str(ex), file=sys.stderr) diff --git a/tests/vm/generated/README b/tests/vm/generated/README new file mode 100644 index 0000000000..7ccc6ffd3d --- /dev/null +++ b/tests/vm/generated/README @@ -0,0 +1,5 @@ +# FILES IN THIS FOLDER WERE AUTO-GENERATED +# +# $ make lcitool-refresh +# +# https://gitlab.com/libvirt/libvirt-ci -- cgit v1.2.3 From a38dee6695b07a90f157e6eb592f91cef3849bfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Tue, 11 Jul 2023 16:49:20 +0200 Subject: tests/lcitool: Refresh generated files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refresh the generated files by running: $ make lcitool-refresh Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20230711144922.67491-3-philmd@linaro.org> Reviewed-by: Daniel P. Berrangé [thuth: Drop changes to libpmem-dev and libxen-dev] Signed-off-by: Thomas Huth --- tests/vm/generated/freebsd.json | 77 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 tests/vm/generated/freebsd.json diff --git a/tests/vm/generated/freebsd.json b/tests/vm/generated/freebsd.json new file mode 100644 index 0000000000..7c435cf23e --- /dev/null +++ b/tests/vm/generated/freebsd.json @@ -0,0 +1,77 @@ +{ + "ccache": "/usr/local/bin/ccache", + "cpan_pkgs": [], + "cross_pkgs": [], + "make": "/usr/local/bin/gmake", + "ninja": "/usr/local/bin/ninja", + "packaging_command": "pkg", + "pip3": "/usr/local/bin/pip-3.8", + "pkgs": [ + "alsa-lib", + "bash", + "bison", + "bzip2", + "ca_root_nss", + "capstone4", + "ccache", + "cmocka", + "ctags", + "curl", + "cyrus-sasl", + "dbus", + "diffutils", + "dtc", + "flex", + "fusefs-libs3", + "gettext", + "git", + "glib", + "gmake", + "gnutls", + "gsed", + "gtk3", + "json-c", + "libepoxy", + "libffi", + "libgcrypt", + "libjpeg-turbo", + "libnfs", + "libslirp", + "libspice-server", + "libssh", + "libtasn1", + "llvm", + "lzo2", + "meson", + "mtools", + "ncurses", + "nettle", + "ninja", + "opencv", + "pixman", + "pkgconf", + "png", + "py39-numpy", + "py39-pillow", + "py39-pip", + "py39-sphinx", + "py39-sphinx_rtd_theme", + "py39-yaml", + "python3", + "rpm2cpio", + "sdl2", + "sdl2_image", + "snappy", + "sndio", + "socat", + "spice-protocol", + "tesseract", + "usbredir", + "virglrenderer", + "vte3", + "xorriso", + "zstd" + ], + "pypi_pkgs": [], + "python": "/usr/local/bin/python3" +} -- cgit v1.2.3 From 4cd57671b777632be2dc20bc2f5a0410e258e3dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Tue, 11 Jul 2023 16:49:21 +0200 Subject: tests/vm: Introduce get_qemu_packages_from_lcitool_json() helper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add the get_qemu_packages_from_lcitool_json() helper which return such package list from a lcitool env var file in JSON format. Suggested-by: Daniel P. Berrangé Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Daniel P. Berrangé Message-Id: <20230711144922.67491-4-philmd@linaro.org> Signed-off-by: Thomas Huth --- tests/vm/basevm.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py index 23229e23d1..a97e23b0ce 100644 --- a/tests/vm/basevm.py +++ b/tests/vm/basevm.py @@ -27,6 +27,7 @@ import shutil import multiprocessing import traceback import shlex +import json from qemu.machine import QEMUMachine from qemu.utils import get_info_usernet_hostfwd_port, kvm_available @@ -501,6 +502,16 @@ class BaseVM(object): stderr=self._stdout) return os.path.join(cidir, "cloud-init.iso") + def get_qemu_packages_from_lcitool_json(self, json_path=None): + """Parse a lcitool variables json file and return the PKGS list.""" + if json_path is None: + json_path = os.path.join( + os.path.dirname(__file__), "generated", self.name + ".json" + ) + with open(json_path, "r") as fh: + return json.load(fh)["pkgs"] + + def get_qemu_path(arch, build_path=None): """Fetch the path to the qemu binary.""" # If QEMU environment variable set, it takes precedence -- cgit v1.2.3 From ca2a07f6c3630d5d39af24651987256a705ac500 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Date: Tue, 11 Jul 2023 16:49:22 +0200 Subject: tests/vm/freebsd: Get up-to-date package list from lcitool vars file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Get an up-to-date package list from lcitool, that way we don't need to manually keep this array in sync. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Daniel P. Berrangé Inspired-by: Thomas Huth Message-Id: <20230711144922.67491-5-philmd@linaro.org> Signed-off-by: Thomas Huth --- tests/vm/freebsd | 42 ++---------------------------------------- 1 file changed, 2 insertions(+), 40 deletions(-) diff --git a/tests/vm/freebsd b/tests/vm/freebsd index 11de6473f4..ac51376c82 100755 --- a/tests/vm/freebsd +++ b/tests/vm/freebsd @@ -31,45 +31,6 @@ class FreeBSDVM(basevm.BaseVM): link = "https://download.freebsd.org/releases/CI-IMAGES/13.2-RELEASE/amd64/Latest/FreeBSD-13.2-RELEASE-amd64-BASIC-CI.raw.xz" csum = "a4fb3b6c7b75dd4d58fb0d75e4caf72844bffe0ca00e66459c028b198ffb3c0e" size = "20G" - pkgs = [ - # build tools - "git", - "pkgconf", - "bzip2", - "python39", - "ninja", - - # gnu tools - "bash", - "gmake", - "gsed", - "gettext", - - # libs: crypto - "gnutls", - - # libs: images - "jpeg-turbo", - "png", - - # libs: ui - "sdl2", - "gtk3", - "libxkbcommon", - - # libs: opengl - "libepoxy", - "mesa-libs", - - # libs: migration - "zstd", - - # libs: networking - "libslirp", - - # libs: sndio - "sndio", - ] BUILD_SCRIPT = """ set -e; @@ -151,8 +112,9 @@ class FreeBSDVM(basevm.BaseVM): self.console_wait(prompt) self.console_send("echo 'chmod 666 /dev/vtbd1' >> /etc/rc.local\n") + pkgs = self.get_qemu_packages_from_lcitool_json() self.print_step("Installing packages") - self.ssh_root_check("pkg install -y %s\n" % " ".join(self.pkgs)) + self.ssh_root_check("pkg install -y %s\n" % " ".join(pkgs)) # shutdown self.ssh_root(self.poweroff) -- cgit v1.2.3 From a5754847e0fc2bc08a414dd381803009e8bca390 Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Mon, 10 Jul 2023 19:01:55 +0200 Subject: tests/avocado: Disable the test_sbsaref_edk2_firmware by default The test fails occasionally, see e.g.: https://gitlab.com/thuth/qemu/-/jobs/4196177756#L489 https://gitlab.com/thuth/qemu/-/jobs/4623296271#L290 It also fails on my laptop in ca. 50% of all runs. Thus disable it by default by using the QEMU_TEST_FLAKY_TESTS environment variable to fence it (which we also already use in flaky qtests). While we're at it, also document this variable in docs/devel/testing.rst. Message-Id: <20230710170155.7192-1-thuth@redhat.com> Signed-off-by: Thomas Huth --- docs/devel/testing.rst | 5 +++++ tests/avocado/machine_aarch64_sbsaref.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/devel/testing.rst b/docs/devel/testing.rst index fb651eae11..b6ad21bed1 100644 --- a/docs/devel/testing.rst +++ b/docs/devel/testing.rst @@ -1384,6 +1384,11 @@ variable as shown on the code snippet below to skip the test: def test(self): do_something() +QEMU_TEST_FLAKY_TESTS +^^^^^^^^^^^^^^^^^^^^^ +Some tests are not working reliably and thus are disabled by default. +Set this environment variable to enable them. + Uninstalling Avocado ~~~~~~~~~~~~~~~~~~~~ diff --git a/tests/avocado/machine_aarch64_sbsaref.py b/tests/avocado/machine_aarch64_sbsaref.py index cce6ef9f65..a794245e7e 100644 --- a/tests/avocado/machine_aarch64_sbsaref.py +++ b/tests/avocado/machine_aarch64_sbsaref.py @@ -8,7 +8,6 @@ import os -from avocado import skip from avocado import skipUnless from avocado.utils import archive @@ -76,6 +75,7 @@ class Aarch64SbsarefMachine(QemuSystemTest): "sbsa-ref", ) + @skipUnless(os.getenv('QEMU_TEST_FLAKY_TESTS'), 'Test is not reliable') def test_sbsaref_edk2_firmware(self): """ :avocado: tags=cpu:cortex-a57 -- cgit v1.2.3