From: Keith Busch <kbusch@meta.com>
To: <io-uring@vger.kernel.org>, <axboe@kernel.dk>, <csander@purestorage.com>
Cc: Keith Busch <kbusch@kernel.org>
Subject: [RFC PATCHv2 1/3] Add support IORING_SETUP_SQE_MIXED
Date: Thu, 4 Sep 2025 12:27:13 -0700 [thread overview]
Message-ID: <20250904192716.3064736-2-kbusch@meta.com> (raw)
In-Reply-To: <20250904192716.3064736-1-kbusch@meta.com>
From: Keith Busch <kbusch@kernel.org>
This adds core support for mixed sized SQEs in the same SQ ring. Before
this, SQEs were either 64b in size (the normal size), or 128b if
IORING_SETUP_SQE128 was set in the ring initialization. With the mixed
support, an SQE may be either 64b or 128b on the same SQ ring. If the
SQE is 128b in size, then IOSQE_SQE_128B will be set in the sqe flags.
The client may post a NOP SQE with IOSQE_CQE_SKIP_SUCCESS set that the
kernel should simply ignore as it's just a pad filler that is posted
when required.
Signed-off-by: Keith Busch <kbusch@kernel.org>
---
src/include/liburing.h | 31 +++++++++++++++++++++++++++++++
src/include/liburing/io_uring.h | 9 +++++++++
2 files changed, 40 insertions(+)
diff --git a/src/include/liburing.h b/src/include/liburing.h
index 7ea876e1..97c70fa7 100644
--- a/src/include/liburing.h
+++ b/src/include/liburing.h
@@ -1853,6 +1853,37 @@ IOURINGINLINE struct io_uring_sqe *_io_uring_get_sqe(struct io_uring *ring)
return sqe;
}
+IOURINGINLINE struct io_uring_sqe *io_uring_get_sqe128_mixed(struct io_uring *ring)
+ LIBURING_NOEXCEPT
+{
+ struct io_uring_sq *sq = &ring->sq;
+ unsigned head = io_uring_load_sq_head(ring), tail = sq->sqe_tail;
+ struct io_uring_sqe *sqe;
+
+ if (!(ring->flags & IORING_SETUP_SQE_MIXED))
+ return NULL;
+
+ if ((tail & sq->ring_mask) + 1 == sq->ring_entries) {
+ sqe = _io_uring_get_sqe(ring);
+ if (!sqe)
+ return NULL;
+
+ io_uring_prep_nop(sqe);
+ sqe->flags |= IOSQE_CQE_SKIP_SUCCESS;
+ tail = sq->sqe_tail;
+ }
+
+ if ((tail + 1) - head >= sq->ring_entries)
+ return NULL;
+
+ sqe = &sq->sqes[tail & sq->ring_mask];
+ sq->sqe_tail = tail + 2;
+ io_uring_initialize_sqe(sqe);
+ sqe->flags |= IOSQE_SQE_128B;
+
+ return sqe;
+}
+
/*
* Return the appropriate mask for a buffer ring of size 'ring_entries'
*/
diff --git a/src/include/liburing/io_uring.h b/src/include/liburing/io_uring.h
index 643514e5..fd02fa52 100644
--- a/src/include/liburing/io_uring.h
+++ b/src/include/liburing/io_uring.h
@@ -126,6 +126,7 @@ enum io_uring_sqe_flags_bit {
IOSQE_ASYNC_BIT,
IOSQE_BUFFER_SELECT_BIT,
IOSQE_CQE_SKIP_SUCCESS_BIT,
+ IOSQE_SQE_128B_BIT,
};
/*
@@ -145,6 +146,8 @@ enum io_uring_sqe_flags_bit {
#define IOSQE_BUFFER_SELECT (1U << IOSQE_BUFFER_SELECT_BIT)
/* don't post CQE if request succeeded */
#define IOSQE_CQE_SKIP_SUCCESS (1U << IOSQE_CQE_SKIP_SUCCESS_BIT)
+/* this is a 128b/big-sqe posting */
+#define IOSQE_SQE_128B (1U << IOSQE_SQE_128B_BIT)
/*
* io_uring_setup() flags
@@ -211,6 +214,12 @@ enum io_uring_sqe_flags_bit {
*/
#define IORING_SETUP_CQE_MIXED (1U << 18)
+/*
+ * Allow both 64b and 128b SQEs. If a 128b SQE is posted, it will have
+ * IOSQE_SQE_128B set in sqe->flags.
+ */
+#define IORING_SETUP_SQE_MIXED (1U << 19)
+
enum io_uring_op {
IORING_OP_NOP,
IORING_OP_READV,
--
2.47.3
next prev parent reply other threads:[~2025-09-04 19:27 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-04 19:27 [RFC PATCHv2 0/1] Keith Busch
2025-09-04 19:27 ` Keith Busch [this message]
2025-09-11 16:27 ` [RFC PATCHv2 1/3] Add support IORING_SETUP_SQE_MIXED Caleb Sander Mateos
2025-09-04 19:27 ` [RFC PATCHv2 1/1] io_uring: add support for IORING_SETUP_SQE_MIXED Keith Busch
2025-09-10 17:44 ` Caleb Sander Mateos
2025-09-11 0:28 ` Jens Axboe
2025-09-11 2:11 ` Ming Lei
2025-09-11 2:19 ` Ming Lei
2025-09-11 13:02 ` Keith Busch
2025-09-11 13:07 ` Ming Lei
2025-09-17 14:44 ` Jens Axboe
2025-09-18 21:22 ` Keith Busch
2025-09-18 23:35 ` Jens Axboe
2025-09-11 2:06 ` Keith Busch
2025-09-04 19:27 ` [RFC PATCHv2 2/3] Add nop testing " Keith Busch
2025-09-04 19:27 ` [RFC PATCHv2 3/3] Add mixed sqe test for uring commands Keith Busch
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=20250904192716.3064736-2-kbusch@meta.com \
--to=kbusch@meta.com \
--cc=axboe@kernel.dk \
--cc=csander@purestorage.com \
--cc=io-uring@vger.kernel.org \
--cc=kbusch@kernel.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