public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH liburing 0/2] revert buf-ring test
@ 2022-06-15  7:40 Dylan Yudaken
  2022-06-15  7:40 ` [PATCH liburing 1/2] Revert "test/buf-ring: ensure cqe isn't used uninitialized" Dylan Yudaken
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Dylan Yudaken @ 2022-06-15  7:40 UTC (permalink / raw)
  To: io-uring; +Cc: axboe, asml.silence, Dylan Yudaken

Revert the two patches for the buf-ring test as the NOP support is being
removed from 5.19

Dylan Yudaken (2):
  Revert "test/buf-ring: ensure cqe isn't used uninitialized"
  Revert "buf-ring: add tests that cycle through the provided buffer
    ring"

 test/buf-ring.c | 130 ------------------------------------------------
 1 file changed, 130 deletions(-)


base-commit: d6f9e02f9c6a777010824341f14c994b11dfc8b1
-- 
2.30.2


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

* [PATCH liburing 1/2] Revert "test/buf-ring: ensure cqe isn't used uninitialized"
  2022-06-15  7:40 [PATCH liburing 0/2] revert buf-ring test Dylan Yudaken
@ 2022-06-15  7:40 ` Dylan Yudaken
  2022-06-15  7:40 ` [PATCH liburing 2/2] Revert "buf-ring: add tests that cycle through the provided buffer ring" Dylan Yudaken
  2022-06-15 11:16 ` [PATCH liburing 0/2] revert buf-ring test Dylan Yudaken
  2 siblings, 0 replies; 4+ messages in thread
From: Dylan Yudaken @ 2022-06-15  7:40 UTC (permalink / raw)
  To: io-uring; +Cc: axboe, asml.silence, Dylan Yudaken

This reverts commit d6f9e02f9c6a777010824341f14c994b11dfc8b1.

"io_uring: add buffer selection support to IORING_OP_NOP" has been
reverted from 5.19, which this relies on

Signed-off-by: Dylan Yudaken <[email protected]>
---
 test/buf-ring.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/test/buf-ring.c b/test/buf-ring.c
index af1cac8..2fcc360 100644
--- a/test/buf-ring.c
+++ b/test/buf-ring.c
@@ -234,19 +234,22 @@ static int test_one_nop(int bgid, struct io_uring *ring)
 		ret = -1;
 		goto out;
 	}
-	ret = cqe->res;
-	io_uring_cqe_seen(ring, cqe);
 
-	if (ret == -ENOBUFS)
-		return ret;
+	if (cqe->res == -ENOBUFS) {
+		ret = cqe->res;
+		goto out;
+	}
 
-	if (ret != 0) {
+	if (cqe->res != 0) {
 		fprintf(stderr, "nop result %d\n", ret);
-		return -1;
+		ret = -1;
+		goto out;
 	}
 
 	ret = cqe->flags >> 16;
+
 out:
+	io_uring_cqe_seen(ring, cqe);
 	return ret;
 }
 
-- 
2.30.2


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

* [PATCH liburing 2/2] Revert "buf-ring: add tests that cycle through the provided buffer ring"
  2022-06-15  7:40 [PATCH liburing 0/2] revert buf-ring test Dylan Yudaken
  2022-06-15  7:40 ` [PATCH liburing 1/2] Revert "test/buf-ring: ensure cqe isn't used uninitialized" Dylan Yudaken
@ 2022-06-15  7:40 ` Dylan Yudaken
  2022-06-15 11:16 ` [PATCH liburing 0/2] revert buf-ring test Dylan Yudaken
  2 siblings, 0 replies; 4+ messages in thread
From: Dylan Yudaken @ 2022-06-15  7:40 UTC (permalink / raw)
  To: io-uring; +Cc: axboe, asml.silence, Dylan Yudaken

This reverts commit 01e0120220e489f147fd4e91d1bde5393f14b4ff.

"io_uring: add buffer selection support to IORING_OP_NOP" has been
reverted from 5.19, which this relies on

Signed-off-by: Dylan Yudaken <[email protected]>
---
 test/buf-ring.c | 133 ------------------------------------------------
 1 file changed, 133 deletions(-)

diff --git a/test/buf-ring.c b/test/buf-ring.c
index 2fcc360..5fd1e53 100644
--- a/test/buf-ring.c
+++ b/test/buf-ring.c
@@ -206,134 +206,9 @@ static int test_reg_unreg(int bgid)
 	return 0;
 }
 
-static int test_one_nop(int bgid, struct io_uring *ring)
-{
-	int ret;
-	struct io_uring_cqe *cqe;
-	struct io_uring_sqe *sqe;
-
-	sqe = io_uring_get_sqe(ring);
-	if (!sqe) {
-		fprintf(stderr, "get sqe failed\n");
-		return -1;
-	}
-
-	io_uring_prep_nop(sqe);
-	sqe->flags |= IOSQE_BUFFER_SELECT;
-	sqe->buf_group = bgid;
-	ret = io_uring_submit(ring);
-	if (ret <= 0) {
-		fprintf(stderr, "sqe submit failed: %d\n", ret);
-		ret = -1;
-		goto out;
-	}
-
-	ret = io_uring_wait_cqe(ring, &cqe);
-	if (ret < 0) {
-		fprintf(stderr, "wait completion %d\n", ret);
-		ret = -1;
-		goto out;
-	}
-
-	if (cqe->res == -ENOBUFS) {
-		ret = cqe->res;
-		goto out;
-	}
-
-	if (cqe->res != 0) {
-		fprintf(stderr, "nop result %d\n", ret);
-		ret = -1;
-		goto out;
-	}
-
-	ret = cqe->flags >> 16;
-
-out:
-	io_uring_cqe_seen(ring, cqe);
-	return ret;
-}
-
-static int test_running(int bgid, int entries, int loops)
-{
-	struct io_uring_buf_reg reg = { };
-	struct io_uring ring;
-	void *ptr;
-	int ret;
-	int ring_size = (entries * sizeof(struct io_uring_buf) + 4095) & (~4095);
-	int ring_mask = io_uring_buf_ring_mask(entries);
-
-	int loop, idx;
-	bool *buffers;
-	struct io_uring_buf_ring *br;
-
-	ret = t_create_ring(1, &ring, 0);
-	if (ret == T_SETUP_SKIP)
-		return 0;
-	else if (ret != T_SETUP_OK)
-		return 1;
-
-	if (posix_memalign(&ptr, 4096, ring_size))
-		return 1;
-
-	br = (struct io_uring_buf_ring *)ptr;
-	io_uring_buf_ring_init(br);
-
-	buffers = malloc(sizeof(bool) * entries);
-	if (!buffers)
-		return 1;
-
-	reg.ring_addr = (unsigned long) ptr;
-	reg.ring_entries = entries;
-	reg.bgid = bgid;
-
-	ret = io_uring_register_buf_ring(&ring, &reg, 0);
-	if (ret) {
-		/* by now should have checked if this is supported or not */
-		fprintf(stderr, "Buffer ring register failed %d\n", ret);
-		return 1;
-	}
-
-	for (loop = 0; loop < loops; loop++) {
-		memset(buffers, 0, sizeof(bool) * entries);
-		for (idx = 0; idx < entries; idx++)
-			io_uring_buf_ring_add(br, ptr, 1, idx, ring_mask, idx);
-		io_uring_buf_ring_advance(br, entries);
-
-		for (idx = 0; idx < entries; idx++) {
-			ret = test_one_nop(bgid, &ring);
-			if (ret < 0) {
-				fprintf(stderr, "bad run %d/%d = %d\n", loop, idx, ret);
-				return ret;
-			}
-			if (buffers[ret]) {
-				fprintf(stderr, "reused buffer %d/%d = %d!\n", loop, idx, ret);
-				return 1;
-			}
-			buffers[ret] = true;
-		}
-		ret = test_one_nop(bgid, &ring);
-		if (ret != -ENOBUFS) {
-			fprintf(stderr, "expected enobufs run %d = %d\n", loop, ret);
-			return 1;
-		}
-
-	}
-
-	ret = io_uring_unregister_buf_ring(&ring, bgid);
-	if (ret) {
-		fprintf(stderr, "Buffer ring register failed %d\n", ret);
-		return 1;
-	}
-
-	io_uring_queue_exit(&ring);
-	free(buffers);
-	return 0;
-}
-
 int main(int argc, char *argv[])
 {
 	int bgids[] = { 1, 127, -1 };
-	int entries[] = {1, 32768, 4096, -1 };
 	int ret, i;
 
 	if (argc > 1)
@@ -367,13 +242,5 @@ int main(int argc, char *argv[])
 		}
 	}
 
-	for (i = 0; !no_buf_ring && entries[i] != -1; i++) {
-		ret = test_running(2, entries[i], 3);
-		if (ret) {
-			fprintf(stderr, "test_running(%d) failed\n", entries[i]);
-			return 1;
-		}
-	}
-
 	return 0;
 }
-- 
2.30.2


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

* Re: [PATCH liburing 0/2] revert buf-ring test
  2022-06-15  7:40 [PATCH liburing 0/2] revert buf-ring test Dylan Yudaken
  2022-06-15  7:40 ` [PATCH liburing 1/2] Revert "test/buf-ring: ensure cqe isn't used uninitialized" Dylan Yudaken
  2022-06-15  7:40 ` [PATCH liburing 2/2] Revert "buf-ring: add tests that cycle through the provided buffer ring" Dylan Yudaken
@ 2022-06-15 11:16 ` Dylan Yudaken
  2 siblings, 0 replies; 4+ messages in thread
From: Dylan Yudaken @ 2022-06-15 11:16 UTC (permalink / raw)
  To: [email protected]; +Cc: [email protected], [email protected]

On Wed, 2022-06-15 at 00:40 -0700, Dylan Yudaken wrote:
> Revert the two patches for the buf-ring test as the NOP support is
> being
> removed from 5.19
> 
> Dylan Yudaken (2):
>   Revert "test/buf-ring: ensure cqe isn't used uninitialized"
>   Revert "buf-ring: add tests that cycle through the provided buffer
>     ring"
> 
>  test/buf-ring.c | 130 ----------------------------------------------
> --
>  1 file changed, 130 deletions(-)
> 
> 
> base-commit: d6f9e02f9c6a777010824341f14c994b11dfc8b1

It's actually trivial to convert this to reads of /dev/zero, so I'll do
that instead rather than revert the test

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

end of thread, other threads:[~2022-06-15 11:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-15  7:40 [PATCH liburing 0/2] revert buf-ring test Dylan Yudaken
2022-06-15  7:40 ` [PATCH liburing 1/2] Revert "test/buf-ring: ensure cqe isn't used uninitialized" Dylan Yudaken
2022-06-15  7:40 ` [PATCH liburing 2/2] Revert "buf-ring: add tests that cycle through the provided buffer ring" Dylan Yudaken
2022-06-15 11:16 ` [PATCH liburing 0/2] revert buf-ring test Dylan Yudaken

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