public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Zhao Gongyi <zhaogongyi@huawei.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH 2/2] io_uring.h: Remove io_uring_setup_supported_by_kernel()
Date: Thu, 15 Sep 2022 12:01:18 +0200	[thread overview]
Message-ID: <YyL37oKstZnbFORf@yuki> (raw)
In-Reply-To: <20220915062715.233884-3-zhaogongyi@huawei.com>

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

  reply	other threads:[~2022-09-15  9:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2022-09-15 10:03     ` Cyril Hrubis
  -- strict thread matches above, loose matches on Subject: below --
2022-09-16  2:08 zhaogongyi via ltp

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YyL37oKstZnbFORf@yuki \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    --cc=zhaogongyi@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox