Virtuozzo QEMU development (svt-core@virtuozzo.com)
 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 0/5] vhost-blk: switch from VHOST_SET_NWORKERS to the mainstream worker ioctls
Date: Sat, 31 Oct 2026 16:35:23 +0100	[thread overview]
Message-ID: <20261031153528.3857823-1-alexander.ivanov@virtuozzo.com> (raw)

The kernel drops our VHOST_SET_NWORKERS ioctl in favour of the
mainstream VHOST_NEW_WORKER/VHOST_ATTACH_VRING_WORKER, which vhost-blk
now supports.

Patch 1 wraps VHOST_SET_FORK_FROM_OWNER in a vhost backend op. Patch 2
refuses num-queues above VHOST_BLK_MAX_QUEUES at realize. Patch 3 is a
cleanup taking &s->dev into a local pointer. Patch 4 makes vhost-blk
create its num-threads workers with the mainstream ioctls, keeping the
same worker layout, and fail to start if the kernel cannot provide
them. Patch 5 drops VHOST_SET_NWORKERS from linux-headers.

v5:
- patch 4: fail to start vhost-blk on any worker ioctl failure instead
  of warning and running on fewer threads than requested
- patch 4: switch to vhost_task mode for num-threads=1 as well, so the
  default thread is of the same kind whatever the number of workers

v4:
- new patch 3: split the &s->dev -> hdev conversion out of patch 4
- patch 2: quote the error realize fails with, add Fixes:
- patch 4: do not key on the errno; on any worker ioctl failure warn
  and continue with the threads created so far instead of failing
  to start vhost-blk
- patch 4: drop the comments, explain in the commit message instead

v3:
- new patch 1: call VHOST_SET_FORK_FROM_OWNER, VHOST_NEW_WORKER and
  VHOST_ATTACH_VRING_WORKER through vhost_ops instead of raw ioctls
- new patch 2: refuse num-queues above VHOST_BLK_MAX_QUEUES at realize
  instead of clamping num-threads in patch 3
- patch 3: create each worker right before attaching its first vq

v2:
- patch 1: clamp num-threads to VHOST_BLK_MAX_QUEUES
- patch 1: note in the commit message that our kernel, unlike
  mainline, defaults to kthreads

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

Alexander Ivanov (5):
  vhost-backend: add vhost_set_fork_from_owner op
  vhost-blk: reject num-queues above VHOST_BLK_MAX_QUEUES
  vhost-blk: use a local vhost_dev pointer in start and stop
  vhost-blk: create kernel threads with the mainstream worker ioctls
  linux-headers: drop VHOST_SET_NWORKERS

 hw/block/vhost-blk.c              | 95 ++++++++++++++++++++++++-------
 hw/virtio/vhost-backend.c         |  7 +++
 include/hw/virtio/vhost-backend.h |  3 +
 linux-headers/linux/vhost.h       |  9 ---
 4 files changed, 86 insertions(+), 28 deletions(-)

-- 
2.53.0


             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 Alexander Ivanov [this message]
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 ` [PATCH hci-8.1 v5 2/5] vhost-blk: reject num-queues above VHOST_BLK_MAX_QUEUES Alexander Ivanov
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-1-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox