5b4f72f5e8
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> |
||
---|---|---|
.. | ||
aarch64-xlnx-zcu102-machine.c | ||
ahci.c | ||
ahci.h | ||
arm-imx25-pdk-machine.c | ||
arm-n800-machine.c | ||
arm-raspi2-machine.c | ||
arm-sabrelite-machine.c | ||
arm-smdkc210-machine.c | ||
arm-virt-machine.c | ||
arm-xilinx-zynq-a9-machine.c | ||
e1000e.c | ||
e1000e.h | ||
fw_cfg.c | ||
fw_cfg.h | ||
i2c-imx.c | ||
i2c-omap.c | ||
i2c.c | ||
i2c.h | ||
libqos-pc.c | ||
libqos-pc.h | ||
libqos-spapr.c | ||
libqos-spapr.h | ||
libqos.c | ||
libqos.h | ||
libqtest.h | ||
malloc-pc.c | ||
malloc-pc.h | ||
malloc-spapr.c | ||
malloc-spapr.h | ||
malloc.c | ||
malloc.h | ||
meson.build | ||
pci-pc.c | ||
pci-pc.h | ||
pci-spapr.c | ||
pci-spapr.h | ||
pci.c | ||
pci.h | ||
ppc64_pseries-machine.c | ||
qgraph_internal.h | ||
qgraph.c | ||
qgraph.h | ||
qos_external.c | ||
qos_external.h | ||
rtas.c | ||
rtas.h | ||
sdhci-cmd.c | ||
sdhci-cmd.h | ||
sdhci.c | ||
sdhci.h | ||
tpci200.c | ||
usb.c | ||
usb.h | ||
vhost-user-blk.c | ||
vhost-user-blk.h | ||
virtio-9p.c | ||
virtio-9p.h | ||
virtio-balloon.c | ||
virtio-balloon.h | ||
virtio-blk.c | ||
virtio-blk.h | ||
virtio-iommu.c | ||
virtio-iommu.h | ||
virtio-mmio.c | ||
virtio-mmio.h | ||
virtio-net.c | ||
virtio-net.h | ||
virtio-pci-modern.c | ||
virtio-pci-modern.h | ||
virtio-pci.c | ||
virtio-pci.h | ||
virtio-rng.c | ||
virtio-rng.h | ||
virtio-scsi.c | ||
virtio-scsi.h | ||
virtio-serial.c | ||
virtio-serial.h | ||
virtio.c | ||
virtio.h | ||
x86_64_pc-machine.c |