OpenVZ / Virtuozzo kernel development (devel@openvz.org)
 help / color / mirror / Atom feed
From: Alexander Ivanov <alexander.ivanov@virtuozzo.com>
To: andrey.zhadchenko@virtuozzo.com
Cc: devel@openvz.org
Subject: [Devel] [PATCH hci-8.1 v3 2/2] drivers/vhost/blk: add support for worker ioctls
Date: Sun, 15 Nov 2026 14:39:57 +0100	[thread overview]
Message-ID: <20261115133957.2803273-3-alexander.ivanov@virtuozzo.com> (raw)
In-Reply-To: <20261115133957.2803273-1-alexander.ivanov@virtuozzo.com>

Let userspace create vhost workers and bind them to vhost-blk
virtqueues with the mainstream ioctls from c1ecd8e95007 ("vhost: allow
userspace to create workers"), the same way d74b55e65502 ("vhost_scsi:
add support for worker ioctls") does it for vhost-scsi.

VHOST_NEW_WORKER needs the device in vhost_task mode, so userspace has
to issue VHOST_SET_FORK_FROM_OWNER with VHOST_FORK_OWNER_TASK before
VHOST_SET_OWNER: our fork_from_owner_default is kthread.

https://virtuozzo.atlassian.net/browse/VSTOR-107537
Feature: vhost-blk: in-kernel accelerator for virtio-blk guests

Suggested-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>
Signed-off-by: Alexander Ivanov <alexander.ivanov@virtuozzo.com>
Reviewed-by: Andrey Zhadchenko <andrey.zhadchenko@virtuozzo.com>
---
 drivers/vhost/blk.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/vhost/blk.c b/drivers/vhost/blk.c
index b95358cdf3bc..a4bd69b13b3b 100644
--- a/drivers/vhost/blk.c
+++ b/drivers/vhost/blk.c
@@ -956,6 +956,14 @@ static long vhost_blk_ioctl(struct file *f, unsigned int ioctl,
 		return vhost_blk_set_features(blk, features);
 	case VHOST_RESET_OWNER:
 		return vhost_blk_reset_owner(blk);
+	case VHOST_NEW_WORKER:
+	case VHOST_FREE_WORKER:
+	case VHOST_ATTACH_VRING_WORKER:
+	case VHOST_GET_VRING_WORKER:
+		mutex_lock(&blk->dev.mutex);
+		ret = vhost_worker_ioctl(&blk->dev, ioctl, argp);
+		mutex_unlock(&blk->dev.mutex);
+		return ret;
 	default:
 		mutex_lock(&blk->dev.mutex);
 		ret = vhost_dev_ioctl(&blk->dev, ioctl, argp);
-- 
2.53.0

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

  parent reply	other threads:[~2026-11-15 13:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-15 13:39 [Devel] [PATCH hci-8.1 v3 0/2] " Alexander Ivanov
2026-11-15 13:39 ` [Devel] [PATCH hci-8.1 v3 1/2] drivers/vhost: fix a use-after-free of VHOST_SET_NWORKERS workers Alexander Ivanov
2026-11-15 13:50   ` no-reply
2026-11-16  8:42     ` Alexander Ivanov
2026-11-15 13:39 ` Alexander Ivanov [this message]
2026-11-15 13:45   ` [Devel] [PATCH hci-8.1 v3 2/2] drivers/vhost/blk: add support for worker ioctls no-reply

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=20261115133957.2803273-3-alexander.ivanov@virtuozzo.com \
    --to=alexander.ivanov@virtuozzo.com \
    --cc=andrey.zhadchenko@virtuozzo.com \
    --cc=devel@openvz.org \
    /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