Skip to contentSkip to conversation

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

PATCH Superseded BillXiang 1 participant 1 message Jul 8, 2024

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

BillXiang

author
#0 lore raw

PATCH 1/1 vhsot-user: Do not wait for replay for not sent VHOST_USER_SET_LOG_BASE

From: BillXiang <[email protected]>

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.

---
 hw/virtio/vhost-user.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
hw/virtio/vhost-user.c +2 -2
index 00561daa06..8451d9019a 100644
@@ -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) {
Signature · 1 line
2.30.0