qemu-e2k/tests/qtest/libqos
Alex Bennée 5b4f72f5e8 tests/qtest: properly initialise the vring used idx
Eric noticed while attempting to enable the vhost-user-blk-test for
Aarch64 that that things didn't work unless he put in a dummy
guest_malloc() at the start of the test. Without it
qvirtio_wait_used_elem() would assert when it reads a junk value for
idx resulting in:

  qvirtqueue_get_buf: idx:2401 last_idx:0
  qvirtqueue_get_buf: 0x7ffcb6d3fe74, (nil)
  qvirtio_wait_used_elem: 3000000/0
  ERROR:../../tests/qtest/libqos/virtio.c:226:qvirtio_wait_used_elem: assertion failed (got_desc_idx == desc_idx): (50331648 == 0)
  Bail out! ERROR:../../tests/qtest/libqos/virtio.c:226:qvirtio_wait_used_elem: assertion failed (got_desc_idx == desc_idx): (50331648 == 0)

What was actually happening is the guest_malloc() effectively pushed
the allocation of the vring into the next page which just happened to
have clear memory. After much tedious tracing of the code I could see
that qvring_init() does attempt initialise a bunch of the vring
structures but skips the vring->used.idx value. It is probably not
wise to assume guest memory is zeroed anyway. Once the ring is
properly initialised the hack is no longer needed to get things
working.

Thanks-to: John Snow <jsnow@redhat.com> for helping debug
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20220406173356.1891500-1-alex.bennee@linaro.org>
Tested-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
2022-04-20 09:01:21 +02:00
..
aarch64-xlnx-zcu102-machine.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
ahci.c Remove qemu-common.h include from most units 2022-04-06 14:31:55 +02:00
ahci.h meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
arm-imx25-pdk-machine.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
arm-n800-machine.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
arm-raspi2-machine.c tests: Remove uses of deprecated raspi2/raspi3 machine names 2021-09-01 11:08:15 +01:00
arm-sabrelite-machine.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
arm-smdkc210-machine.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
arm-virt-machine.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
arm-xilinx-zynq-a9-machine.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
e1000e.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
e1000e.h meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
fw_cfg.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
fw_cfg.h boot-order-test: fix memleaks in boot-order-test 2020-02-04 09:00:57 +01:00
i2c-imx.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
i2c-omap.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
i2c.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
i2c.h meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
libqos-pc.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
libqos-pc.h meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
libqos-spapr.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
libqos-spapr.h meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
libqos.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
libqos.h meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
libqtest.h Replace GCC_FMT_ATTR with G_GNUC_PRINTF 2022-03-22 14:40:51 +04:00
malloc-pc.c Remove qemu-common.h include from most units 2022-04-06 14:31:55 +02:00
malloc-pc.h meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
malloc-spapr.c Remove qemu-common.h include from most units 2022-04-06 14:31:55 +02:00
malloc-spapr.h meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
malloc.c Remove qemu-common.h include from most units 2022-04-06 14:31:55 +02:00
malloc.h
meson.build tests: qtest: Add virtio-iommu test 2021-12-15 08:08:59 +01:00
pci-pc.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
pci-pc.h meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
pci-spapr.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
pci-spapr.h meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
pci.c qtest/libqos: add a function to initialize secondary PCI buses 2021-12-15 08:07:04 +01:00
pci.h qtest/libqos: add a function to initialize secondary PCI buses 2021-12-15 08:07:04 +01:00
ppc64_pseries-machine.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
qgraph_internal.h tests: Remove uses of deprecated raspi2/raspi3 machine names 2021-09-01 11:08:15 +01:00
qgraph.c tests/qtest: Replace g_memdup() by g_memdup2() 2021-12-17 11:56:04 +01:00
qgraph.h tests: Remove uses of deprecated raspi2/raspi3 machine names 2021-09-01 11:08:15 +01:00
qos_external.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
qos_external.h meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
rtas.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
rtas.h meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
sdhci-cmd.c tests/qtest/libqos: add SDHCI commands 2021-11-02 14:14:55 -04:00
sdhci-cmd.h tests/qtest/libqos: add SDHCI commands 2021-11-02 14:14:55 -04:00
sdhci.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
sdhci.h meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
tpci200.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
usb.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
usb.h meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
vhost-user-blk.c test: new qTest case to test the vhost-user-blk-server 2021-05-18 12:57:38 +02:00
vhost-user-blk.h test: new qTest case to test the vhost-user-blk-server 2021-05-18 12:57:38 +02:00
virtio-9p.c tests/9pfs: Use g_autofree and g_autoptr where possible 2022-02-17 16:57:58 +01:00
virtio-9p.h tests/9pfs: make create/remove test dir public 2020-11-01 19:44:29 +01:00
virtio-balloon.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
virtio-balloon.h meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
virtio-blk.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
virtio-blk.h meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
virtio-iommu.c tests: qtest: Add virtio-iommu test 2021-12-15 08:08:59 +01:00
virtio-iommu.h tests: qtest: Add virtio-iommu test 2021-12-15 08:08:59 +01:00
virtio-mmio.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
virtio-mmio.h meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
virtio-net.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
virtio-net.h meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
virtio-pci-modern.c
virtio-pci-modern.h
virtio-pci.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
virtio-pci.h meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
virtio-rng.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
virtio-rng.h meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
virtio-scsi.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
virtio-scsi.h meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
virtio-serial.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
virtio-serial.h meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
virtio.c tests/qtest: properly initialise the vring used idx 2022-04-20 09:01:21 +02:00
virtio.h meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00
x86_64_pc-machine.c meson: convert tests/qtest to meson 2020-08-21 06:30:20 -04:00