[PATCH v4] vhsot-user: Do not wait for reply for not sent VHOST_USER_SET_LOG_BASE

xiangwencheng@gmail.com posted 1 patch 1 year, 2 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20240918071930.28771-1-xiangwencheng@gmail.com
Maintainers: "Michael S. Tsirkin" <mst@redhat.com>, Stefano Garzarella <sgarzare@redhat.com>
hw/virtio/vhost-user.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH v4] vhsot-user: Do not wait for reply for not sent VHOST_USER_SET_LOG_BASE
Posted by xiangwencheng@gmail.com 1 year, 2 months ago
From: BillXiang <xiangwencheng@gmail.com>

Clean up commit 7c211eb078c4 ("vhost-user: Skip unnecessary duplicated 
VHOST_USER_SET_LOG_BASE requests") which has added VHOST_USER_SET_LOG_BASE
to vhost_user_per_device_request and will not send it in vhost_user_write
when vq_index != 0 but still wait for replies in vhost_user_set_log_base
for those not sent msgs which will cause qemu hangs up.
So we add check in this patch to read reply only when vq_index == 0.


Signed-off-by: BillXiang <xiangwencheng@gmail.com>
---
V3[1] -> V4:
 - rewrite the commit log to make it clear

[1]https://lists.nongnu.org/archive/html/qemu-devel/2024-09/msg01852.html
---
 hw/virtio/vhost-user.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
index 00561daa06..fd12992d15 100644
--- a/hw/virtio/vhost-user.c
+++ b/hw/virtio/vhost-user.c
@@ -460,7 +460,7 @@ static int vhost_user_set_log_base(struct vhost_dev *dev, uint64_t base,
         return ret;
     }
 
-    if (shmfd) {
+    if (shmfd && dev->vq_index == 0) {
         msg.hdr.size = 0;
         ret = vhost_user_read(dev, &msg);
         if (ret < 0) {
-- 
2.30.0