diff mbox series

vhsot-user: Do not wait for replay for not sent VHOST_USER_SET_LOG_BASE

Message ID 20240708045054.65040-1-xiangwencheng@dayudpu.com (mailing list archive)
State New, archived
Headers show
Series vhsot-user: Do not wait for replay for not sent VHOST_USER_SET_LOG_BASE | expand

Commit Message

BillXiang July 8, 2024, 4:50 a.m. UTC
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 mbox series

Patch

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) {