public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH liburing 1/1] tests/rw: test iowq offload
@ 2025-02-26 20:37 Pavel Begunkov
  2025-02-26 23:40 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Pavel Begunkov @ 2025-02-26 20:37 UTC (permalink / raw)
  To: io-uring; +Cc: asml.silence, axboe

We miss fixed read/write + IOSQE_ASYNC tests, so add it

Signed-off-by: Pavel Begunkov <[email protected]>
---
 test/read-write.c | 35 +++++++++++++++++++++--------------
 1 file changed, 21 insertions(+), 14 deletions(-)

diff --git a/test/read-write.c b/test/read-write.c
index 23f1d582..ba98c744 100644
--- a/test/read-write.c
+++ b/test/read-write.c
@@ -46,7 +46,7 @@ static int create_nonaligned_buffers(void)
 
 static int _test_io(const char *file, struct io_uring *ring, int write,
 		    int buffered, int sqthread, int fixed, int nonvec,
-		    int buf_select, int seq, int exp_len)
+		    int buf_select, int seq, int exp_len, bool worker_offload)
 {
 	struct io_uring_sqe *sqe;
 	struct io_uring_cqe *cqe;
@@ -144,6 +144,10 @@ static int _test_io(const char *file, struct io_uring *ring, int write,
 		sqe->user_data = i;
 		if (sqthread)
 			sqe->flags |= IOSQE_FIXED_FILE;
+
+		if (worker_offload)
+			sqe->flags |= IOSQE_ASYNC;
+
 		if (buf_select) {
 			if (nonvec)
 				sqe->addr = 0;
@@ -227,12 +231,12 @@ err:
 
 static int __test_io(const char *file, struct io_uring *ring, int write,
 		     int buffered, int sqthread, int fixed, int nonvec,
-		     int buf_select, int seq, int exp_len)
+		     int buf_select, int seq, int exp_len, bool worker_offload)
 {
 	int ret;
 
 	ret = _test_io(file, ring, write, buffered, sqthread, fixed, nonvec,
-		       buf_select, seq, exp_len);
+		       buf_select, seq, exp_len, worker_offload);
 	if (ret)
 		return ret;
 
@@ -263,7 +267,7 @@ static int __test_io(const char *file, struct io_uring *ring, int write,
 			return ret;
 		}
 		ret = _test_io(file, &ring2, write, buffered, sqthread, 2,
-			       nonvec, buf_select, seq, exp_len);
+			       nonvec, buf_select, seq, exp_len, worker_offload);
 		if (ret)
 			return ret;
 
@@ -284,7 +288,7 @@ static int __test_io(const char *file, struct io_uring *ring, int write,
 }
 
 static int test_io(const char *file, int write, int buffered, int sqthread,
-		   int fixed, int nonvec, int exp_len)
+		   int fixed, int nonvec, int exp_len, bool worker_offload)
 {
 	struct io_uring ring;
 	int ret, ring_flags = 0;
@@ -301,7 +305,7 @@ static int test_io(const char *file, int write, int buffered, int sqthread,
 	}
 
 	ret = __test_io(file, &ring, write, buffered, sqthread, fixed, nonvec,
-			0, 0, exp_len);
+			0, 0, exp_len, worker_offload);
 	io_uring_queue_exit(&ring);
 	return ret;
 }
@@ -481,7 +485,8 @@ static int test_buf_select_short(const char *filename, int nonvec)
 		io_uring_cqe_seen(&ring, cqe);
 	}
 
-	ret = __test_io(filename, &ring, 0, 0, 0, 0, nonvec, 1, 1, exp_len);
+	ret = __test_io(filename, &ring, 0, 0, 0, 0, nonvec, 1, 1, exp_len,
+			false);
 
 	io_uring_queue_exit(&ring);
 	return ret;
@@ -620,7 +625,7 @@ static int test_buf_select(const char *filename, int nonvec)
 	for (i = 0; i < BUFFERS; i++)
 		memset(vecs[i].iov_base, i, vecs[i].iov_len);
 
-	ret = __test_io(filename, &ring, 1, 0, 0, 0, 0, 0, 1, BS);
+	ret = __test_io(filename, &ring, 1, 0, 0, 0, 0, 0, 1, BS, false);
 	if (ret) {
 		fprintf(stderr, "failed writing data\n");
 		return 1;
@@ -633,7 +638,7 @@ static int test_buf_select(const char *filename, int nonvec)
 	if (ret)
 		return ret;
 
-	ret = __test_io(filename, &ring, 0, 0, 0, 0, nonvec, 1, 1, BS);
+	ret = __test_io(filename, &ring, 0, 0, 0, 0, nonvec, 1, 1, BS, false);
 	io_uring_queue_exit(&ring);
 	return ret;
 }
@@ -933,17 +938,18 @@ int main(int argc, char *argv[])
 	vecs = t_create_buffers(BUFFERS, BS);
 
 	/* if we don't have nonvec read, skip testing that */
-	nr = has_nonvec_read() ? 32 : 16;
+	nr = has_nonvec_read() ? 64 : 32;
 
 	for (i = 0; i < nr; i++) {
 		int write = (i & 1) != 0;
 		int buffered = (i & 2) != 0;
 		int sqthread = (i & 4) != 0;
 		int fixed = (i & 8) != 0;
-		int nonvec = (i & 16) != 0;
+		int offload = (i & 16) != 0;
+		int nonvec = (i & 32) != 0;
 
 		ret = test_io(fname, write, buffered, sqthread, fixed, nonvec,
-			      BS);
+			      BS, offload);
 		if (ret) {
 			fprintf(stderr, "test_io failed %d/%d/%d/%d/%d\n",
 				write, buffered, sqthread, fixed, nonvec);
@@ -1047,14 +1053,15 @@ int main(int argc, char *argv[])
 		int buffered = (i & 2) != 0;
 		int sqthread = (i & 4) != 0;
 		int fixed = (i & 8) != 0;
-		int nonvec = (i & 16) != 0;
+		int offload = (i & 16) != 0;
+		int nonvec = (i & 32) != 0;
 
 		/* direct IO requires alignment, skip it */
 		if (!buffered || !fixed || nonvec)
 			continue;
 
 		ret = test_io(fname, write, buffered, sqthread, fixed, nonvec,
-			      -1);
+			      -1, offload);
 		if (ret) {
 			fprintf(stderr, "test_io failed %d/%d/%d/%d/%d\n",
 				write, buffered, sqthread, fixed, nonvec);
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH liburing 1/1] tests/rw: test iowq offload
  2025-02-26 20:37 [PATCH liburing 1/1] tests/rw: test iowq offload Pavel Begunkov
@ 2025-02-26 23:40 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2025-02-26 23:40 UTC (permalink / raw)
  To: io-uring, Pavel Begunkov


On Wed, 26 Feb 2025 20:37:09 +0000, Pavel Begunkov wrote:
> We miss fixed read/write + IOSQE_ASYNC tests, so add it
> 
> 

Applied, thanks!

[1/1] tests/rw: test iowq offload
      commit: e1003e496e66f9b0ae06674869795edf772d5500

Best regards,
-- 
Jens Axboe




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-02-26 23:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-26 20:37 [PATCH liburing 1/1] tests/rw: test iowq offload Pavel Begunkov
2025-02-26 23:40 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox