qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: Stefano Garzarella <sgarzare@redhat.com>
Cc: Michael Tsirkin <mst@redhat.com>,
	Eugenio Perez Martin <eperezma@redhat.com>,
	peili.dev@gmail.com,  qemu devel list <qemu-devel@nongnu.org>,
	 Linux Virtualization <virtualization@lists.linux-foundation.org>
Subject: Re: vdpa: use io_uring passthrough command for IOCTLs [was Re: [PATCH 1/2] Reduce vdpa initialization / startup overhead]
Date: Wed, 26 Jul 2023 16:10:27 +0800	[thread overview]
Message-ID: <CACGkMEtGXOC9TCp+YrBPaV14tVt_hxUcOzRe+EFW-1YV--6w3A@mail.gmail.com> (raw)
In-Reply-To: <CAGxU2F4N+xAM0gRh2dHDLSujkJ4Ek--Hk+PoTHOsxe4k+GTrrA@mail.gmail.com>

On Tue, Jul 18, 2023 at 6:32 PM Stefano Garzarella <sgarzare@redhat.com> wrote:
>
> On Thu, Apr 20, 2023 at 6:20 AM Jason Wang <jasowang@redhat.com> wrote:
> >
> > On Wed, Apr 19, 2023 at 11:33 PM Eugenio Perez Martin
> > <eperezma@redhat.com> wrote:
> > >
> > > On Wed, Apr 19, 2023 at 12:56 AM <peili.dev@gmail.com> wrote:
> > > >
> > > > From: Pei Li <peili.dev@gmail.com>
> > > >
> > > > Currently, part of the vdpa initialization / startup process
> > > > needs to trigger many ioctls per vq, which is very inefficient
> > > > and causing unnecessary context switch between user mode and
> > > > kernel mode.
> > > >
> > > > This patch creates an additional ioctl() command, namely
> > > > VHOST_VDPA_GET_VRING_GROUP_BATCH, that will batching
> > > > commands of VHOST_VDPA_GET_VRING_GROUP into a single
> > > > ioctl() call.
> >
> > I'd expect there's a kernel patch but I didn't see that?
> >
> > If we want to go this way. Why simply have a more generic way, that is
> > introducing something like:
> >
> > VHOST_CMD_BATCH which did something like
> >
> > struct vhost_cmd_batch {
> >     int ncmds;
> >     struct vhost_ioctls[];
> > };
> >
> > Then you can batch other ioctls other than GET_VRING_GROUP?
> >
>
> Just restarting this discussion, since I recently worked more with
> io_uring passthrough commands and I think it can help here.
>
> The NVMe guys had a similar problem (ioctl too slow for their use
> case)[1][2], so they developed a new feature in io_uring that
> basically allows you to do IOCTLs asynchronously and in batches using
> io_uring.
>
> The same feature is also used by ublk [3] and I recently talked about
> this at DevConf with German [4].
>
> Basically, there's a new callback in fops (struct file_operations.uring_cmd).
> IIUC for NVMe (drivers/nvme/host/ioctl.c) they used exactly the same
> values used for IOCTLs also for the new uring_cmd callback.
>
> We could do the same. The changes in the vhost-vdpa kernel module
> should be simple, and we could share the code for handling ioctl and
> uring_cmd.
> That way any new command can be supported with both for compatibility.
>
> In QEMU then we can start using it to optimize the control path.
>
> What do you think?

This looks interesting.

>
> If it's interesting, I could throw down an RFC with the changes or if
> anyone is interested in working on it, I can help with the details.

Please do that.

Thanks


>
> Thanks,
> Stefano
>
> [1] https://lpc.events/event/11/contributions/989/
> [2] https://lpc.events/event/16/contributions/1382/
> [3] https://lwn.net/Articles/903855/
> [4] https://www.youtube.com/watch?v=6JqNPirreoY
>



  reply	other threads:[~2023-07-26  8:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-18 22:56 [PATCH 1/2] Reduce vdpa initialization / startup overhead peili.dev
2023-04-18 22:56 ` [PATCH 2/2] " peili.dev
2023-04-19 15:33 ` [PATCH 1/2] " Eugenio Perez Martin
2023-04-20  4:18   ` Jason Wang
2023-04-20  5:25     ` Pei Li
2023-04-20  8:14       ` Jason Wang
2023-04-20  8:59       ` Eugenio Perez Martin
2023-07-18 10:55         ` Michael S. Tsirkin
2023-07-21 10:39           ` Eugenio Perez Martin
2023-07-21 20:57             ` Si-Wei Liu
2023-07-18 10:32     ` vdpa: use io_uring passthrough command for IOCTLs [was Re: [PATCH 1/2] Reduce vdpa initialization / startup overhead] Stefano Garzarella
2023-07-26  8:10       ` Jason Wang [this message]
2023-07-18 10:53 ` [PATCH 1/2] Reduce vdpa initialization / startup overhead Michael S. Tsirkin

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=CACGkMEtGXOC9TCp+YrBPaV14tVt_hxUcOzRe+EFW-1YV--6w3A@mail.gmail.com \
    --to=jasowang@redhat.com \
    --cc=eperezma@redhat.com \
    --cc=mst@redhat.com \
    --cc=peili.dev@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sgarzare@redhat.com \
    --cc=virtualization@lists.linux-foundation.org \
    /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).