* [PATCH] vdpa: fix cannot get vring base when stopping a vhost-vdpa device with multiple queues
@ 2025-10-29 12:50 Wafer Xie
2025-11-06 6:41 ` Jason Wang
2025-11-06 8:04 ` Eugenio Perez Martin
0 siblings, 2 replies; 3+ messages in thread
From: Wafer Xie @ 2025-10-29 12:50 UTC (permalink / raw)
To: eperezma, mst, qemu-devel; +Cc: jasowang, angus.chen, wafer
When stopping a vhost-vdpa device, only the first queue pair is marked as suspended,
while the remaining queues are not updated to the suspended state.
As a result, when stopping a multi-queue vhost-vdpa device,
the following error message will be printed.
qemu-system-x86_64:vhost VQ 2 ring restore failed: -1: Operation not permitted (1)
qemu-system-x86_64:vhost VQ 3 ring restore failed: -1: Operation not permitted (1)
Fixes: b6662cb7 ("vdpa: add vhost_vdpa->suspended parameter")
Signed-off-by: Wafer Xie <wafer@jaguarmicro.com>
---
hw/virtio/vhost-vdpa.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
index 7061b6e1a3..2d5e6aca74 100644
--- a/hw/virtio/vhost-vdpa.c
+++ b/hw/virtio/vhost-vdpa.c
@@ -1481,7 +1481,7 @@ static int vhost_vdpa_get_vring_base(struct vhost_dev *dev,
return 0;
}
- if (!v->suspended) {
+ if (!v->suspended && vhost_vdpa_first_dev(dev)) {
/*
* Cannot trust in value returned by device, let vhost recover used
* idx from guest.
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] vdpa: fix cannot get vring base when stopping a vhost-vdpa device with multiple queues
2025-10-29 12:50 [PATCH] vdpa: fix cannot get vring base when stopping a vhost-vdpa device with multiple queues Wafer Xie
@ 2025-11-06 6:41 ` Jason Wang
2025-11-06 8:04 ` Eugenio Perez Martin
1 sibling, 0 replies; 3+ messages in thread
From: Jason Wang @ 2025-11-06 6:41 UTC (permalink / raw)
To: Wafer Xie; +Cc: eperezma, mst, qemu-devel, angus.chen
On Wed, Oct 29, 2025 at 8:50 PM Wafer Xie <wafer@jaguarmicro.com> wrote:
>
> When stopping a vhost-vdpa device, only the first queue pair is marked as suspended,
> while the remaining queues are not updated to the suspended state.
This looks like a bug, no?
> As a result, when stopping a multi-queue vhost-vdpa device,
> the following error message will be printed.
>
> qemu-system-x86_64:vhost VQ 2 ring restore failed: -1: Operation not permitted (1)
>
> qemu-system-x86_64:vhost VQ 3 ring restore failed: -1: Operation not permitted (1)
>
> Fixes: b6662cb7 ("vdpa: add vhost_vdpa->suspended parameter")
>
> Signed-off-by: Wafer Xie <wafer@jaguarmicro.com>
> ---
> hw/virtio/vhost-vdpa.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
> index 7061b6e1a3..2d5e6aca74 100644
> --- a/hw/virtio/vhost-vdpa.c
> +++ b/hw/virtio/vhost-vdpa.c
> @@ -1481,7 +1481,7 @@ static int vhost_vdpa_get_vring_base(struct vhost_dev *dev,
> return 0;
> }
>
> - if (!v->suspended) {
> + if (!v->suspended && vhost_vdpa_first_dev(dev)) {
> /*
> * Cannot trust in value returned by device, let vhost recover used
> * idx from guest.
> --
> 2.34.1
>
Thanks
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] vdpa: fix cannot get vring base when stopping a vhost-vdpa device with multiple queues
2025-10-29 12:50 [PATCH] vdpa: fix cannot get vring base when stopping a vhost-vdpa device with multiple queues Wafer Xie
2025-11-06 6:41 ` Jason Wang
@ 2025-11-06 8:04 ` Eugenio Perez Martin
1 sibling, 0 replies; 3+ messages in thread
From: Eugenio Perez Martin @ 2025-11-06 8:04 UTC (permalink / raw)
To: Wafer Xie; +Cc: mst, qemu-devel, jasowang, angus.chen
On Wed, Oct 29, 2025 at 1:50 PM Wafer Xie <wafer@jaguarmicro.com> wrote:
>
> When stopping a vhost-vdpa device, only the first queue pair is marked as suspended,
> while the remaining queues are not updated to the suspended state.
> As a result, when stopping a multi-queue vhost-vdpa device,
> the following error message will be printed.
>
> qemu-system-x86_64:vhost VQ 2 ring restore failed: -1: Operation not permitted (1)
>
> qemu-system-x86_64:vhost VQ 3 ring restore failed: -1: Operation not permitted (1)
>
> Fixes: b6662cb7 ("vdpa: add vhost_vdpa->suspended parameter")
>
> Signed-off-by: Wafer Xie <wafer@jaguarmicro.com>
> ---
> hw/virtio/vhost-vdpa.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
> index 7061b6e1a3..2d5e6aca74 100644
> --- a/hw/virtio/vhost-vdpa.c
> +++ b/hw/virtio/vhost-vdpa.c
> @@ -1481,7 +1481,7 @@ static int vhost_vdpa_get_vring_base(struct vhost_dev *dev,
> return 0;
> }
>
> - if (!v->suspended) {
> + if (!v->suspended && vhost_vdpa_first_dev(dev)) {
I'm sorry I missed this fix!
Good catch, thank you very much! But the right fix is to move
v->suspended to v->shared, and then all the vhost_vdpa devices cannot
have different suspended states.
Apart from that, please include the tag
Fixes: 0bb302a9960a ("vdpa: add vhost_vdpa_suspend")
In the patch description.
Thanks!
> /*
> * Cannot trust in value returned by device, let vhost recover used
> * idx from guest.
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-11-06 8:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-29 12:50 [PATCH] vdpa: fix cannot get vring base when stopping a vhost-vdpa device with multiple queues Wafer Xie
2025-11-06 6:41 ` Jason Wang
2025-11-06 8:04 ` Eugenio Perez Martin
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).