From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: Jianping Zhao <zhao305149619@gmail.com>
Cc: dev@dpdk.org
Subject: Re: [PATCH v4] vhost/user: clear ring addresses when getting vring base
Date: Fri, 17 Jan 2025 10:25:28 +0100 [thread overview]
Message-ID: <d90feb5b-9521-4fd9-829c-2d6a7ae0bf48@redhat.com> (raw)
In-Reply-To: <20241127020349.3968025-1-zhao305149619@gmail.com>
On 11/27/24 3:03 AM, Jianping Zhao wrote:
> Clear ring addresses during vring base retrieval to handle guest reboot
> scenarios correctly. This is particularly important for vdpa-blk devices
> where the following issue occurs:
>
> When a guest OS with vdpa-blk device reboots, during UEFI stage, only
> one vring is actually used and configured. However, QEMU still sends
> enable messages for all configured queues. The remaining queues retain
> their addresses from before reboot, which reference invalid memory
> mappings in the rebooted guest.
>
> The issue manifests in vq_is_ready():
>
> static bool
> vq_is_ready(struct virtio_net *dev, struct vhost_virtqueue *vq)
> {
> /* Only checks pointer validity, not address freshness */
> rings_ok = vq->desc && vq->avail && vq->used;
> ...
> }
>
> vq_is_ready() incorrectly considers these queues as ready because it
> only checks if desc/avail/used pointers are non-NULL, but cannot
> detect that these addresses are stale from the previous boot.
>
> Clear the ring addresses in vhost_user_get_vring_base() to force
> the guest driver to reconfigure them before use. This ensures that
> vq_is_ready() will return false for queues with stale addresses
> until they are properly reconfigured by the guest driver.
>
> Fixes: 3ea7052f4b1b ("vhost: postpone rings addresses translation")
>
> Signed-off-by: Jianping Zhao <zhao305149619@gmail.com>
> ---
> lib/vhost/vhost_user.c | 1 +
> 1 file changed, 1 insertion(+)
Applied to next-virtio/for-next-net.
Thanks,
Maxime
prev parent reply other threads:[~2025-01-17 9:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-25 3:42 [PATCH v2] " Jianping Zhao
2024-11-25 3:45 ` [PATCH v3] " Jianping Zhao
2024-11-27 2:03 ` [PATCH v4] " Jianping Zhao
2025-01-10 8:58 ` Maxime Coquelin
2025-01-17 9:25 ` Maxime Coquelin [this message]
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=d90feb5b-9521-4fd9-829c-2d6a7ae0bf48@redhat.com \
--to=maxime.coquelin@redhat.com \
--cc=dev@dpdk.org \
--cc=zhao305149619@gmail.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).