patch 'vhost: clear ring addresses when getting vring base' has been queued to stable release 23.11.4
Xueming Li
xuemingl at nvidia.com
Tue Feb 18 13:33:57 CET 2025
Hi,
FYI, your patch has been queued to stable release 23.11.4
Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
Please shout if anyone has objections.
Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.
Queued patches are on a temporary branch at:
https://git.dpdk.org/dpdk-stable/log/?h=23.11-staging
This queued commit can be viewed at:
https://git.dpdk.org/dpdk-stable/commit/?h=23.11-staging&id=9148bf9355898108b2351a153293b2f8932dd460
Thanks.
Xueming Li <xuemingl at nvidia.com>
---
>From 9148bf9355898108b2351a153293b2f8932dd460 Mon Sep 17 00:00:00 2001
From: Jianping Zhao <zhao305149619 at gmail.com>
Date: Wed, 27 Nov 2024 10:03:49 +0800
Subject: [PATCH] vhost: clear ring addresses when getting vring base
Cc: Xueming Li <xuemingl at nvidia.com>
[ upstream commit 1846fe767f00a9d0dade333e7838f81e6721b694 ]
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 at gmail.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin at redhat.com>
---
.mailmap | 1 +
lib/vhost/vhost_user.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/.mailmap b/.mailmap
index ff5b0821ba..71967f7247 100644
--- a/.mailmap
+++ b/.mailmap
@@ -638,6 +638,7 @@ Jia He <justin.he at arm.com> <jia.he at hxt-semitech.com>
Jianbo Liu <jianbo.liu at arm.com> <jianbo.liu at linaro.org>
Jianfeng Tan <jianfeng.tan at intel.com>
Jiangu Zhao <zhaojg at arraynetworks.com.cn>
+Jianping Zhao <zhao305149619 at gmail.com>
Jianwei Ma <jianwei.ma at intel.com>
Jianwei Mei <jianweix.mei at intel.com>
Jiaqi Min <jiaqix.min at intel.com>
diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c
index 5b6c90437c..14808bd5bc 100644
--- a/lib/vhost/vhost_user.c
+++ b/lib/vhost/vhost_user.c
@@ -2201,6 +2201,7 @@ vhost_user_get_vring_base(struct virtio_net **pdev,
rte_rwlock_write_lock(&vq->access_lock);
vring_invalidate(dev, vq);
+ memset(&vq->ring_addrs, 0, sizeof(struct vhost_vring_addr));
rte_rwlock_write_unlock(&vq->access_lock);
return RTE_VHOST_MSG_RESULT_REPLY;
--
2.34.1
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2025-02-18 19:39:00.833629012 +0800
+++ 0002-vhost-clear-ring-addresses-when-getting-vring-base.patch 2025-02-18 19:39:00.398244087 +0800
@@ -1 +1 @@
-From 1846fe767f00a9d0dade333e7838f81e6721b694 Mon Sep 17 00:00:00 2001
+From 9148bf9355898108b2351a153293b2f8932dd460 Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit 1846fe767f00a9d0dade333e7838f81e6721b694 ]
@@ -36 +38,0 @@
-Cc: stable at dpdk.org
@@ -46 +48 @@
-index b90ff0444c..cc1ffe1ad9 100644
+index ff5b0821ba..71967f7247 100644
@@ -49 +51,2 @@
-@@ -674,6 +674,7 @@ Jianbo Liu <jianbo.liu at arm.com> <jianbo.liu at linaro.org>
+@@ -638,6 +638,7 @@ Jia He <justin.he at arm.com> <jia.he at hxt-semitech.com>
+ Jianbo Liu <jianbo.liu at arm.com> <jianbo.liu at linaro.org>
@@ -51 +53,0 @@
- Jiang Yu <yux.jiang at intel.com>
@@ -58 +60 @@
-index 6d92ad904e..52d8078d7c 100644
+index 5b6c90437c..14808bd5bc 100644
@@ -61 +63 @@
-@@ -2277,6 +2277,7 @@ vhost_user_get_vring_base(struct virtio_net **pdev,
+@@ -2201,6 +2201,7 @@ vhost_user_get_vring_base(struct virtio_net **pdev,
More information about the stable
mailing list