Skip to contentSkip to conversation

vhost-user: Fix backends without multiqueue support

PATCH In review Kevin Wolf 3 participants 3 messages Jul 5, 2021 – Jul 8, 2021

lore
Share & tools
lore

Kevin Wolf

author
#0 lore raw

PATCH 1/1 vhost-user: Fix backends without multiqueue support

dev->max_queues was never initialised for backends that don't support VHOST_USER_PROTOCOL_F_MQ, so it would use 0 as the maximum number of queues to check against and consequently fail for any such backend.

Set it to 1 if the backend doesn't have multiqueue support.

Fixes c90bd505a3e8210c23d69fecab9ee6f56ec4a161
---
 hw/virtio/vhost-user.c | 3 +++
 1 file changed, 3 insertions(+)
hw/virtio/vhost-user.c +3 -0
index 1ac4a2ebec..29ea2b4fce 100644
@@ -1913,7 +1913,10 @@ static int vhost_user_backend_init(struct vhost_dev *dev, void *opaque,
             if (err < 0) {
                 return -EPROTO;
             }
+        } else {
+            dev->max_queues = 1;
         }
+
         if (dev->num_queues && dev->max_queues < dev->num_queues) {
             error_setg(errp, "The maximum number of queues supported by the "
                        "backend is %" PRIu64, dev->max_queues);
Signature · 1 line
2.31.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Kevin Wolf

dev->max_queues was never initialised for backends that don't support VHOST_USER_PROTOCOL_F_MQ, so it would use 0 as the maximum number of queues to check against and consequently fail for any such backend.

Set it to 1 if the backend doesn't have multiqueue support.

Fixes c90bd505a3e8210c23d69fecab9ee6f56ec4a161
---
 hw/virtio/vhost-user.c | 3 +++
 1 file changed, 3 insertions(+)
Reviewed-by on v1 1/1
#2 lore raw
In reply to Kevin Wolf
Quoted 8 lines · Kevin Wolf

dev->max_queues was never initialised for backends that don't support VHOST_USER_PROTOCOL_F_MQ, so it would use 0 as the maximum number of queues to check against and consequently fail for any such backend.

Set it to 1 if the backend doesn't have multiqueue support.

Fixes c90bd505a3e8210c23d69fecab9ee6f56ec4a161
Quoted 22 lines
---
 hw/virtio/vhost-user.c | 3 +++
 1 file changed, 3 insertions(+)
hw/virtio/vhost-user.c +3 -0
index 1ac4a2ebec..29ea2b4fce 100644
@@ -1913,7 +1913,10 @@ static int vhost_user_backend_init(struct vhost_dev *dev, void *opaque,
             if (err < 0) {
                 return -EPROTO;
             }
+        } else {
+            dev->max_queues = 1;
         }
+
         if (dev->num_queues && dev->max_queues < dev->num_queues) {
             error_setg(errp, "The maximum number of queues supported by the "
                        "backend is %" PRIu64, dev->max_queues);
Signature · 1 line
2.31.1