public inbox for [email protected]
 help / color / mirror / Atom feed
From: Zorro Lang <[email protected]>
To: "Darrick J. Wong" <[email protected]>
Cc: [email protected], [email protected]
Subject: Re: [PATCH 2/3] fsstress: bypass io_uring testing if io_uring_queue_init returns EPERM
Date: Thu, 7 Mar 2024 03:36:54 +0800	[thread overview]
Message-ID: <20240306193654.n6tztubknjlsx2ub@dell-per750-06-vm-08.rhts.eng.pek2.redhat.com> (raw)
In-Reply-To: <20240306155526.GB6188@frogsfrogsfrogs>

On Wed, Mar 06, 2024 at 07:55:26AM -0800, Darrick J. Wong wrote:
> On Wed, Mar 06, 2024 at 05:19:34PM +0800, Zorro Lang wrote:
> > I found the io_uring testing still fails as:
> >   io_uring_queue_init failed
> > even if kernel supports io_uring feature.
> > 
> > That because of the /proc/sys/kernel/io_uring_disabled isn't 0.
> > 
> > Different value means:
> >   0 All processes can create io_uring instances as normal.
> >   1 io_uring creation is disabled (io_uring_setup() will fail with
> >     -EPERM) for unprivileged processes not in the io_uring_group
> >     group. Existing io_uring instances can still be used.  See the
> >     documentation for io_uring_group for more information.
> >   2 io_uring creation is disabled for all processes. io_uring_setup()
> >     always fails with -EPERM. Existing io_uring instances can still
> >     be used.
> > 
> > So besides the CONFIG_IO_URING kernel config, there's another switch
> > can on or off the io_uring supporting. And the "2" or "1" might be
> > the default on some systems.
> > 
> > On this situation the io_uring_queue_init returns -EPERM, so I change
> > the fsstress to ignore io_uring testing if io_uring_queue_init returns
> > -ENOSYS or -EPERM. And print different verbose message for debug.
> > 
> > Signed-off-by: Zorro Lang <[email protected]>
> > ---
> >  ltp/fsstress.c | 15 +++++++++++++--
> >  1 file changed, 13 insertions(+), 2 deletions(-)
> > 
> > diff --git a/ltp/fsstress.c b/ltp/fsstress.c
> > index 482395c4..9c75f27b 100644
> > --- a/ltp/fsstress.c
> > +++ b/ltp/fsstress.c
> > @@ -762,12 +762,23 @@ int main(int argc, char **argv)
> >  #endif
> >  #ifdef URING
> >  			have_io_uring = true;
> > -			/* If ENOSYS, just ignore uring, other errors are fatal. */
> > +			/*
> > +			 * If ENOSYS, just ignore uring, due to kernel doesn't support it.
> > +			 * If EPERM, might due to sysctl kernel.io_uring_disabled isn't 0,
> 
> "might be due to..."

Hahaha, as native english speaker so :)

> 
> With that fixed,
> Reviewed-by: Darrick J. Wong <[email protected]>

Thanks, I'll change below if...else... to switch... as you suggested.

> 
> --D
> 
> > +			 *           or some selinux policies, etc.
> > +			 * Other errors are fatal.
> > +			 */
> >  			if ((c = io_uring_queue_init(URING_ENTRIES, &ring, 0)) != 0) {
> >  				if (c == -ENOSYS) {
> >  					have_io_uring = false;
> > +					if (verbose)
> > +						printf("io_uring isn't supported by kernel\n");
> > +				} else if (c == -EPERM) {
> > +					have_io_uring = false;
> > +					if (verbose)
> > +						printf("io_uring isn't allowed, check io_uring_disabled sysctl or selinux policy\n");
> >  				} else {
> > -					fprintf(stderr, "io_uring_queue_init failed\n");
> > +					fprintf(stderr, "io_uring_queue_init failed, errno=%d\n", c);
> >  					exit(1);
> >  				}
> >  			}
> > -- 
> > 2.43.0
> > 
> > 
> 


  reply	other threads:[~2024-03-06 19:37 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-06  9:19 [PATCH 0/3] fstests: fix io_uring testing Zorro Lang
2024-03-06  9:19 ` [PATCH 1/3] fsstress: check io_uring_queue_init errno properly Zorro Lang
2024-03-06 15:53   ` Darrick J. Wong
2024-03-06 19:34     ` Zorro Lang
2024-03-06 15:56   ` Jeff Moyer
2024-03-06  9:19 ` [PATCH 2/3] fsstress: bypass io_uring testing if io_uring_queue_init returns EPERM Zorro Lang
2024-03-06 15:55   ` Darrick J. Wong
2024-03-06 19:36     ` Zorro Lang [this message]
2024-03-06 15:57   ` Jeff Moyer
2024-03-06 19:38     ` Zorro Lang
2024-03-06  9:19 ` [PATCH 3/3] common/rc: force enable io_uring in _require_io_uring Zorro Lang
2024-03-06 15:43   ` Darrick J. Wong
2024-03-06 15:59     ` Jeff Moyer
2024-03-06 19:56       ` Zorro Lang
2024-03-06 19:51     ` Zorro Lang

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=20240306193654.n6tztubknjlsx2ub@dell-per750-06-vm-08.rhts.eng.pek2.redhat.com \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /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