From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Fam Zheng <fam@euphon.net>
Cc: Damien Le Moal <Damien.LeMoal@wdc.com>,
Dmitry Fomichev <Dmitry.Fomichev@wdc.com>,
Stefan Hajnoczi <stefanha@gmail.com>,
Sam Li <faithilikerun@gmail.com>,
qemu-devel <qemu-devel@nongnu.org>,
Hannes Reinecke <hare@suse.de>
Subject: Re: [PATCH v4] Use io_uring_register_ring_fd() to skip fd operations
Date: Fri, 22 Apr 2022 11:08:39 +0100 [thread overview]
Message-ID: <YmJ+p1axke5dcSw8@redhat.com> (raw)
In-Reply-To: <20220422100047.GB61339@fam-dell>
On Fri, Apr 22, 2022 at 11:00:47AM +0100, Fam Zheng wrote:
> On 2022-04-22 09:52, Daniel P. Berrangé wrote:
> > On Fri, Apr 22, 2022 at 09:34:28AM +0100, Fam Zheng wrote:
> > > On 2022-04-22 00:36, Sam Li wrote:
> > > > Linux recently added a new io_uring(7) optimization API that QEMU
> > > > doesn't take advantage of yet. The liburing library that QEMU uses
> > > > has added a corresponding new API calling io_uring_register_ring_fd().
> > > > When this API is called after creating the ring, the io_uring_submit()
> > > > library function passes a flag to the io_uring_enter(2) syscall
> > > > allowing it to skip the ring file descriptor fdget()/fdput()
> > > > operations. This saves some CPU cycles.
> > > >
> > > > Signed-off-by: Sam Li <faithilikerun@gmail.com>
> > > > ---
> > > > block/io_uring.c | 10 +++++++++-
> > > > 1 file changed, 9 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/block/io_uring.c b/block/io_uring.c
> > > > index 782afdb433..5247fb79e2 100644
> > > > --- a/block/io_uring.c
> > > > +++ b/block/io_uring.c
> > > > @@ -435,8 +435,16 @@ LuringState *luring_init(Error **errp)
> > > > }
> > > >
> > > > ioq_init(&s->io_q);
> > > > - return s;
> > > > + if (io_uring_register_ring_fd(&s->ring) < 0) {
> > > > + /*
> > > > + * Only warn about this error: we will fallback to the non-optimized
> > > > + * io_uring operations.
> > > > + */
> > > > + error_reportf_err(*errp,
> > > > + "failed to register linux io_uring ring file descriptor");
> > >
> > > IIUC errp can be NULL, so let's not dereference it without checking. So, just
> > > use error_report?
> >
> > Plenty of people will be running kernels that lack the new feature,
> > so this "failure" will be an expected scenario. We shouldn't be
> > spamming the logs with any error or warning message. Assuming QEMU
> > remains fully functional, merely not as optimized, we should be
> > totally silent.
>
> Functionally, that's a very valid point. But performance wise, is it good to
> have some visibility of this? Since people use io_uring instead of other
> options almost certainly for performance, and here the issue does matter quite
> a bit.
IMHO what you describe is largely a documentation issue, and/or something
for OS vendors to worry about if they want to maximise their users'
performance. As long as io_uring is fully functional we shouldn't print
errors on every QEMU startup, as it leads to pointless bug reports/support
escalations about something that is operating normally, wasting users and
vendors' time.
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
next prev parent reply other threads:[~2022-04-22 11:51 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-21 16:36 [PATCH v4] Use io_uring_register_ring_fd() to skip fd operations Sam Li
2022-04-22 8:34 ` Fam Zheng
2022-04-22 8:52 ` Daniel P. Berrangé
2022-04-22 10:00 ` Fam Zheng
2022-04-22 10:08 ` Daniel P. Berrangé [this message]
2022-04-22 15:04 ` Stefan Hajnoczi
2022-04-22 15:10 ` Stefan Hajnoczi
2022-04-22 15:40 ` olc
2022-05-31 6:35 ` Stefan Hajnoczi
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=YmJ+p1axke5dcSw8@redhat.com \
--to=berrange@redhat.com \
--cc=Damien.LeMoal@wdc.com \
--cc=Dmitry.Fomichev@wdc.com \
--cc=faithilikerun@gmail.com \
--cc=fam@euphon.net \
--cc=hare@suse.de \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@gmail.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;
as well as URLs for NNTP newsgroup(s).