Skip to contentSkip to conversation

io_uring: Add test for READV and WRITEV operations

PATCH Superseded Sachin Sant 2 participants 2 messages Apr 16

v3 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 io_uring: Add test for READV and WRITEV operations

Add a test to validate vectored read and write operations using io_uring.

1. IORING_OP_WRITEV - Writing data using multiple buffers (scatter)
2. IORING_OP_READV - Reading data into multiple buffers (gather)
3. Data integrity verification across multiple iovecs
4. Edge cases with different iovec configurations including zero buffer length

Additionally merge prepare_write_buffers() and io_uring_init_buffer_pattern() into unified init_iovec_buffers() function that supports both rotating and simple character patterns

---
V3 changes (2/3 io_uring04 only):
- 1/3 and 3/3 from the patch series already merged.
- Merged prepare_read_buffers() and clear_iovec_buffers() into
single clear_iovec_buffers() function
- Merged prepare_write_buffers() and io_uring_init_buffer_pattern() into
unified init_iovec_buffers() function that supports both rotating and
simple character patterns
- Removed io_uring_init_buffer_pattern() from io_uring_common.h as it's
only used in io_uring04.c
- Link to V2: https://lore.kernel.org/ltp/[email protected]/T/

V2 changes:
- Use guarded buffer(including iovec) allocation
- Move setup/cleanup code from run to appropriate path
- Add a function to map the OP to the enum name
- Define and use generic cleanup functions
- Add a buffer size 0 in the middle of the iovec
- Simplify setup_io_uring_test to use common code.
- Link to V1: https://lore.kernel.org/ltp/[email protected]/T/#t

Changes after RFC patch series:
- Addressed review comments
- Refactored io_uring01 test to use common code
- Removed git tags
- Link to RFC: https://lore.kernel.org/ltp/[email protected]/T/#t

---
 runtest/syscalls                              |   1 +
 testcases/kernel/syscalls/io_uring/.gitignore |   1 +
 .../kernel/syscalls/io_uring/io_uring04.c     | 222 ++++++++++++++++++
 .../syscalls/io_uring/io_uring_common.h       |  13 -
 4 files changed, 224 insertions(+), 13 deletions(-)
 create mode 100644 testcases/kernel/syscalls/io_uring/io_uring04.c
runtest/syscalls +1 -0
index 5025b259f..aa7a91d97 100644
@@ -1901,6 +1901,7 @@ membarrier01 membarrier01
 io_uring01 io_uring01
 io_uring02 io_uring02
 io_uring03 io_uring03
+io_uring04 io_uring04
 
 # Tests below may cause kernel memory leak
 perf_event_open03 perf_event_open03
testcases/kernel/syscalls/io_uring/.gitignore +1 -0
index 9382ae413..36cd24662 100644
@@ -1,3 +1,4 @@
 /io_uring01
 /io_uring02
 /io_uring03
+/io_uring04
testcases/kernel/syscalls/io_uring/io_uring04.c new file +222 -0

222 lines not on this page · raw message

testcases/kernel/syscalls/io_uring/io_uring_common.h +0 -13
index aa31339fb..7816b55dc 100644
@@ -230,19 +230,6 @@ static inline void io_uring_wait_cqe(struct io_uring_submit *s,
 	*cring->head = head + 1;
 }
 
-/*
- * Initialize buffer with a repeating character pattern
- * Useful for creating test data with predictable patterns
- */
-static inline void io_uring_init_buffer_pattern(char *buf, size_t size,
-						char pattern)
-{
-	size_t i;
-
-	for (i = 0; i < size; i++)
-		buf[i] = pattern;
-}
-
 /*
  * Submit and wait for a non-vectored I/O operation
  * Combines io_uring_submit_sqe() and io_uring_wait_cqe() with result reporting
Signature · 5 lines
2.39.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#1 lore raw

Hi Sachin,

Quoted 5 lines · Sachin Sant

io_uring: Add test for READV and WRITEV operations

Additionally merge prepare_write_buffers() and io_uring_init_buffer_pattern() into unified init_iovec_buffers() function that supports both rotating and simple character patterns

prepare_write_buffers() does not exist in the codebase — grep finds no match anywhere. The diff only removes io_uring_init_buffer_pattern() from io_uring_common.h. Please drop the reference to prepare_write_buffers() from the commit message.

[...]

testcases/kernel/syscalls/io_uring/io_uring04.c line 105

Quoted 4 lines
testcases/kernel/syscalls/io_uring/io_uring04.c new file +4 -0
+}
+
+
+static void test_writev_readv(void)

Double blank line between functions; use one.

---
Note:

Our agent completed the review of the patch. The full review can be found at: https://github.com/linux-test-project/ltp-agent/actions/runs/24493870842

The agent can sometimes produce false positives although often its findings are genuine. If you find issues with the review, please comment this email or ignore the suggestions.

Regards,
LTP AI Reviewer

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp