From: Thomas Huth <thuth@redhat.com>
To: Daniel Henrique Barboza <dbarboza@ventanamicro.com>,
qemu-devel@nongnu.org
Cc: qemu-riscv@nongnu.org, alistair.francis@wdc.com,
bmeng@tinylab.org, liwei1518@gmail.com,
zhiwei_liu@linux.alibaba.com, palmer@rivosinc.com,
lvivier@redhat.com, pbonzini@redhat.com, ajones@ventanamicro.com,
alex.bennee@linaro.org
Subject: Re: [PATCH 1/6] libqos/virtio.c: init all elems in qvring_indirect_desc_setup()
Date: Fri, 16 Feb 2024 11:23:28 +0100 [thread overview]
Message-ID: <489bdcf3-f3ec-4c1e-a651-7b48df24cf3b@redhat.com> (raw)
In-Reply-To: <20240213191736.733334-2-dbarboza@ventanamicro.com>
On 13/02/2024 20.17, Daniel Henrique Barboza wrote:
> The loop isn't setting the values for the last element. Every other
> element is being initialized with addr = 0, flags = VRING_DESC_F_NEXT
> and next = i + 1. The last elem is never touched.
>
> This became a problem when enabling a RISC-V 'virt' libqos machine in
> the 'indirect' test of virti-blk-test.c. The 'flags' for the last
> element will end up being an odd number (since we didn't touch it).
> Being an odd number it will be mistaken by VRING_DESC_F_NEXT, which
> happens to be 1.
>
> Deep into hw/virt/virtio.c, in virtqueue_split_pop(), into
> virtqueue_split_read_next_desc(), a check for VRING_DESC_F_NEXT will be
> made to see if we're supposed to chain. The code will keep up chaining
> in the last element because the unintialized value happens to be odd.
s/unintialized/uninitialized/
> We'll error out right after that because desc->next (which is also
> uninitialized) will be >= max. A VIRTQUEUE_READ_DESC_ERROR will be
> returned, with an error message like this in the stderr:
>
> qemu-system-riscv64: Desc next is 49391
>
> Since we never returned, w'll end up timing out at qvirtio_wait_used_elem():
s/w'll/we'll/
> ERROR:../tests/qtest/libqos/virtio.c:236:qvirtio_wait_used_elem:
> assertion failed: (g_get_monotonic_time() - start_time <= timeout_us)
>
> The root cause is using unintialized values from guest_alloc() in
s/unintialized/uninitialized/
With the typos fixed:
Reviewed-by: Thomas Huth <thuth@redhat.com>
next prev parent reply other threads:[~2024-02-16 10:23 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-13 19:17 [PATCH 0/6] libqos, riscv: libqos fixes, add riscv machine Daniel Henrique Barboza
2024-02-13 19:17 ` [PATCH 1/6] libqos/virtio.c: init all elems in qvring_indirect_desc_setup() Daniel Henrique Barboza
2024-02-15 5:02 ` Alistair Francis
2024-02-16 10:23 ` Thomas Huth [this message]
2024-02-13 19:17 ` [PATCH 2/6] libqos/virtio.c: fix 'avail_event' offset in qvring_init() Daniel Henrique Barboza
2024-02-15 5:06 ` Alistair Francis
2024-02-16 10:47 ` Thomas Huth
2024-02-13 19:17 ` [PATCH 3/6] hw/riscv/virt.c: create '/soc/pci@...' fdt node earlier Daniel Henrique Barboza
2024-02-15 5:08 ` Alistair Francis
2024-02-13 19:17 ` [PATCH 4/6] hw/riscv/virt.c: add virtio-iommu-pci hotplug support Daniel Henrique Barboza
2024-02-15 5:11 ` Alistair Francis
2024-02-13 19:17 ` [PATCH 5/6] hw/riscv/virt.c: make aclint compatible with 'qtest' accel Daniel Henrique Barboza
2024-02-15 5:14 ` Alistair Francis
2024-02-13 19:17 ` [PATCH 6/6] tests/libqos: add riscv/virt machine nodes Daniel Henrique Barboza
2024-02-15 5:35 ` Alistair Francis
2024-02-16 10:58 ` Thomas Huth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=489bdcf3-f3ec-4c1e-a651-7b48df24cf3b@redhat.com \
--to=thuth@redhat.com \
--cc=ajones@ventanamicro.com \
--cc=alex.bennee@linaro.org \
--cc=alistair.francis@wdc.com \
--cc=bmeng@tinylab.org \
--cc=dbarboza@ventanamicro.com \
--cc=liwei1518@gmail.com \
--cc=lvivier@redhat.com \
--cc=palmer@rivosinc.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=zhiwei_liu@linux.alibaba.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).