From: no-reply@sashiko.virtuozzo.com
To: andrey.zhadchenko@virtuozzo.com,
Alexander Ivanov <alexander.ivanov@virtuozzo.com>
Cc: andrey.drobyshev@virtuozzo.com, svt-core@virtuozzo.com
Subject: Re: [PATCH hci-8.1 v2 1/2] vhost-blk: create kernel threads with the mainstream worker ioctls
Date: Tue, 27 Oct 2026 12:52:42 +0000 [thread overview]
Message-ID: <010701a17d6b8c66-fa71b243-6c44-4564-80b3-75bfebb1f4ec-000000@eu-central-1.amazonses.com> (raw)
In-Reply-To: <20261027124759.2979043-2-alexander.ivanov@virtuozzo.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] vhost-blk: num-threads=0 silently accepted as one thread, no validation
--
Commit b390c3229288ae4b409cac07cdeba78f79d9b1e7
Author: Alexander Ivanov <alexander.ivanov@virtuozzo.com>
vhost-blk: create kernel threads with the mainstream worker ioctls
This patch replaces the VHOST_SET_NWORKERS ioctl in vhost_blk_start() with
VHOST_SET_FORK_FROM_OWNER, VHOST_NEW_WORKER and VHOST_ATTACH_VRING_WORKER.
It creates num-threads - 1 extra workers and attaches them to the virtqueues
round-robin. If the kernel lacks these ioctls, it warns and runs a single
thread.
Link: https://virtuozzo.atlassian.net/browse/VSTOR-107537
> diff --git a/hw/block/vhost-blk.c b/hw/block/vhost-blk.c
> --- a/hw/block/vhost-blk.c
> +++ b/hw/block/vhost-blk.c
[ ... ]
> @@ -51,15 +97,37 @@ static int vhost_blk_start(VirtIODevice *vdev)
> return 0;
> }
>
> + nworkers = MIN(s->conf.num_threads, s->dev.nvqs);
> + if (nworkers > 1) {
[Severity: Low]
This isn't a crash, but the new code changes how num-threads=0 and values
above the queue count are handled. Is that intended?
Before this patch, vhost_blk_start() passed nworkers to VHOST_SET_NWORKERS
whenever it was not 1. A value of 0 was therefore passed to the kernel,
and as far as I can tell start failed with "unable to set number of kernel
threads". I could not check how the kernel handled 0.
Now nworkers = MIN(num_threads, nvqs) evaluates to 0 for num-threads=0, so
"nworkers > 1" is false. The device starts silently with a single kernel
thread, as if num-threads=1 had been given.
The same happens when num-threads is larger than the number of queues. The
count is clamped to nvqs and no diagnostic is printed.
The num-threads property is DEFINE_PROP_UINT16 with a default of 1, and
vhost_blk_device_realize() only validates num_queues. Nothing checks
num_threads there either.
Should realize reject num-threads=0, and should it warn or fail when
num-threads exceeds num-queues?
--
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261027124759.2979043-1-alexander.ivanov@virtuozzo.com?part=1
next prev parent reply other threads:[~2026-10-27 12:52 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-27 12:47 [PATCH hci-8.1 v2 0/2] vhost-blk: switch from VHOST_SET_NWORKERS to " Alexander Ivanov
2026-10-27 12:47 ` [PATCH hci-8.1 v2 1/2] vhost-blk: create kernel threads with " Alexander Ivanov
2026-10-27 12:52 ` no-reply [this message]
2026-10-27 13:05 ` Alexander Ivanov
2026-10-27 14:22 ` Andrey Drobyshev
2026-10-28 11:48 ` Alexander Ivanov
2026-10-27 12:47 ` [PATCH hci-8.1 v2 2/2] linux-headers: drop VHOST_SET_NWORKERS Alexander Ivanov
2026-10-27 12:50 ` no-reply
2026-10-27 14:22 ` Andrey Drobyshev
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=010701a17d6b8c66-fa71b243-6c44-4564-80b3-75bfebb1f4ec-000000@eu-central-1.amazonses.com \
--to=no-reply@sashiko.virtuozzo.com \
--cc=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.