[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: Enabling hypervisor agnosticism for VirtIO backends
Alex, On Wed, Sep 01, 2021 at 01:53:34PM +0100, Alex Benn??e wrote: > > Stefan Hajnoczi <stefanha@xxxxxxxxxx> writes: > > > [[PGP Signed Part:Undecided]] > > On Wed, Aug 04, 2021 at 12:20:01PM -0700, Stefano Stabellini wrote: > >> > Could we consider the kernel internally converting IOREQ messages from > >> > the Xen hypervisor to eventfd events? Would this scale with other kernel > >> > hypercall interfaces? > >> > > >> > So any thoughts on what directions are worth experimenting with? > >> > >> One option we should consider is for each backend to connect to Xen via > >> the IOREQ interface. We could generalize the IOREQ interface and make it > >> hypervisor agnostic. The interface is really trivial and easy to add. > >> The only Xen-specific part is the notification mechanism, which is an > >> event channel. If we replaced the event channel with something else the > >> interface would be generic. See: > >> https://gitlab.com/xen-project/xen/-/blob/staging/xen/include/public/hvm/ioreq.h#L52 > > > > There have been experiments with something kind of similar in KVM > > recently (see struct ioregionfd_cmd): > > https://lore.kernel.org/kvm/dad3d025bcf15ece11d9df0ff685e8ab0a4f2edd.1613828727.git.eafanasova@xxxxxxxxx/ > > Reading the cover letter was very useful in showing how this provides a > separate channel for signalling IO events to userspace instead of using > the normal type-2 vmexit type event. I wonder how deeply tied the > userspace facing side of this is to KVM? Could it provide a common FD > type interface to IOREQ? Why do you stick to a "FD" type interface? > As I understand IOREQ this is currently a direct communication between > userspace and the hypervisor using the existing Xen message bus. My With IOREQ server, IO event occurrences are notified to BE via Xen's event channel, while the actual contexts of IO events (see struct ioreq in ioreq.h) are put in a queue on a single shared memory page which is to be assigned beforehand with xenforeignmemory_map_resource hypervisor call. > worry would be that by adding knowledge of what the underlying > hypervisor is we'd end up with excess complexity in the kernel. For one > thing we certainly wouldn't want an API version dependency on the kernel > to understand which version of the Xen hypervisor it was running on. That's exactly what virtio-proxy in my proposal[1] does; All the hypervisor- specific details of IO event handlings are contained in virtio-proxy and virtio BE will communicate with virtio-proxy through a virtqueue (yes, virtio-proxy is seen as yet another virtio device on BE) and will get IO event-related *RPC* callbacks, either MMIO read or write, from virtio-proxy. See page 8 (protocol flow) and 10 (interfaces) in [1]. If kvm's ioregionfd can fit into this protocol, virtio-proxy for kvm will hopefully be implemented using ioregionfd. -Takahiro Akashi [1] https://op-lists.linaro.org/pipermail/stratos-dev/2021-August/000548.html > >> There is also another problem. IOREQ is probably not be the only > >> interface needed. Have a look at > >> https://marc.info/?l=xen-devel&m=162373754705233&w=2. Don't we also need > >> an interface for the backend to inject interrupts into the frontend? And > >> if the backend requires dynamic memory mappings of frontend pages, then > >> we would also need an interface to map/unmap domU pages. > >> > >> These interfaces are a lot more problematic than IOREQ: IOREQ is tiny > >> and self-contained. It is easy to add anywhere. A new interface to > >> inject interrupts or map pages is more difficult to manage because it > >> would require changes scattered across the various emulators. > > > > Something like ioreq is indeed necessary to implement arbitrary devices, > > but if you are willing to restrict yourself to VIRTIO then other > > interfaces are possible too because the VIRTIO device model is different > > from the general purpose x86 PIO/MMIO that Xen's ioreq seems to > > support. > > It's true our focus is just VirtIO which does support alternative > transport options however most implementations seem to be targeting > virtio-mmio for it's relative simplicity and understood semantics > (modulo a desire for MSI to reduce round trip latency handling > signalling). > > > > > Stefan > > > > [[End of PGP Signed Part]] > > > -- > Alex Bennée
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |