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

BillXiang posted 1 patch 4 months, 2 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20240708045054.65040-1-xiangwencheng@dayudpu.com
Maintainers: "Michael S. Tsirkin" <mst@redhat.com>
There is a newer version of this series
hw/virtio/vhost-user.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] vhsot-user: Do not wait for replay for not sent VHOST_USER_SET_LOG_BASE
Posted by BillXiang 4 months, 2 weeks ago
From: BillXiang <xiangwencheng@dayudpu.com>

Hello, there are some code that must be added to my last
commit 7c211eb078c42146ee9a441cc028fbc4c378ef5a of
'Skip unnecessary duplicated VHOST_USER_SET_LOG_BASE requests'.
We can not wait for replies from those duplicated VHOST_USER_SET_LOG_BASE that not really sent.

Signed-off-by: BillXiang <xiangwencheng@dayudpu.com>
---
 hw/virtio/vhost-user.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
index 00561daa06..8451d9019a 100644
--- a/hw/virtio/vhost-user.c
+++ b/hw/virtio/vhost-user.c
@@ -440,7 +440,7 @@ static int vhost_user_set_log_base(struct vhost_dev *dev, uint64_t base,
     int ret;
     VhostUserMsg msg = {
         .hdr.request = VHOST_USER_SET_LOG_BASE,
-        .hdr.flags = VHOST_USER_VERSION,
+        .hdr.flags = VHOST_USER_VERSION | VHOST_USER_NEED_REPLY_MASK,
         .payload.log.mmap_size = log->size * sizeof(*(log->log)),
         .payload.log.mmap_offset = 0,
         .hdr.size = sizeof(msg.payload.log),
@@ -460,7 +460,7 @@ static int vhost_user_set_log_base(struct vhost_dev *dev, uint64_t base,
         return ret;
     }
 
-    if (shmfd) {
+    if (shmfd && (msg.hdr.flags & VHOST_USER_NEED_REPLY_MASK)) {
         msg.hdr.size = 0;
         ret = vhost_user_read(dev, &msg);
         if (ret < 0) {
-- 
2.30.0