* [LTP] [PATCH 0/2] Optimize io_uring related testcases
@ 2022-09-15 6:27 Zhao Gongyi via ltp
2022-09-15 6:27 ` [LTP] [PATCH 1/2] syscalls/io_uring: Add .needs_kconfigs Zhao Gongyi via ltp
2022-09-15 6:27 ` [LTP] [PATCH 2/2] io_uring.h: Remove io_uring_setup_supported_by_kernel() Zhao Gongyi via ltp
0 siblings, 2 replies; 7+ messages in thread
From: Zhao Gongyi via ltp @ 2022-09-15 6:27 UTC (permalink / raw)
To: ltp
1. Add .needs_kconfigs for io_uring01.c/io_uring02.c
2. Remove redundant io_uring_setup_supported_by_kernel()
Zhao Gongyi (2):
syscalls/io_uring: Add .needs_kconfigs
io_uring.h: Remove io_uring_setup_supported_by_kernel()
include/lapi/io_uring.h | 13 -------------
testcases/kernel/syscalls/io_uring/io_uring01.c | 5 ++++-
testcases/kernel/syscalls/io_uring/io_uring02.c | 6 ++++--
3 files changed, 8 insertions(+), 16 deletions(-)
--
2.17.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 7+ messages in thread
* [LTP] [PATCH 1/2] syscalls/io_uring: Add .needs_kconfigs
2022-09-15 6:27 [LTP] [PATCH 0/2] Optimize io_uring related testcases Zhao Gongyi via ltp
@ 2022-09-15 6:27 ` Zhao Gongyi via ltp
2022-09-15 9:49 ` Cyril Hrubis
2022-09-15 6:27 ` [LTP] [PATCH 2/2] io_uring.h: Remove io_uring_setup_supported_by_kernel() Zhao Gongyi via ltp
1 sibling, 1 reply; 7+ messages in thread
From: Zhao Gongyi via ltp @ 2022-09-15 6:27 UTC (permalink / raw)
To: ltp
Add .needs_kconfigs for io_uring01.c/io_uring02.c.
Signed-off-by: Zhao Gongyi <zhaogongyi@huawei.com>
---
testcases/kernel/syscalls/io_uring/io_uring01.c | 4 ++++
testcases/kernel/syscalls/io_uring/io_uring02.c | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/testcases/kernel/syscalls/io_uring/io_uring01.c b/testcases/kernel/syscalls/io_uring/io_uring01.c
index 70151bb85..cb1cabcb7 100644
--- a/testcases/kernel/syscalls/io_uring/io_uring01.c
+++ b/testcases/kernel/syscalls/io_uring/io_uring01.c
@@ -261,6 +261,10 @@ static struct tst_test test = {
.test = run,
.needs_tmpdir = 1,
.tcnt = ARRAY_SIZE(tcases),
+ .needs_kconfigs = (const char *const[]){
+ "CONFIG_IO_URING=y",
+ NULL
+ },
.bufs = (struct tst_buffers []) {
{&iov, .iov_sizes = (int[]){BLOCK_SZ, -1}},
{}
diff --git a/testcases/kernel/syscalls/io_uring/io_uring02.c b/testcases/kernel/syscalls/io_uring/io_uring02.c
index c5c770074..c7ea87ae5 100644
--- a/testcases/kernel/syscalls/io_uring/io_uring02.c
+++ b/testcases/kernel/syscalls/io_uring/io_uring02.c
@@ -255,6 +255,10 @@ static struct tst_test test = {
TST_CAP(TST_CAP_REQ, CAP_SYS_CHROOT),
{}
},
+ .needs_kconfigs = (const char *const[]){
+ "CONFIG_IO_URING=y",
+ NULL
+ },
.tags = (const struct tst_tag[]) {
{"linux-git", "9392a27d88b9"},
{"linux-git", "ff002b30181d"},
--
2.17.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [LTP] [PATCH 2/2] io_uring.h: Remove io_uring_setup_supported_by_kernel()
2022-09-15 6:27 [LTP] [PATCH 0/2] Optimize io_uring related testcases Zhao Gongyi via ltp
2022-09-15 6:27 ` [LTP] [PATCH 1/2] syscalls/io_uring: Add .needs_kconfigs Zhao Gongyi via ltp
@ 2022-09-15 6:27 ` Zhao Gongyi via ltp
2022-09-15 10:01 ` Cyril Hrubis
1 sibling, 1 reply; 7+ messages in thread
From: Zhao Gongyi via ltp @ 2022-09-15 6:27 UTC (permalink / raw)
To: ltp
There is a kernel config CONFIG_IO_URING to control whether
io_uring is supported, so checking of the kernel version seems
redundant.
Signed-off-by: Zhao Gongyi <zhaogongyi@huawei.com>
---
include/lapi/io_uring.h | 13 -------------
testcases/kernel/syscalls/io_uring/io_uring01.c | 1 -
testcases/kernel/syscalls/io_uring/io_uring02.c | 2 --
3 files changed, 16 deletions(-)
diff --git a/include/lapi/io_uring.h b/include/lapi/io_uring.h
index 397324511..8f1dfd64c 100644
--- a/include/lapi/io_uring.h
+++ b/include/lapi/io_uring.h
@@ -294,17 +294,4 @@ static inline int io_uring_enter(int fd, unsigned int to_submit,
}
#endif /* HAVE_IO_URING_ENTER */
-static inline void io_uring_setup_supported_by_kernel(void)
-{
- long ret;
- if ((tst_kvercmp(5, 1, 0)) < 0) {
- ret = syscall(__NR_io_uring_setup, NULL, 0);
- if (ret != -1)
- SAFE_CLOSE(ret);
- else if (errno == ENOSYS)
- tst_brk(TCONF,
- "Test not supported on kernel version < v5.1");
- }
-}
-
#endif /* LAPI_IO_URING_H__ */
diff --git a/testcases/kernel/syscalls/io_uring/io_uring01.c b/testcases/kernel/syscalls/io_uring/io_uring01.c
index cb1cabcb7..41aa05da0 100644
--- a/testcases/kernel/syscalls/io_uring/io_uring01.c
+++ b/testcases/kernel/syscalls/io_uring/io_uring01.c
@@ -252,7 +252,6 @@ static void run(unsigned int n)
static void setup(void)
{
- io_uring_setup_supported_by_kernel();
tst_fill_file(TEST_FILE, 'a', 1024, 1);
}
diff --git a/testcases/kernel/syscalls/io_uring/io_uring02.c b/testcases/kernel/syscalls/io_uring/io_uring02.c
index c7ea87ae5..a04e759f8 100644
--- a/testcases/kernel/syscalls/io_uring/io_uring02.c
+++ b/testcases/kernel/syscalls/io_uring/io_uring02.c
@@ -75,8 +75,6 @@ static void setup(void)
if (ret >= (int)sizeof(addr.sun_path))
tst_brk(TBROK, "Tempdir path is too long");
- io_uring_setup_supported_by_kernel();
-
sendsock = SAFE_SOCKET(AF_UNIX, SOCK_DGRAM, 0);
recvsock = SAFE_SOCKET(AF_UNIX, SOCK_DGRAM, 0);
SAFE_BIND(recvsock, (struct sockaddr *)&addr, sizeof(addr));
--
2.17.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [LTP] [PATCH 1/2] syscalls/io_uring: Add .needs_kconfigs
2022-09-15 6:27 ` [LTP] [PATCH 1/2] syscalls/io_uring: Add .needs_kconfigs Zhao Gongyi via ltp
@ 2022-09-15 9:49 ` Cyril Hrubis
0 siblings, 0 replies; 7+ messages in thread
From: Cyril Hrubis @ 2022-09-15 9:49 UTC (permalink / raw)
To: Zhao Gongyi; +Cc: ltp
Hi!
> Add .needs_kconfigs for io_uring01.c/io_uring02.c.
We do call io_uring_supported_by_kernel() in the setup() of these tests
so this shouldn't be needed at all. What is the problem you are trying
to fix?
> Signed-off-by: Zhao Gongyi <zhaogongyi@huawei.com>
> ---
> testcases/kernel/syscalls/io_uring/io_uring01.c | 4 ++++
> testcases/kernel/syscalls/io_uring/io_uring02.c | 4 ++++
> 2 files changed, 8 insertions(+)
>
> diff --git a/testcases/kernel/syscalls/io_uring/io_uring01.c b/testcases/kernel/syscalls/io_uring/io_uring01.c
> index 70151bb85..cb1cabcb7 100644
> --- a/testcases/kernel/syscalls/io_uring/io_uring01.c
> +++ b/testcases/kernel/syscalls/io_uring/io_uring01.c
> @@ -261,6 +261,10 @@ static struct tst_test test = {
> .test = run,
> .needs_tmpdir = 1,
> .tcnt = ARRAY_SIZE(tcases),
> + .needs_kconfigs = (const char *const[]){
> + "CONFIG_IO_URING=y",
> + NULL
> + },
> .bufs = (struct tst_buffers []) {
> {&iov, .iov_sizes = (int[]){BLOCK_SZ, -1}},
> {}
> diff --git a/testcases/kernel/syscalls/io_uring/io_uring02.c b/testcases/kernel/syscalls/io_uring/io_uring02.c
> index c5c770074..c7ea87ae5 100644
> --- a/testcases/kernel/syscalls/io_uring/io_uring02.c
> +++ b/testcases/kernel/syscalls/io_uring/io_uring02.c
> @@ -255,6 +255,10 @@ static struct tst_test test = {
> TST_CAP(TST_CAP_REQ, CAP_SYS_CHROOT),
> {}
> },
> + .needs_kconfigs = (const char *const[]){
> + "CONFIG_IO_URING=y",
> + NULL
> + },
> .tags = (const struct tst_tag[]) {
> {"linux-git", "9392a27d88b9"},
> {"linux-git", "ff002b30181d"},
> --
> 2.17.1
>
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [LTP] [PATCH 2/2] io_uring.h: Remove io_uring_setup_supported_by_kernel()
2022-09-15 6:27 ` [LTP] [PATCH 2/2] io_uring.h: Remove io_uring_setup_supported_by_kernel() Zhao Gongyi via ltp
@ 2022-09-15 10:01 ` Cyril Hrubis
2022-09-15 10:03 ` Cyril Hrubis
0 siblings, 1 reply; 7+ messages in thread
From: Cyril Hrubis @ 2022-09-15 10:01 UTC (permalink / raw)
To: Zhao Gongyi; +Cc: ltp
Hi!
> -static inline void io_uring_setup_supported_by_kernel(void)
> -{
> - long ret;
> - if ((tst_kvercmp(5, 1, 0)) < 0) {
> - ret = syscall(__NR_io_uring_setup, NULL, 0);
> - if (ret != -1)
> - SAFE_CLOSE(ret);
> - else if (errno == ENOSYS)
> - tst_brk(TCONF,
> - "Test not supported on kernel version < v5.1");
> - }
> -}
I guess I see the problem now, with the CONFIG_IO_URING not set this
will fail to detect that io_uring() is not supported. So the easiest
solution here would be:
diff --git a/include/lapi/io_uring.h b/include/lapi/io_uring.h
index 397324511..43d28f74a 100644
--- a/include/lapi/io_uring.h
+++ b/include/lapi/io_uring.h
@@ -297,14 +297,22 @@ static inline int io_uring_enter(int fd, unsigned int to_submit,
static inline void io_uring_setup_supported_by_kernel(void)
{
long ret;
+
+ ret = syscall(__NR_io_uring_setup, NULL, 0);
+
+ if (ret != -1) {
+ SAFE_CLOSE(ret);
+ return;
+ }
+
if ((tst_kvercmp(5, 1, 0)) < 0) {
- ret = syscall(__NR_io_uring_setup, NULL, 0);
- if (ret != -1)
- SAFE_CLOSE(ret);
- else if (errno == ENOSYS)
+ if (errno == ENOSYS)
tst_brk(TCONF,
"Test not supported on kernel version < v5.1");
}
+
+ if (errno == ENOSYS)
+ tst_brk(TCONF, "CONFIG_IO_URING not set?");
}
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [LTP] [PATCH 2/2] io_uring.h: Remove io_uring_setup_supported_by_kernel()
2022-09-15 10:01 ` Cyril Hrubis
@ 2022-09-15 10:03 ` Cyril Hrubis
0 siblings, 0 replies; 7+ messages in thread
From: Cyril Hrubis @ 2022-09-15 10:03 UTC (permalink / raw)
To: Zhao Gongyi; +Cc: ltp
Hi!
> diff --git a/include/lapi/io_uring.h b/include/lapi/io_uring.h
> index 397324511..43d28f74a 100644
> --- a/include/lapi/io_uring.h
> +++ b/include/lapi/io_uring.h
> @@ -297,14 +297,22 @@ static inline int io_uring_enter(int fd, unsigned int to_submit,
> static inline void io_uring_setup_supported_by_kernel(void)
> {
> long ret;
> +
> + ret = syscall(__NR_io_uring_setup, NULL, 0);
> +
> + if (ret != -1) {
> + SAFE_CLOSE(ret);
> + return;
> + }
> +
> if ((tst_kvercmp(5, 1, 0)) < 0) {
> - ret = syscall(__NR_io_uring_setup, NULL, 0);
> - if (ret != -1)
> - SAFE_CLOSE(ret);
> - else if (errno == ENOSYS)
> + if (errno == ENOSYS)
> tst_brk(TCONF,
> "Test not supported on kernel version < v5.1");
> }
> +
> + if (errno == ENOSYS)
Based on your latest reply this should be EOPNOTSUPP.
> + tst_brk(TCONF, "CONFIG_IO_URING not set?");
> }
>
>
> --
> Cyril Hrubis
> chrubis@suse.cz
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [LTP] [PATCH 2/2] io_uring.h: Remove io_uring_setup_supported_by_kernel()
@ 2022-09-16 2:08 zhaogongyi via ltp
0 siblings, 0 replies; 7+ messages in thread
From: zhaogongyi via ltp @ 2022-09-16 2:08 UTC (permalink / raw)
To: Cyril Hrubis; +Cc: ltp@lists.linux.it
Hi Cyril,
> Hi!
> > diff --git a/include/lapi/io_uring.h b/include/lapi/io_uring.h index
> > 397324511..43d28f74a 100644
> > --- a/include/lapi/io_uring.h
> > +++ b/include/lapi/io_uring.h
> > @@ -297,14 +297,22 @@ static inline int io_uring_enter(int fd,
> > unsigned int to_submit, static inline void
> > io_uring_setup_supported_by_kernel(void)
> > {
> > long ret;
> > +
> > + ret = syscall(__NR_io_uring_setup, NULL, 0);
> > +
> > + if (ret != -1) {
> > + SAFE_CLOSE(ret);
> > + return;
> > + }
> > +
> > if ((tst_kvercmp(5, 1, 0)) < 0) {
> > - ret = syscall(__NR_io_uring_setup, NULL, 0);
> > - if (ret != -1)
> > - SAFE_CLOSE(ret);
> > - else if (errno == ENOSYS)
> > + if (errno == ENOSYS)
> > tst_brk(TCONF,
> > "Test not supported on kernel
> version < v5.1");
> > }
> > +
> > + if (errno == ENOSYS)
>
> Based on your latest reply this should be EOPNOTSUPP.
The errno is ENOSYS when CONFIG_IO_URING is not set. My system is different with the linux upstream.
Thanks, I have resubmit a new patch as your suggestion, please see: https://patchwork.ozlabs.org/project/ltp/patch/20220916015948.156798-1-zhaogongyi@huawei.com/
>
> > + tst_brk(TCONF, "CONFIG_IO_URING not set?");
> > }
> >
> >
> > --
> > Cyril Hrubis
> > chrubis@suse.cz
> >
> > --
> > Mailing list info: https://lists.linux.it/listinfo/ltp
>
> --
> Cyril Hrubis
> chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2022-09-16 2:08 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-15 6:27 [LTP] [PATCH 0/2] Optimize io_uring related testcases Zhao Gongyi via ltp
2022-09-15 6:27 ` [LTP] [PATCH 1/2] syscalls/io_uring: Add .needs_kconfigs Zhao Gongyi via ltp
2022-09-15 9:49 ` Cyril Hrubis
2022-09-15 6:27 ` [LTP] [PATCH 2/2] io_uring.h: Remove io_uring_setup_supported_by_kernel() Zhao Gongyi via ltp
2022-09-15 10:01 ` Cyril Hrubis
2022-09-15 10:03 ` Cyril Hrubis
-- strict thread matches above, loose matches on Subject: below --
2022-09-16 2:08 zhaogongyi via ltp
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox