All Virtuozzo development lists (kernel + QEMU)
 help / color / mirror / Atom feed
From: Alexander Ivanov <alexander.ivanov@virtuozzo.com>
To: andrey.zhadchenko@virtuozzo.com
Cc: andrey.drobyshev@virtuozzo.com, svt-core@virtuozzo.com
Subject: [PATCH hci-8.1 v5 2/5] vhost-blk: reject num-queues above VHOST_BLK_MAX_QUEUES
Date: Sat, 31 Oct 2026 16:35:25 +0100	[thread overview]
Message-ID: <20261031153528.3857823-3-alexander.ivanov@virtuozzo.com> (raw)
In-Reply-To: <20261031153528.3857823-1-alexander.ivanov@virtuozzo.com>

Only the automatic num-queues value is capped at VHOST_BLK_MAX_QUEUES,
an explicit one is taken as is. The kernel vhost-blk device has that
many virtqueues and rejects any vq beyond them, so realize fails with
an error that does not point at num-queues:

  qemu-system-x86_64: vhost_set_vring_call failed: No buffer space available (105)
  qemu-system-x86_64: vhost-blk: vhost initialization failed: No buffer space available

Check num-queues against the limit up front instead.

https://virtuozzo.atlassian.net/browse/VSTOR-107537

Fixes: 0ff3cb5ff28f ("block: add vhost-blk backend")
Signed-off-by: Alexander Ivanov <alexander.ivanov@virtuozzo.com>
Reviewed-by: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com>
---
 hw/block/vhost-blk.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/hw/block/vhost-blk.c b/hw/block/vhost-blk.c
index abddff02c6d..8a015d54fa7 100644
--- a/hw/block/vhost-blk.c
+++ b/hw/block/vhost-blk.c
@@ -598,8 +598,9 @@ static void vhost_blk_device_realize(DeviceState *dev, Error **errp)
                                VHOST_BLK_MAX_QUEUES);
     }
 
-    if (!conf->num_queues) {
-        error_setg(errp, "vhost-blk: num-queues property must be larger than 0");
+    if (!conf->num_queues || conf->num_queues > VHOST_BLK_MAX_QUEUES) {
+        error_setg(errp, "vhost-blk: invalid num-queues property (%" PRIu16 "), "
+                   "must be 1-%d", conf->num_queues, VHOST_BLK_MAX_QUEUES);
         return;
     }
 
-- 
2.53.0


  parent reply	other threads:[~2026-10-31 15:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-31 15:35 [PATCH hci-8.1 v5 0/5] vhost-blk: switch from VHOST_SET_NWORKERS to the mainstream worker ioctls Alexander Ivanov
2026-10-31 15:35 ` [PATCH hci-8.1 v5 1/5] vhost-backend: add vhost_set_fork_from_owner op Alexander Ivanov
2026-10-31 15:35 ` Alexander Ivanov [this message]
2026-10-31 15:35 ` [PATCH hci-8.1 v5 3/5] vhost-blk: use a local vhost_dev pointer in start and stop Alexander Ivanov
2026-10-31 15:35 ` [PATCH hci-8.1 v5 4/5] vhost-blk: create kernel threads with the mainstream worker ioctls Alexander Ivanov
2026-11-02 16:26   ` Andrey Drobyshev
2026-10-31 15:35 ` [PATCH hci-8.1 v5 5/5] linux-headers: drop VHOST_SET_NWORKERS Alexander Ivanov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261031153528.3857823-3-alexander.ivanov@virtuozzo.com \
    --to=alexander.ivanov@virtuozzo.com \
    --cc=andrey.drobyshev@virtuozzo.com \
    --cc=andrey.zhadchenko@virtuozzo.com \
    --cc=svt-core@virtuozzo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.