[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: guest / host buffer sharing ...
From: |
Gerd Hoffmann |
Subject: |
Re: guest / host buffer sharing ... |
Date: |
Wed, 6 Nov 2019 07:24:28 +0100 |
User-agent: |
NeoMutt/20180716 |
> > (1) The virtio device
> > =====================
> >
> > Has a single virtio queue, so the guest can send commands to register
> > and unregister buffers. Buffers are allocated in guest ram. Each
> > buffer
> > has a list of memory ranges for the data. Each buffer also has some
> > properties to carry metadata, some fixed (id, size, application), but
> > also allow free form (name = value, framebuffers would have
> > width/height/stride/format for example).
> >
>
> Perfect, however since it's to be a generic device there also needs to be a
> method in the guest to identify which device is the one the application is
> interested in without opening the device.
This is what the application buffer property is supposed to handle, i.e.
you'll have a single device, all applications share it and the property
tells which buffer belongs to which application.
> The device should also support a reset feature allowing the guest to
> notify the host application that all buffers have become invalid such as
> on abnormal termination of the guest application that is using the device.
The guest driver should cleanup properly (i.e. unregister all buffers)
when an application terminates of course, no matter what the reason is
(crash, exit without unregistering buffers, ...). Doable without a full
device reset.
Independent from that a full reset will be supported of course, it is a
standard virtio feature.
> Conversely, qemu on unix socket disconnect should notify the guest of this
> event also, allowing each end to properly syncronize.
I was thinking more about a simple guest-side publishing of buffers,
without a backchannel. If more coordination is needed you can use
vsocks for that for example.
> > (3) The qemu host implementation
> > ================================
> >
> > qemu (likewise other vmms) can use the udmabuf driver to create
> > host-side dma-bufs for the buffers. The dma-bufs can be passed to
> > anyone interested, inside and outside qemu. We'll need some protocol
> > for communication between qemu and external users interested in those
> > buffers, to receive dma-bufs (via unix file descriptor passing) and
> > update notifications.
Using vhost for the host-side implementation should be possible too.
> > Dispatching updates could be done based on the
> > application property, which could be "virtio-vdec" or "wayland-proxy"
> > for example.
>
> I don't know enough about udmabuf to really comment on this except to ask
> a question. Would this make guest to guest transfers without an
> intermediate buffer possible?
Yes.
cheers,
Gerd
- guest / host buffer sharing ..., Gerd Hoffmann, 2019/11/05
- Re: guest / host buffer sharing ..., Stefan Hajnoczi, 2019/11/06
- Re: guest / host buffer sharing ..., Gerd Hoffmann, 2019/11/06
- Re: guest / host buffer sharing ..., Stefan Hajnoczi, 2019/11/07
- Re: guest / host buffer sharing ..., Frank Yang, 2019/11/07