From: Stefan Hajnoczi <stefanha@redhat.com>
To: John Levon <levon@movementarian.org>
Cc: Elena <elena.ufimtseva@oracle.com>,
john.g.johnson@oracle.com, jag.raman@oracle.com,
kvm@vger.kernel.org, mst@redhat.com, jasowang@redhat.com,
cohuck@redhat.com, qemu-devel@nongnu.org, eafanasova@gmail.com,
felipe@nutanix.com, dinechin@redhat.com
Subject: Re: MMIO/PIO dispatch file descriptors (ioregionfd) design discussion
Date: Wed, 27 Oct 2021 11:15:35 +0100 [thread overview]
Message-ID: <YXkmx3V0VklA6qHl@stefanha-x1.localdomain> (raw)
In-Reply-To: <YXhQk/Sh0nLOmA2n@movementarian.org>
[-- Attachment #1: Type: text/plain, Size: 2649 bytes --]
On Tue, Oct 26, 2021 at 08:01:39PM +0100, John Levon wrote:
> On Mon, Oct 25, 2021 at 08:21:22AM -0700, Elena wrote:
>
> > > I'm curious what approach you want to propose for QEMU integration. A
> > > while back I thought about the QEMU API. It's possible to implement it
> > > along the lines of the memory_region_add_eventfd() API where each
> > > ioregionfd is explicitly added by device emulation code. An advantage of
> > > this approach is that a MemoryRegion can have multiple ioregionfds, but
> > > I'm not sure if that is a useful feature.
> > >
> >
> > This is the approach that is currently in the works. Agree, I dont see
> > much of the application here at this point to have multiple ioregions
> > per MemoryRegion.
> > I added Memory API/eventfd approach to the vfio-user as well to try
> > things out.
> >
> > > An alternative is to cover the entire MemoryRegion with one ioregionfd.
> > > That way the device emulation code can use ioregionfd without much fuss
> > > since there is a 1:1 mapping between MemoryRegions, which are already
> > > there in existing devices. There is no need to think deeply about which
> > > ioregionfds to create for a device.
> > >
> > > A new API called memory_region_set_aio_context(MemoryRegion *mr,
> > > AioContext *ctx) would cause ioregionfd (or a userspace fallback for
> > > non-KVM cases) to execute the MemoryRegion->read/write() accessors from
> > > the given AioContext. The details of ioregionfd are hidden behind the
> > > memory_region_set_aio_context() API, so the device emulation code
> > > doesn't need to know the capabilities of ioregionfd.
> >
> > >
> > > The second approach seems promising if we want more devices to use
> > > ioregionfd inside QEMU because it requires less ioregionfd-specific
> > > code.
> > >
> > I like this approach as well.
> > As you have mentioned, the device emulation code with first approach
> > does have to how to handle the region accesses. The second approach will
> > make things more transparent. Let me see how can I modify what there is
> > there now and may ask further questions.
>
> Sorry I'm a bit late to this discussion, I'm not clear on the above WRT
> vfio-user. If an ioregionfd has to cover a whole BAR0 (?), how would this
> interact with partly-mmap()able regions like we do with SPDK/vfio-user/NVMe?
The ioregionfd doesn't need to cover an entire BAR. QEMU's MemoryRegions
form a hierarchy, so it's possible to sub-divide the BAR into several
MemoryRegions.
This means it's still possible to have mmap() sub-regions or even
ioeventfds sprinkled in between.
Stefan
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2021-10-27 10:19 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <88ca79d2e378dcbfb3988b562ad2c16c4f929ac7.camel@gmail.com>
2021-10-12 5:34 ` MMIO/PIO dispatch file descriptors (ioregionfd) design discussion elena
2021-10-25 12:42 ` Stefan Hajnoczi
2021-10-25 15:21 ` Elena
2021-10-25 16:56 ` Stefan Hajnoczi
2021-10-26 19:01 ` John Levon
2021-10-27 10:15 ` Stefan Hajnoczi [this message]
2021-10-27 12:22 ` John Levon
2021-10-28 8:14 ` 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=YXkmx3V0VklA6qHl@stefanha-x1.localdomain \
--to=stefanha@redhat.com \
--cc=cohuck@redhat.com \
--cc=dinechin@redhat.com \
--cc=eafanasova@gmail.com \
--cc=elena.ufimtseva@oracle.com \
--cc=felipe@nutanix.com \
--cc=jag.raman@oracle.com \
--cc=jasowang@redhat.com \
--cc=john.g.johnson@oracle.com \
--cc=kvm@vger.kernel.org \
--cc=levon@movementarian.org \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.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).