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.2 v4 1/5] linux-headers: add the vhost-blk held request ioctls #VSTOR-152175
Date: Tue, 1 Dec 2026 10:18:14 +0100 [thread overview]
Message-ID: <20261201091818.1894308-2-alexander.ivanov@virtuozzo.com> (raw)
In-Reply-To: <20261201091818.1894308-1-alexander.ivanov@virtuozzo.com>
vhost-blk in the Virtuozzo kernel can hold a request failed with ENOSPC
instead of completing it to the guest. Add its UAPI:
VHOST_BLK_SET_ERROR_POLICY, VHOST_BLK_SET_ERROR_FD,
VHOST_BLK_GET_HELD_REQS and VHOST_BLK_RESUBMIT.
https://virtuozzo.atlassian.net/browse/VSTOR-152175
Signed-off-by: Alexander Ivanov <alexander.ivanov@virtuozzo.com>
---
include/standard-headers/linux/vhost_types.h | 18 ++++++++++++
| 31 ++++++++++++++++++++
2 files changed, 49 insertions(+)
diff --git a/include/standard-headers/linux/vhost_types.h b/include/standard-headers/linux/vhost_types.h
index 79b53a931a8..b11a2bc07f0 100644
--- a/include/standard-headers/linux/vhost_types.h
+++ b/include/standard-headers/linux/vhost_types.h
@@ -198,4 +198,22 @@ struct vhost_vdpa_iova_range {
/* IOTLB don't flush memory mapping across device reset */
#define VHOST_BACKEND_F_IOTLB_PERSIST 0x8
+/* VHOST_BLK_SET_ERROR_POLICY flags */
+#define VHOST_BLK_HOLD_ENOSPC_WRITE (1ULL << 0)
+#define VHOST_BLK_HOLD_ENOSPC_READ (1ULL << 1)
+
+struct vhost_blk_held_req {
+ uint16_t vq;
+ uint16_t head;
+ int32_t error; /* positive errno */
+ uint32_t type; /* VIRTIO_BLK_T_* */
+ uint32_t reserved;
+};
+
+struct vhost_blk_held_reqs {
+ uint32_t nr;
+ uint32_t reserved;
+ struct vhost_blk_held_req reqs[];
+};
+
#endif
--git a/linux-headers/linux/vhost.h b/linux-headers/linux/vhost.h
index b6eb628d973..4b585a1ceff 100644
--- a/linux-headers/linux/vhost.h
+++ b/linux-headers/linux/vhost.h
@@ -277,4 +277,35 @@
#define VHOST_BLK_SET_BACKEND _IOW(VHOST_VIRTIO, 0xFF, \
struct vhost_vring_file)
+/*
+ * Hold a request failing with an error selected by VHOST_BLK_HOLD_* flags
+ * instead of completing it. The guest gets its head back only through
+ * VHOST_BLK_RESUBMIT.
+ */
+#define VHOST_BLK_SET_ERROR_POLICY _IOW(VHOST_VIRTIO, 0xFD, __u64)
+
+/* An eventfd signalled on every held request, -1 to unset */
+#define VHOST_BLK_SET_ERROR_FD _IOW(VHOST_VIRTIO, 0xFC, int)
+
+/*
+ * nr is the capacity of reqs on input and the number of held requests on
+ * output; -E2BIG if they do not fit. reserved must be 0. The list is final
+ * once the backend is unset, and is emptied by VHOST_RESET_OWNER and by a
+ * successful VHOST_BLK_SET_BACKEND with fd >= 0. A failing one may empty it
+ * too.
+ */
+#define VHOST_BLK_GET_HELD_REQS _IOWR(VHOST_VIRTIO, 0xFB, \
+ struct vhost_blk_held_reqs)
+
+/*
+ * Resubmit requests by vq and head, as if they were just taken from the avail
+ * ring. Only heads read with VHOST_BLK_GET_HELD_REQS after the last stop may be
+ * passed: the kernel does not track them, and a head passed again after its
+ * request completed, or still owned by the guest, is completed twice. A head
+ * still in flight fails with -EBUSY. error and type are ignored, reserved
+ * must be 0. On error, nr is set to the number of requests resubmitted.
+ */
+#define VHOST_BLK_RESUBMIT _IOWR(VHOST_VIRTIO, 0xFA, \
+ struct vhost_blk_held_reqs)
+
#endif
--
2.53.0
next prev parent reply other threads:[~2026-12-01 9:18 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 9:18 [PATCH hci-8.2 v4 0/5] vhost-blk: support the werror/rerror policies Alexander Ivanov
2026-12-01 9:18 ` Alexander Ivanov [this message]
2026-12-01 9:21 ` [PATCH hci-8.2 v4 1/5] linux-headers: add the vhost-blk held request ioctls #VSTOR-152175 no-reply
2026-12-01 9:18 ` [PATCH hci-8.2 v4 2/5] vhost-blk: add the werror and rerror properties #VSTOR-152175 Alexander Ivanov
2026-12-01 9:18 ` [PATCH hci-8.2 v4 3/5] vhost-blk: stop vhost on every VM stop #VSTOR-152175 Alexander Ivanov
2026-12-01 9:24 ` no-reply
2026-12-01 9:18 ` [PATCH hci-8.2 v4 4/5] vhost-blk: pause the VM on a request failed with ENOSPC #VSTOR-152175 Alexander Ivanov
2026-12-01 9:25 ` no-reply
2026-12-01 9:41 ` Alexander Ivanov
2026-12-01 9:18 ` [PATCH hci-8.2 v4 5/5] vhost-blk: migrate the held requests #VSTOR-152175 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=20261201091818.1894308-2-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.