Skip to contentSkip to conversation

io_uring: Add test for READV and WRITEV operations

PATCH In review Sachin Sant 3 participants 6 messages Apr 16 – May 6

lore
Share & tools
lore
#0 lore raw

PATCH v6 1/2 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 io_uring_init_buffer_pattern() into unified init_iovec_buffers() function that supports both rotating and simple character patterns

---
V5 changes:
- Add clear_iovec_buffers() at the top of run()
- Link to v4 https://lore.kernel.org/ltp/[email protected]/T/

V4 changes:
- Updated commit message to remove references to non-existent function
- Removed extra blank line before test_writev_readv()
- Link to v3 https://lore.kernel.org/ltp/[email protected]/T/

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 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     | 223 ++++++++++++++++++
 3 files changed, 225 insertions(+)
 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 +223 -0

223 lines not on this page · raw message

Signature · 5 lines
2.39.1


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

PATCH 2/2 io_uring: remove unused io_uring_init_buffer_pattern()

The io_uring04 test merged the functionality of io_uring_init_buffer_pattern() into the unified function init_iovec_buffers(). Since io_uring_init_buffer_pattern() was not used by any existing test, remove it.

---
 .../kernel/syscalls/io_uring/io_uring_common.h      | 13 -------------
 1 file changed, 13 deletions(-)
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
Reviewed-by LTP AI Reviewer on v6 1/2
#2 lore raw
In reply to Sachin Sant

Hi Sachin,

Quoted 1 line · Sachin Sant

io_uring: Add test for READV and WRITEV operations

---
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/24513033939

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.

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#3 lore raw
In reply to Sachin Sant

Hi Sachin,

is it possible to separate the test into multiple ones?

Having multiple tests scenarios inside a single binary means that (often) if one scenario fails, the others can't be tested.

In the kernel maintenance it's important to keep distinction between tested features, so it's easier to debug a bug in the system by cross-checking different scenarios.

We can have a helper header sharing the common operations and to define multiple test files. It's a common pattern we use in LTP.

Regards,
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
[email protected]

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#4 lore raw
Quoted 3 lines · Andrea Cervesato

Hi Sachin,

is it possible to separate the test into multiple ones?

Sure, can be done. Do you have any specific inputs on how to split the test.

Split it into three tests, one for each of the following:

test_writev_readv();
test_partial_vectors();
test_varying_sizes();

Quoted 2 lines

Having multiple tests scenarios inside a single binary means that (often) if one scenario fails, the others can't be tested.

Got it. Just curious, did you run into any test failure.

Thanks for the inputs.

Signature · 7 lines
Thanks
- Sachin



-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#5 lore raw
Quoted 13 lines · Andrea Cervesato
Quoted 3 lines

Hi Sachin,

is it possible to separate the test into multiple ones?

Sure, can be done. Do you have any specific inputs on how to split the test.

Split it into three tests, one for each of the following:

test_writev_readv();
test_partial_vectors();
test_varying_sizes();

They can be split yes.

Quoted 4 lines
Quoted 3 lines

Having multiple tests scenarios inside a single binary means that (often) if one scenario fails, the others can't be tested.

Got it. Just curious, did you run into any test failure.

No, mine was a general rule just in case we face it.

Regards,
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
[email protected]

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