All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH liburing 0/2] non-privileged tests
@ 2021-08-24 11:39 Pavel Begunkov
  2021-08-24 11:39 ` [PATCH liburing 1/2] tests: non-privileged defer test Pavel Begunkov
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Pavel Begunkov @ 2021-08-24 11:39 UTC (permalink / raw)
  To: Jens Axboe, io-uring

Two more fixes making it work (partially) with non-privileged users.

Pavel Begunkov (2):
  tests: non-privileged defer test
  tests: non-privileged io_uring_enter

 test/defer.c          | 39 +++++++++++++++++++--------------------
 test/io_uring_enter.c |  3 +++
 2 files changed, 22 insertions(+), 20 deletions(-)

-- 
2.32.0


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

* [PATCH liburing 1/2] tests: non-privileged defer test
  2021-08-24 11:39 [PATCH liburing 0/2] non-privileged tests Pavel Begunkov
@ 2021-08-24 11:39 ` Pavel Begunkov
  2021-08-24 11:39 ` [PATCH liburing 2/2] tests: non-privileged io_uring_enter Pavel Begunkov
  2021-08-24 14:09 ` [PATCH liburing 0/2] non-privileged tests Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Pavel Begunkov @ 2021-08-24 11:39 UTC (permalink / raw)
  To: Jens Axboe, io-uring

Reduce ring sizes because non-privileged users can't create them, clean
up dead code, and SQPOLL testing to the end, so it doesn't stop all
other tests if not supported.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
 test/defer.c | 39 +++++++++++++++++++--------------------
 1 file changed, 19 insertions(+), 20 deletions(-)

diff --git a/test/defer.c b/test/defer.c
index 885cf5c..825b69f 100644
--- a/test/defer.c
+++ b/test/defer.c
@@ -11,6 +11,8 @@
 #include "helpers.h"
 #include "liburing.h"
 
+#define RING_SIZE 128
+
 struct test_context {
 	struct io_uring *ring;
 	struct io_uring_sqe **sqes;
@@ -243,30 +245,24 @@ int main(int argc, char *argv[])
 {
 	struct io_uring ring, poll_ring, sqthread_ring;
 	struct io_uring_params p;
-	int ret, no_sqthread = 0;
+	int ret;
 
 	if (argc > 1)
 		return 0;
 
 	memset(&p, 0, sizeof(p));
-	ret = io_uring_queue_init_params(1000, &ring, &p);
+	ret = io_uring_queue_init_params(RING_SIZE, &ring, &p);
 	if (ret) {
-		printf("ring setup failed\n");
+		printf("ring setup failed %i\n", ret);
 		return 1;
 	}
 
-	ret = io_uring_queue_init(1000, &poll_ring, IORING_SETUP_IOPOLL);
+	ret = io_uring_queue_init(RING_SIZE, &poll_ring, IORING_SETUP_IOPOLL);
 	if (ret) {
 		printf("poll_ring setup failed\n");
 		return 1;
 	}
 
-	ret = t_create_ring(1000, &sqthread_ring,
-				IORING_SETUP_SQPOLL | IORING_SETUP_IOPOLL);
-	if (ret == T_SETUP_SKIP)
-		return 0;
-	else if (ret < 0)
-		return 1;
 
 	ret = test_cancelled_userdata(&poll_ring);
 	if (ret) {
@@ -274,16 +270,6 @@ int main(int argc, char *argv[])
 		return ret;
 	}
 
-	if (no_sqthread) {
-		printf("test_thread_link_cancel: skipped, not root\n");
-	} else {
-		ret = test_thread_link_cancel(&sqthread_ring);
-		if (ret) {
-			printf("test_thread_link_cancel failed\n");
-			return ret;
-		}
-	}
-
 	if (!(p.features & IORING_FEAT_NODROP)) {
 		ret = test_overflow_hung(&ring);
 		if (ret) {
@@ -304,5 +290,18 @@ int main(int argc, char *argv[])
 		return ret;
 	}
 
+	ret = t_create_ring(RING_SIZE, &sqthread_ring,
+				IORING_SETUP_SQPOLL | IORING_SETUP_IOPOLL);
+	if (ret == T_SETUP_SKIP)
+		return 0;
+	else if (ret < 0)
+		return 1;
+
+	ret = test_thread_link_cancel(&sqthread_ring);
+	if (ret) {
+		printf("test_thread_link_cancel failed\n");
+		return ret;
+	}
+
 	return 0;
 }
-- 
2.32.0


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

* [PATCH liburing 2/2] tests: non-privileged io_uring_enter
  2021-08-24 11:39 [PATCH liburing 0/2] non-privileged tests Pavel Begunkov
  2021-08-24 11:39 ` [PATCH liburing 1/2] tests: non-privileged defer test Pavel Begunkov
@ 2021-08-24 11:39 ` Pavel Begunkov
  2021-08-24 14:09 ` [PATCH liburing 0/2] non-privileged tests Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Pavel Begunkov @ 2021-08-24 11:39 UTC (permalink / raw)
  To: Jens Axboe, io-uring

Decrease the ring size in io_uring_enter if can't allocate a large ring.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
 test/io_uring_enter.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/test/io_uring_enter.c b/test/io_uring_enter.c
index 12f4ac9..4ea990c 100644
--- a/test/io_uring_enter.c
+++ b/test/io_uring_enter.c
@@ -30,6 +30,7 @@
 #include "../src/syscall.h"
 
 #define IORING_MAX_ENTRIES 4096
+#define IORING_MAX_ENTRIES_FALLBACK 128
 
 int
 expect_failed_submit(struct io_uring *ring, int error)
@@ -218,6 +219,8 @@ main(int argc, char **argv)
 		return 0;
 
 	ret = io_uring_queue_init(IORING_MAX_ENTRIES, &ring, 0);
+	if (ret == -ENOMEM)
+		ret = io_uring_queue_init(IORING_MAX_ENTRIES_FALLBACK, &ring, 0);
 	if (ret < 0) {
 		perror("io_uring_queue_init");
 		exit(1);
-- 
2.32.0


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

* Re: [PATCH liburing 0/2] non-privileged tests
  2021-08-24 11:39 [PATCH liburing 0/2] non-privileged tests Pavel Begunkov
  2021-08-24 11:39 ` [PATCH liburing 1/2] tests: non-privileged defer test Pavel Begunkov
  2021-08-24 11:39 ` [PATCH liburing 2/2] tests: non-privileged io_uring_enter Pavel Begunkov
@ 2021-08-24 14:09 ` Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2021-08-24 14:09 UTC (permalink / raw)
  To: Pavel Begunkov, io-uring

On 8/24/21 5:39 AM, Pavel Begunkov wrote:
> Two more fixes making it work (partially) with non-privileged users.
> 
> Pavel Begunkov (2):
>   tests: non-privileged defer test
>   tests: non-privileged io_uring_enter
> 
>  test/defer.c          | 39 +++++++++++++++++++--------------------
>  test/io_uring_enter.c |  3 +++
>  2 files changed, 22 insertions(+), 20 deletions(-)

Applied, thanks.

-- 
Jens Axboe


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

end of thread, other threads:[~2021-08-24 14:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-24 11:39 [PATCH liburing 0/2] non-privileged tests Pavel Begunkov
2021-08-24 11:39 ` [PATCH liburing 1/2] tests: non-privileged defer test Pavel Begunkov
2021-08-24 11:39 ` [PATCH liburing 2/2] tests: non-privileged io_uring_enter Pavel Begunkov
2021-08-24 14:09 ` [PATCH liburing 0/2] non-privileged tests Jens Axboe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.