From: Anuj Gupta <anuj20.g@samsung.com>
To: io-uring@vger.kernel.org, anuj1072538@gmail.com, axboe@kernel.dk,
asml.silence@gmail.com
Cc: joshi.k@samsung.com, Anuj Gupta <anuj20.g@samsung.com>
Subject: [PATCH liburing] test/io_uring_passthrough: add test for vectored fixed-buffers
Date: Wed, 21 May 2025 13:49:49 +0530 [thread overview]
Message-ID: <20250521081949.10497-1-anuj20.g@samsung.com> (raw)
In-Reply-To: CGME20250521083658epcas5p2c2d23dbcfac4242343365bb85301c5ea@epcas5p2.samsung.com
This patch adds support for vectored fixed buffer I/O using io_uring
nvme passthrough, enabling broader testing of this path. Since older
kernels may return -EINVAL for this combination (fixed + vectored), the
test now detects this failure at runtime via a vec_fixed_supported flag.
Subsequent iterations skip only the unsupported combinations while
continuing to test all other valid variants.
Signed-off-by: Anuj Gupta <anuj20.g@samsung.com>
---
test/io_uring_passthrough.c | 23 ++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/test/io_uring_passthrough.c b/test/io_uring_passthrough.c
index 66c97da..4a0ad73 100644
--- a/test/io_uring_passthrough.c
+++ b/test/io_uring_passthrough.c
@@ -20,6 +20,7 @@
static void *meta_mem;
static struct iovec *vecs;
static int no_pt;
+static bool vec_fixed_supported = true;
/*
* Each offset in the file has the ((test_case / 2) * FILE_SIZE)
@@ -129,11 +130,15 @@ static int __test_io(const char *file, struct io_uring *ring, int tc, int read,
use_fd = 0;
if (fixed && (i & 1))
do_fixed = 0;
- if (do_fixed) {
+ if (do_fixed && nonvec) {
io_uring_prep_read_fixed(sqe, use_fd, vecs[i].iov_base,
vecs[i].iov_len,
offset, i);
sqe->cmd_op = NVME_URING_CMD_IO;
+ } else if (do_fixed) {
+ io_uring_prep_readv_fixed(sqe, use_fd, &vecs[i],
+ 1, offset, 0, i);
+ sqe->cmd_op = NVME_URING_CMD_IO_VEC;
} else if (nonvec) {
io_uring_prep_read(sqe, use_fd, vecs[i].iov_base,
vecs[i].iov_len, offset);
@@ -152,11 +157,15 @@ static int __test_io(const char *file, struct io_uring *ring, int tc, int read,
use_fd = 0;
if (fixed && (i & 1))
do_fixed = 0;
- if (do_fixed) {
+ if (do_fixed && nonvec) {
io_uring_prep_write_fixed(sqe, use_fd, vecs[i].iov_base,
vecs[i].iov_len,
offset, i);
sqe->cmd_op = NVME_URING_CMD_IO;
+ } else if (do_fixed) {
+ io_uring_prep_writev_fixed(sqe, use_fd, &vecs[i],
+ 1, offset, 0, i);
+ sqe->cmd_op = NVME_URING_CMD_IO_VEC;
} else if (nonvec) {
io_uring_prep_write(sqe, use_fd, vecs[i].iov_base,
vecs[i].iov_len, offset);
@@ -187,7 +196,7 @@ static int __test_io(const char *file, struct io_uring *ring, int tc, int read,
cmd->cdw11 = slba >> 32;
/* cdw12 represent number of lba's for read/write */
cmd->cdw12 = nlb;
- if (do_fixed || nonvec) {
+ if (nonvec) {
cmd->addr = (__u64)(uintptr_t)vecs[i].iov_base;
cmd->data_len = vecs[i].iov_len;
} else {
@@ -218,6 +227,10 @@ static int __test_io(const char *file, struct io_uring *ring, int tc, int read,
goto err;
}
if (cqe->res != 0) {
+ if (cqe->res == -EINVAL && fixed && !nonvec) {
+ vec_fixed_supported = false;
+ goto cleanup_and_skip;
+ }
if (!no_pt) {
no_pt = 1;
goto skip;
@@ -236,6 +249,7 @@ static int __test_io(const char *file, struct io_uring *ring, int tc, int read,
}
}
+cleanup_and_skip:
if (fixed) {
ret = io_uring_unregister_buffers(ring);
if (ret) {
@@ -275,6 +289,9 @@ static int test_io(const char *file, int tc, int read, int sqthread,
if (hybrid)
ring_flags |= IORING_SETUP_IOPOLL | IORING_SETUP_HYBRID_IOPOLL;
+ if (fixed && (!vec_fixed_supported && !nonvec))
+ return 0;
+
ret = t_create_ring(64, &ring, ring_flags);
if (ret == T_SETUP_SKIP)
return 0;
--
2.25.1
next parent reply other threads:[~2025-05-21 8:37 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20250521083658epcas5p2c2d23dbcfac4242343365bb85301c5ea@epcas5p2.samsung.com>
2025-05-21 8:19 ` Anuj Gupta [this message]
2025-05-21 9:42 ` [PATCH liburing] test/io_uring_passthrough: add test for vectored fixed-buffers Pavel Begunkov
2025-05-21 10:35 ` Anuj gupta
2025-05-21 13:08 ` Jens Axboe
2025-05-21 14:20 ` Anuj gupta
2025-05-21 14:24 ` Jens Axboe
2025-05-21 14:05 ` Pavel Begunkov
2025-05-21 14:14 ` Jens Axboe
2025-05-21 14:46 ` Pavel Begunkov
2025-05-21 14:51 ` Jens Axboe
2025-05-21 13:08 ` Jens Axboe
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=20250521081949.10497-1-anuj20.g@samsung.com \
--to=anuj20.g@samsung.com \
--cc=anuj1072538@gmail.com \
--cc=asml.silence@gmail.com \
--cc=axboe@kernel.dk \
--cc=io-uring@vger.kernel.org \
--cc=joshi.k@samsung.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