aboutsummaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)Author
2024-07-03Merge tag 'pull-tcg-20240703' of https://gitlab.com/rth7680/qemu into stagingRichard Henderson
util: cpuinfo portability fixes for FreeBSD and OpenBSD util: cpuinfo for riscv host tcg/optimize: Fix TCG_COND_TST* simplification of setcond2 # -----BEGIN PGP SIGNATURE----- # # iQFRBAABCgA7FiEEekgeeIaLTbaoWgXAZN846K9+IV8FAmaFjS0dHHJpY2hhcmQu # aGVuZGVyc29uQGxpbmFyby5vcmcACgkQZN846K9+IV8WuAf/dVuZ7kA+TxgMZUO7 # vayzWg0pCjYQj1K5zRIJXwr1jD7X59bNSc6WlIe47iEyUZYRcJ/flMVIPmjCEvId # NgiXQbGtSb/sLXoTnkCSGB+7amO5uSgTbi4WGhFIrquNjd3mZ9IKR8YIQimuC2C3 # Hvau6FWkUwkGi8RKNSkozAIN7losZhmbyX8jSOV9bTYmUnr5ts/zdE0VbCt2WaTg # 9khRdww7nlLDGuGXNDPz/psUqMHEMHRLlnTv5BLoJ8H4b0NXdhRJHRO3E28Se5Wi # vcIzSo7xiH1dAVkoMnvTAioUKO/lhnkkObmMFLWxov0esiQgtN6IB6ttOn4Wy9F6 # huRMMA== # =etSC # -----END PGP SIGNATURE----- # gpg: Signature made Wed 03 Jul 2024 10:41:01 AM PDT # gpg: using RSA key 7A481E78868B4DB6A85A05C064DF38E8AF7E215F # gpg: issuer "richard.henderson@linaro.org" # gpg: Good signature from "Richard Henderson <richard.henderson@linaro.org>" [ultimate] * tag 'pull-tcg-20240703' of https://gitlab.com/rth7680/qemu: tcg/optimize: Fix TCG_COND_TST* simplification of setcond2 util/cpuinfo-riscv: Use linux __riscv_hwprobe syscall util/cpuinfo-riscv: Support OpenBSD signal frame util/cpuinfo-riscv: Support host/cpuinfo.h for riscv util/cpuinfo-aarch64: Add OpenBSD support util/cpuinfo-ppc: Add FreeBSD support util/cpuinfo-ppc: Fix building on OpenBSD Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2024-07-03tcg/optimize: Fix TCG_COND_TST* simplification of setcond2Richard Henderson
Argument ordering for setcond2 is: output, a_low, a_high, b_low, b_high, cond The test is supposed to be against b_low, not a_high. Cc: qemu-stable@nongnu.org Fixes: ceb9ee06b71 ("tcg/optimize: Handle TCG_COND_TST{EQ,NE}") Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2413 Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Tested-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20240701024623.1265028-1-richard.henderson@linaro.org>
2024-07-03meson: Drop the .fa library suffixPaolo Bonzini
The non-standard .fa library suffix breaks the link source de-duplication done by Meson so drop it. The lack of link source de-duplication causes AddressSanitizer to complain ODR violations, and makes GNU ld abort when combined with clang's LTO. Fortunately, the non-standard suffix is not necessary anymore for two reasons. First, the non-standard suffix was necessary for fork-fuzzing. Meson wraps all standard-suffixed libraries with --start-group and --end-group. This made a fork-fuzz.ld linker script wrapped as well and broke builds. Commit d2e6f9272d33 ("fuzz: remove fork-fuzzing scaffolding") dropped fork-fuzzing so we can now restore the standard suffix. Second, the libraries are not even built anymore, because it is possible to just use the object files directly via extract_all_objects(). The occurences of the suffix were detected and removed by performing a tree-wide search with 'fa' and .fa (note the quotes and dot). Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Message-ID: <20240524-xkb-v4-4-2de564e5c859@daynix.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2024-07-03meson: Pass objects and dependencies to declare_dependency()Akihiko Odaki
We used to request declare_dependency() to link_whole static libraries. If a static library is a thin archive, GNU ld keeps all object files referenced by the archive open, and sometimes exceeds the open file limit. Another problem with link_whole is that suboptimal handling of nested dependencies. link_whole by itself does not propagate dependencies. In particular, gnutls, a dependency of crypto, is not propagated to its users, and we currently workaround the issue by declaring gnutls as a dependency for each crypto user. On the other hand, if you write something like libfoo = static_library('foo', 'foo.c', dependencies: gnutls) foo = declare_dependency(link_whole: libfoo) libbar = static_library('bar', 'bar.c', dependencies: foo) bar = declare_dependency(link_whole: libbar, dependencies: foo) executable('prog', sources: files('prog.c'), dependencies: [foo, bar]) hoping to propagate the gnutls dependency into bar.c, you'll see a linking failure for "prog", because the foo.c.o object file is included in libbar.a and therefore it is linked twice into "prog": once from libfoo.a and once from libbar.a. Here Meson does not see the duplication, it just asks the linker to link all of libfoo.a and libbar.a into "prog". Instead of using link_whole, extract objects included in static libraries and pass them to declare_dependency(); and then the dependencies can be added as well so that they are propagated, because object files on the linker command line are always deduplicated. This requires Meson 1.1.0 or later. Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Message-ID: <20240524-objects-v1-1-07cbbe96166b@daynix.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2024-07-03Merge tag 'for-upstream' of https://repo.or.cz/qemu/kevin into stagingRichard Henderson
Block layer patches (CVE-2024-4467) - Don't open qcow2 data files in 'qemu-img info' - Disallow protocol prefixes for qcow2 data files, VMDK extent files and other child nodes that are neither 'file' nor 'backing' # -----BEGIN PGP SIGNATURE----- # # iQJFBAABCAAvFiEE3D3rFZqa+V09dFb+fwmycsiPL9YFAmaEKQwRHGt3b2xmQHJl # ZGhhdC5jb20ACgkQfwmycsiPL9YgMA/+OeQf0veFb02ZNqf907Etz8/DvnqbiWUN # 0aT5z5x8ilZQIiEDbFtLKgF3A/WO7phyCKk1q1dbRNbc1ZaWFW7mTaJM2ew++EuB # fq0mnskLt/GVSqTReO4od7flsssp3sEDxs74yuyNITIUqui4we9WK2lLRiAv3aco # 2NbyNeMHJxIW+QlOO3R62i24yjQaLyg/YekmiIK8itQkpKuI80fiVgor5W3RR0P0 # 71AVSHC0Edv5eavmiRqmQ+pfSI8tlINsN1s5jvxge6XpVTaL8NHsgH3LVv1R3Qtx # Uo9hp6lQboAfc4I06gf+fcsYSBRiGCwA/J+JsWusX4FLaaTNHLt5eJAEJhfZlioj # wgTqpy2ImRu5lcuLjLWRu4cLapPLI6CSwf4/lG9/szmRA/1UtOKpquKeTuCwMl9Y # XEVoNDzo7GpfSb7YONo7fU7kq00OuEEAn0he7eNd2UU+Ao9Abi7JvY+fKx71FHo3 # k24SQVhVJihV1IEC4psCtaQm2bB/jdMr0jB44zHLtmqeUMLrrVf64cSAntp+2KRa # sINBXA5OeblGKQ7FoAzc5NNNveSdF1ioRCvKB3MlHzI+efzRS7+I3wwh2Uz1Uwfo # sivg+dAXQQBKVXn8UbfznFyEKueT0RW5CUbfeEqGQ/ocw7iTrXABsX+tjcktxl8Q # zrHZNoAz6Ds= # =7LWn # -----END PGP SIGNATURE----- # gpg: Signature made Tue 02 Jul 2024 09:21:32 AM PDT # gpg: using RSA key DC3DEB159A9AF95D3D7456FE7F09B272C88F2FD6 # gpg: issuer "kwolf@redhat.com" # gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" [full] * tag 'for-upstream' of https://repo.or.cz/qemu/kevin: block: Parse filenames only when explicitly requested iotests/270: Don't store data-file with json: prefix in image iotests/244: Don't store data-file with protocol in image qcow2: Don't open data_file with BDRV_O_NO_IO Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2024-07-02iotests/270: Don't store data-file with json: prefix in imageKevin Wolf
We want to disable filename parsing for data files because it's too easy to abuse in malicious image files. Make the test ready for the change by passing the data file explicitly in command line options. Cc: qemu-stable@nongnu.org Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Hanna Czenczek <hreitz@redhat.com>
2024-07-02iotests/244: Don't store data-file with protocol in imageKevin Wolf
We want to disable filename parsing for data files because it's too easy to abuse in malicious image files. Make the test ready for the change by passing the data file explicitly in command line options. Cc: qemu-stable@nongnu.org Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Hanna Czenczek <hreitz@redhat.com>
2024-07-02qcow2: Don't open data_file with BDRV_O_NO_IOKevin Wolf
One use case for 'qemu-img info' is verifying that untrusted images don't reference an unwanted external file, be it as a backing file or an external data file. To make sure that calling 'qemu-img info' can't already have undesired side effects with a malicious image, just don't open the data file at all with BDRV_O_NO_IO. If nothing ever tries to do I/O, we don't need to have it open. This changes the output of iotests case 061, which used 'qemu-img info' to show that opening an image with an invalid data file fails. After this patch, it succeeds. Replace this part of the test with a qemu-io call, but keep the final 'qemu-img info' to show that the invalid data file is correctly displayed in the output. Fixes: CVE-2024-4467 Cc: qemu-stable@nongnu.org Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Hanna Czenczek <hreitz@redhat.com>
2024-07-02tests/avocado: add hotplug_blk testVladimir Sementsov-Ogievskiy
Introduce a test, that checks that plug/unplug of virtio-blk device works. (the test is developed by copying hotplug_cpu.py, so keep original copyright) Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru> Reviewed-by: Thomas Huth <thuth@redhat.com> Message-ID: <20240409065854.366856-1-vsementsov@yandex-team.ru> Signed-off-by: Thomas Huth <thuth@redhat.com>
2024-07-02tests/qtest: Free GThreadAkihiko Odaki
These GThreads are never referenced. Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Message-ID: <20240627-san-v2-15-750bb0946dbd@daynix.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2024-07-02tests/qtest: Free pathsAkihiko Odaki
This fixes LeakSanitizer warnings. Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Message-ID: <20240627-san-v2-14-750bb0946dbd@daynix.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2024-07-02tests/qtest: Free old machine variable nameAkihiko Odaki
This fixes LeakSanitizer warnings. Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Message-ID: <20240627-san-v2-12-750bb0946dbd@daynix.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2024-07-02tests/qtest: Free unused QMP responseAkihiko Odaki
This fixes LeakSanitizer warnings. Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Message-ID: <20240627-san-v2-11-750bb0946dbd@daynix.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2024-07-02tests/qtest: Use qtest_add_data_func_full()Akihiko Odaki
A test function may not be executed depending on the test command line so it is wrong to free data with a test function. Use qtest_add_data_func_full() to register a function to free data. Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Message-ID: <20240627-san-v2-10-750bb0946dbd@daynix.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2024-07-02tests/qtest/migration-test: enable on s390x with TCGNicholas Piggin
s390x with TCG is more stable now. Enable it. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Message-Id: <20240525131241.378473-3-npiggin@gmail.com> Reviewed-by: Prasad Pandit <pjp@fedoraproject.org> [thuth: Added "with TCG" to the commit message] Signed-off-by: Thomas Huth <thuth@redhat.com>
2024-07-01vhost-user-test: no set non-blocking for cal fd less than 0.Yuxue Liu
In the scenario where vhost-user sets eventfd to -1, qemu_chr_fe_get_msgfds retrieves fd as -1. When vhost_user_read receives, it does not perform blocking operations on the descriptor with fd=-1, so non-blocking operations should not be performed here either.This is a normal use case. Calling g_unix_set_fd_nonblocking at this point will cause the test to interrupt. When vhost_user_write sets the call fd to -1, it sets the number of fds to 0, so the fds obtained by qemu_chr_fe_get_msgfds will also be 0. Signed-off-by: Yuxue Liu <yuxue.liu@jaguarmicro.com> Message-Id: <20240411073555.1357-1-yuxue.liu@jaguarmicro.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2024-07-01tests/qtest/pvpanic: add tests for pvshutdown eventThomas Weißschuh
Validate that a shutdown via the pvpanic device emits the correct QMP events. Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de> Reviewed-by: Thomas Huth <thuth@redhat.com> Message-Id: <20240527-pvpanic-shutdown-v8-7-5a28ec02558b@t-8ch.de> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2024-07-01tests/qtest/pvpanic: use centralized definition of supported eventsThomas Weißschuh
Avoid the necessity to update all tests when new events are added to the device. Acked-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Cornelia Huck <cohuck@redhat.com> Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de> Message-Id: <20240527-pvpanic-shutdown-v8-4-5a28ec02558b@t-8ch.de> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2024-07-01tests/qtest: Ensure STM32L4x5 EXTI state is correct at the end of QTestsInès Varhol
EXTI's new field `irq_levels` tracks irq levels between tests when using `global_qtest`. This happens in `stm32l4x5_exti-test.c`, `stm32l4x5_syscfg-test.c` and `stm32l4x5_gpio-test.c` (`dm163.c` doesn't use `global_qtest`). To ensure that `irq_levels` has the same value before and after each QTest, this commit toggles back the irq lines that were changed at the end of each problematic test. Most QTests were already doing this. Signed-off-by: Inès Varhol <ines.varhol@telecom-paris.fr> Message-id: 20240629110800.539969-3-ines.varhol@telecom-paris.fr Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2024-07-01tests/qtest: Fix STM32L4x5 SYSCFG irq line 15 state assumptionInès Varhol
The QTest `test_irq_pin_multiplexer` makes the assumption that the reset state of irq line 15 is low, which is false since STM32L4x5 GPIO was implemented (the reset state of pin GPIOA15 is high because there's pull-up and it results in the irq line 15 also being high at reset). It wasn't triggering an error because `test_interrupt` was mistakenly "resetting" the line low. This commit corrects these two mistakes by : - not setting the line low in `test_interrupt` - using an irq line in `test_irq_pin_multiplexer` which is low at reset Signed-off-by: Inès Varhol <ines.varhol@telecom-paris.fr> Message-id: 20240629104454.366283-1-ines.varhol@telecom-paris.fr Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2024-07-01target/arm: Fix FJCVTZS vs flush-to-zeroRichard Henderson
Input denormals cause the Javascript inexact bit (output to Z) to be set. Cc: qemu-stable@nongnu.org Fixes: 6c1f6f2733a ("target/arm: Implement ARMv8.3-JSConv") Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2375 Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20240625183536.1672454-4-richard.henderson@linaro.org [PMM: fixed hardcoded tab in test case] Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2024-07-01tests/avocado: use default amount of cores on sbsa-refMarcin Juszkiewicz
The version of the sbsa-ref EDK2 firmware we used to use in this test had a bug where it might make an unaligned access to the framebuffer, which causes a guest crash on newer versions of QEMU where we enforce the architectural requirement that unaligned accesses to Device memory should take an exception. We happened to not notice this because our test was booting with "-smp 1" and through luck this didn't write the boot logo to the framebuffer at an unaligned address; but trying to boot the same firmware with two CPUs would result in a guest crash. Now we have updated the firmware we're using for the test, we can make the test use all the cores on the board, so we are testing the SMP boot path. Signed-off-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-id: 20240620-b4-new-firmware-v3-2-29a3a2f1be1e@linaro.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2024-07-01tests/avocado: update firmware for sbsa-refMarcin Juszkiewicz
Update firmware to have graphics card memory fix from EDK2 commit c1d1910be6e04a8b1a73090cf2881fb698947a6e: OvmfPkg/QemuVideoDxe: add feature PCD to remap framebuffer W/C Some platforms (such as SBSA-QEMU on recent builds of the emulator) only tolerate misaligned accesses to normal memory, and raise alignment faults on such accesses to device memory, which is the default for PCIe MMIO BARs. When emulating a PCIe graphics controller, the framebuffer is typically exposed via a MMIO BAR, while the disposition of the region is closer to memory (no side effects on reads or writes, except for the changing picture on the screen; direct random access to any pixel in the image). In order to permit the use of such controllers on platforms that only tolerate these types of accesses for normal memory, it is necessary to remap the memory. Use the DXE services to set the desired capabilities and attributes. Hide this behavior under a feature PCD so only platforms that really need it can enable it. (OVMF on x86 has no need for this) With this fix enabled we can boot sbsa-ref with more than one cpu core. Signed-off-by: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-id: 20240620-b4-new-firmware-v3-1-29a3a2f1be1e@linaro.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2024-06-24tests/qtest/fuzz: fix memleak in qos_fuzz.cDmitry Frolov
Found with fuzzing for qemu-8.2, but also relevant for master Signed-off-by: Dmitry Frolov <frolov@swemel.ru> Reviewed-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Alexander Bulekov <alxndr@bu.edu> Message-ID: <20240521103106.119021-3-frolov@swemel.ru> Signed-off-by: Thomas Huth <thuth@redhat.com>
2024-06-21tests/migration-tests: Cover postcopy failure on reconnectPeter Xu
Make sure there will be an event for postcopy recovery, irrelevant of whether the reconnect will success, or when the failure happens. The added new case is to fail early in postcopy recovery, in which case it didn't even reach RECOVER stage on src (and in real life it'll be the same to dest, but the test case is just slightly more involved due to the dual socketpair setup). To do that, rename the postcopy_recovery_test_fail to reflect either stage to fail, instead of a boolean. Reviewed-by: Fabiano Rosas <farosas@suse.de> Signed-off-by: Peter Xu <peterx@redhat.com> Signed-off-by: Fabiano Rosas <farosas@suse.de>
2024-06-21tests/migration-tests: Verify postcopy-recover-setup statusPeter Xu
Making sure the postcopy-recover-setup status is present in the postcopy failure unit test. Note that it only applies to src QEMU not dest. Signed-off-by: Peter Xu <peterx@redhat.com> Reviewed-by: Fabiano Rosas <farosas@suse.de> Signed-off-by: Fabiano Rosas <farosas@suse.de>
2024-06-21tests/migration-tests: migration_event_wait()Peter Xu
Introduce a small helper to wait for a migration event, generalized from the incoming migration path. Make the helper easier to use by allowing it to keep waiting until the expected event is received. Signed-off-by: Peter Xu <peterx@redhat.com> Reviewed-by: Fabiano Rosas <farosas@suse.de> Signed-off-by: Fabiano Rosas <farosas@suse.de>
2024-06-21tests/migration-tests: Always enable migration eventsPeter Xu
Libvirt should always enable it, so it'll be nice qtest also cover that for all tests on both sides. migrate_incoming_qmp() used to enable it only on dst, now we enable them on both, as we'll start to sanity check events even on the src QEMU. We'll need to leave the one in migrate_incoming_qmp(), because virtio-net-failover test uses that one only, and it relies on the events to work. Signed-off-by: Peter Xu <peterx@redhat.com> Reviewed-by: Fabiano Rosas <farosas@suse.de> Signed-off-by: Fabiano Rosas <farosas@suse.de>
2024-06-21tests/migration-tests: Drop most WIN32 ifdefs for postcopy failure testsPeter Xu
Most of them are not needed, we can stick with one ifdef inside postcopy_recover_fail() so as to cover the scm right tricks only. The tests won't run on windows anyway due to has_uffd always false. Reviewed-by: Fabiano Rosas <farosas@suse.de> Signed-off-by: Peter Xu <peterx@redhat.com> Signed-off-by: Fabiano Rosas <farosas@suse.de>
2024-06-21tests/qtest/migration: Add a test for mapped-ram with passing of fdsFabiano Rosas
Add a multifd test for mapped-ram with passing of fds into QEMU. This is how libvirt will consume the feature. There are a couple of details to the fdset mechanism: - multifd needs two distinct file descriptors (not duplicated with dup()) so it can enable O_DIRECT only on the channels that do aligned IO. The dup() system call creates file descriptors that share status flags, of which O_DIRECT is one. - the open() access mode flags used for the fds passed into QEMU need to match the flags QEMU uses to open the file. Currently O_WRONLY for src and O_RDONLY for dst. Note that fdset code goes under _WIN32 because fd passing is not supported on Windows. Reviewed-by: Peter Xu <peterx@redhat.com> [brought back the qmp_remove_fd() call at the end of the tests] Signed-off-by: Fabiano Rosas <farosas@suse.de>
2024-06-21tests/qtest/migration: Add tests for file migration with direct-ioFabiano Rosas
The tests are only allowed to run in systems that know about the O_DIRECT flag and in filesystems which support it. Note: this also brings back migrate_set_parameter_bool() which went away when we removed the compression tests. I copied it verbatim. Reviewed-by: Peter Xu <peterx@redhat.com> Signed-off-by: Fabiano Rosas <farosas@suse.de>
2024-06-21monitor: Stop removing non-duplicated fdsFabiano Rosas
monitor_fdsets_cleanup() currently has three responsibilities: 1- Remove the fds that have been marked for removal(->removed=true) by qmp_remove_fd(). This is overly complicated, but ok. 2- Remove any file descriptors that have been passed into QEMU and never duplicated[1,2]. A file descriptor without duplicates indicates that no part of QEMU has made use of it. This is problematic because the current implementation does it only if the guest is not running and the monitor is closed. 3- Remove/free fdsets that have become empty due to the above removals. This is ok. The scenario described in (2) is starting to show some cracks now that we're trying to consume fds from the migration code: - Doing cleanup every time the last monitor connection closes works to reap unused fds, but also has the side effect of forcing the management layer to pass the file descriptors again in case of a disconnect/re-connect, if that happened to be the only monitor connection. Another side effect is that removing an fd with qmp_remove_fd() is effectively delayed until the last monitor connection closes. The usage of mon_refcount is also problematic because it's racy. - Checking runstate_is_running() skips the cleanup unless the VM is running and avoids premature cleanup of the fds, but also has the side effect of blocking the legitimate removal of an fd via qmp_remove_fd() if the VM happens to be in another state. This affects qmp_remove_fd() and qmp_query_fdsets() in particular because requesting a removal at a bad time (guest stopped) might cause an fd to never be removed, or to be removed at a much later point in time, causing the query command to continue showing the supposedly removed fd/fdset. Note that file descriptors that *have* been duplicated are owned by the code that uses them and will be removed after qemu_close() is called. Therefore we've decided that the best course of action to avoid the undesired side-effects is to stop managing non-duplicated file descriptors. 1- efb87c1697 ("monitor: Clean up fd sets on monitor disconnect") 2- ebe52b592d ("monitor: Prevent removing fd from set during init") Reviewed-by: Peter Xu <peterx@redhat.com> [fix logic mistake: s/fdset_free/fdset_free_if_empty] Signed-off-by: Fabiano Rosas <farosas@suse.de>
2024-06-20tests/qtest/migration: Add a precopy file test with fdsetFabiano Rosas
Add a test for file migration using fdset. The passing of fds is more complex than using a file path. This is also the scenario where it's most important we ensure that the initial migration stream offset is respected because the fdset interface is the one used by the management layer when providing a non empty migration file. Note that fd passing is not available on Windows, so anything that uses add-fd needs to exclude that platform. Reviewed-by: Peter Xu <peterx@redhat.com> Signed-off-by: Fabiano Rosas <farosas@suse.de>
2024-06-20tests/qtest/migration: Fix file migration offset checkFabiano Rosas
When doing file migration, QEMU accepts an offset that should be skipped when writing the migration stream to the file. The purpose of the offset is to allow the management layer to put its own metadata at the start of the file. We have tests for this in migration-test, but only testing that the migration stream starts at the correct offset and not that it actually leaves the data intact. Unsurprisingly, there's been a bug in that area that the tests didn't catch. Fix the tests to write some data to the offset region and check that it's actually there after the migration. While here, switch to using g_get_file_contents() which is more portable than mmap(). Reviewed-by: Peter Xu <peterx@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Fabiano Rosas <farosas@suse.de>
2024-06-19hw/i386/pc: Remove PCMachineClass::enforce_aligned_dimmPhilippe Mathieu-Daudé
PCMachineClass::enforce_aligned_dimm was only used by the pc-i440fx-2.1 machine, which got removed. It is now always true. Remove it, simplifying pc_get_device_memory_range(). Update the comment in Avocado test_phybits_low_pse36(). Reviewed-by: Zhao Liu <zhao1.liu@intel.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Igor Mammedov <imammedo@redhat.com> Message-Id: <20240617071118.60464-14-philmd@linaro.org>
2024-06-16test/avocado/machine_aspeed.py: Add AST2700 test caseJamin Lin
Add a test case to test Aspeed OpenBMC SDK v09.01 on AST2700 board. It loads u-boot-nodtb.bin, u-boot.dtb, tfa and optee-os images to dram first which base address is 0x400000000. Then, boot and launch 4 cpu cores. ``` qemu-system-aarch64 -machine ast2700-evb -device loader,force-raw=on,addr=0x400000000,file=workdir/u-boot-nodtb.bin \ -device loader,force-raw=on,addr=uboot_dtb_load_addr,file=workdir/u-boot.dtb\ -device loader,force-raw=on,addr=0x430000000,file=workdir/bl31.bin\ -device loader,force-raw=on,addr=0x430080000,file=workdir/optee/tee-raw.bin\ -device loader,cpu-num=0,addr=0x430000000 \ -device loader,cpu-num=1,addr=0x430000000 \ -device loader,cpu-num=2,addr=0x430000000 \ -device loader,cpu-num=3,addr=0x430000000 \ -smp 4 \ -drive file=workdir/image-bmc,format=raw,if=mtd ``` A test image is downloaded from the ASPEED Forked OpenBMC GitHub release repository : https://github.com/AspeedTech-BMC/openbmc/releases/ Signed-off-by: Troy Lee <troy_lee@aspeedtech.com> Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com> Reviewed-by: Cédric Le Goater <clg@kaod.org>
2024-06-14tests/migration-test: add uadk compression testShameer Kolothum
Reviewed-by: Fabiano Rosas <farosas@suse.de> Signed-off-by: Shameer Kolothum <shameerali.kolothum.thodi@huawei.com> Signed-off-by: Fabiano Rosas <farosas@suse.de>
2024-06-14tests/migration-test: add qpl compression testYuan Liu
add qpl to compression method test for multifd migration the qpl compression supports software path and hardware path(IAA device), and the hardware path is used first by default. If the hardware path is unavailable, it will automatically fallback to the software path for testing. Signed-off-by: Yuan Liu <yuan1.liu@intel.com> Reviewed-by: Nanhai Zou <nanhai.zou@intel.com> Reviewed-by: Peter Xu <peterx@redhat.com> Reviewed-by: Fabiano Rosas <farosas@suse.de> Signed-off-by: Fabiano Rosas <farosas@suse.de>
2024-06-14tests/qtest/migration-test: Use custom asm bios for ppc64Nicholas Piggin
Similar to other archs, build a custom bios memory updater. Running the test with OF code is a cool trick, but SLOF takes a long time to boot. This reduces test time by around 3x (150s to 50s). Reviewed-by: Fabiano Rosas <farosas@suse.de> Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Fabiano Rosas <farosas@suse.de>
2024-06-14tests/qtest/migration-test: Enable on ppc64 TCGNicholas Piggin
ppc64 with TCG seems to no longer be failing this test, perhaps since commit 03bfc2188f061 ("physmem: Fix migration dirty bitmap coherency with TCG memory access") which is not ppc specific but was seen to hit ppc64 quite easily. Let's enable it again. The s390x problem has been identified so mention it while we are adjusting the comment. Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Reviewed-by: Prasad Pandit <pjp@fedoraproject.org> Signed-off-by: Fabiano Rosas <farosas@suse.de>
2024-06-14tests/qtest/migration-test: Quieten ppc64 QEMU warningsNicholas Piggin
Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Fabiano Rosas <farosas@suse.de>
2024-06-14tests/qtest: Move common define from libqos-spapr.h to new ppc-util.hNicholas Piggin
The spapr QEMU machine defaults is useful outside libqos, so create a new header for ppc specific qtests and move it there. Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Fabiano Rosas <farosas@suse.de>
2024-06-13Merge tag 'pull-request-2024-06-12' of https://gitlab.com/thuth/qemu into ↵Richard Henderson
staging * Fix loongarch64 avocado test * Make qtests more flexible with regards to non-available CPU models * Improvements for the test-smp-parse unit test # -----BEGIN PGP SIGNATURE----- # # iQJFBAABCAAvFiEEJ7iIR+7gJQEY8+q5LtnXdP5wLbUFAmZpoEoRHHRodXRoQHJl # ZGhhdC5jb20ACgkQLtnXdP5wLbVF6g/+JYTRKmaIduQIP9g2+NkM+qMTbjI9Ow47 # 8Vdj/ePMXNWOZsgMPkCUdisYeMZEC+XMcDN1xvwZXwLTMTJRacZCSFRpeN4P0m0W # 6aQ28+tPNgx+B9Eh2kc4TpxbiqSH8u5u4GEN4Y07rcX/3YbYyjFgZD8orRu/nJ+H # 0wV7Riq9csi1BkLxrgKaHocFSOl4eOga4OFi+u4wIn/xoW3MN0laxe4iuoQRMZPf # gJLPRhEija4lto8iIKNxJbTABB0wEcWRWtgqcbHxdatqh1lPTPBpWxmdD/v1LJn+ # H/eO+oh05NQdlhw7+xfWF9PD+MpIePbZ28oNb3X3uURROTdcxpBAgpPipv07FsT4 # LmU2nIBQ4FcpDOkhLnLmBmFBNO6uDCzuGzxFRhX1SIiGMABqTDOKynBQSgQI2iB0 # 5J47XUwHtnOoCvf4SRA/MZG8zNSQZdJbnuOBLgZ+vsCG14mWM2NbfSUwRkH6pd/J # fEbODuzHZoYgUTxjR9+WMbINAbNjMy+SP2sGZIBzcAIIkybKynOy58LoCyNT684U # ean9bnc65908PJxEfsQ6k9kNwkK4GwOqZi+X383nVgMJ9+3dDw8M76IVU59hsq1n # wnz4VgFcRdXMYhj9zghaCgH2Ezw8gZHILXH+RlX0Bav4LQ5vSZQ6tRNwM4+rfXBe # okF1Sxmz31U= # =s7+V # -----END PGP SIGNATURE----- # gpg: Signature made Wed 12 Jun 2024 06:19:06 AM PDT # gpg: using RSA key 27B88847EEE0250118F3EAB92ED9D774FE702DB5 # gpg: issuer "thuth@redhat.com" # gpg: Good signature from "Thomas Huth <th.huth@gmx.de>" [full] # gpg: aka "Thomas Huth <thuth@redhat.com>" [full] # gpg: aka "Thomas Huth <th.huth@posteo.de>" [unknown] # gpg: aka "Thomas Huth <huth@tuxfamily.org>" [full] * tag 'pull-request-2024-06-12' of https://gitlab.com/thuth/qemu: tests/tcg/s390x: Allow specifying extra QEMU options on the command line tests/unit/test-smp-parse: Test the full 8-levels topology hierarchy tests/unit/test-smp-parse: Test "modules" and "dies" combination case tests/unit/test-smp-parse: Test "modules" parameter in -smp tests/unit/test-smp-parse: Make test cases aware of module level tests/unit/test-smp-parse: Use default parameters=0 when not set in -smp tests/unit/test-smp-parse: Fix an invalid topology case tests/unit/test-smp-parse: Fix comment of parameters=1 case tests/unit/test-smp-parse: Fix comments of drawers and books case test: Remove libibumad dependence meson: Remove libibumad dependence tests/qtest/x86: check for availability of older cpu models before running tests tests/qtest/libqtest: add qtest_has_cpu_model() api qtest/x86/numa-test: do not use the obsolete 'pentium' cpu tests/avocado: Update LoongArch bios file Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2024-06-12tests/tcg/s390x: Allow specifying extra QEMU options on the command lineIlya Leoshkevich
The use case for this is `make check-tcg EXTFLAGS="-accel kvm"`, which allows validating the system TCG testcases on real hardware. EXTFLAGS name is borrowed from tests/tcg/xtensa/Makefile.softmmu-target. While at it, use += instead of = in order to be consistent with the other architectures. Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Message-ID: <20240522184116.35975-1-iii@linux.ibm.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2024-06-12tests/unit/test-smp-parse: Test the full 8-levels topology hierarchyZhao Liu
With module level, QEMU now support 8-levels topology hierarchy. Cover "modules" in SMP_CONFIG_WITH_FULL_TOPO related cases. Signed-off-by: Zhao Liu <zhao1.liu@intel.com> Tested-by: Yongwei Ma <yongwei.ma@intel.com> Message-ID: <20240529061925.350323-9-zhao1.liu@intel.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2024-06-12tests/unit/test-smp-parse: Test "modules" and "dies" combination caseZhao Liu
Since i386 PC machine supports both "modules" and "dies" in -smp, add the "modules" and "dies" combination test case to match the actual topology usage scenario. Signed-off-by: Zhao Liu <zhao1.liu@intel.com> Tested-by: Yongwei Ma <yongwei.ma@intel.com> Message-ID: <20240529061925.350323-8-zhao1.liu@intel.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2024-06-12tests/unit/test-smp-parse: Test "modules" parameter in -smpZhao Liu
Cover the module cases in test-smp-parse. Signed-off-by: Zhao Liu <zhao1.liu@intel.com> Tested-by: Yongwei Ma <yongwei.ma@intel.com> Message-ID: <20240529061925.350323-7-zhao1.liu@intel.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2024-06-12tests/unit/test-smp-parse: Make test cases aware of module levelZhao Liu
Currently, -smp supports module level. It is necessary to consider the effects of module in the test cases to ensure that the calculations are correct. This is also the preparation to add module test cases. Signed-off-by: Zhao Liu <zhao1.liu@intel.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Tested-by: Yongwei Ma <yongwei.ma@intel.com> Message-ID: <20240529061925.350323-6-zhao1.liu@intel.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2024-06-12tests/unit/test-smp-parse: Use default parameters=0 when not set in -smpZhao Liu
Since -smp allows parameters=1 whether the level is supported by machine, to avoid the test scenarios where the parameter defaults to 1 cause some errors to be masked, explicitly set undesired parameters to 0. Signed-off-by: Zhao Liu <zhao1.liu@intel.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Tested-by: Yongwei Ma <yongwei.ma@intel.com> Message-ID: <20240529061925.350323-5-zhao1.liu@intel.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
2024-06-12tests/unit/test-smp-parse: Fix an invalid topology caseZhao Liu
Adjust the "cpus" parameter to match the comment configuration. Signed-off-by: Zhao Liu <zhao1.liu@intel.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Tested-by: Yongwei Ma <yongwei.ma@intel.com> Message-ID: <20240529061925.350323-4-zhao1.liu@intel.com> Signed-off-by: Thomas Huth <thuth@redhat.com>