From: "Marc-André Lureau" <mlureau@redhat.com>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: "Marc-André Lureau" <marcandre.lureau@gmail.com>,
QEMU <qemu-devel@nongnu.org>,
"Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: Re: [Qemu-devel] [RFC 00/14] vhost-user backends for gpu & input virtio devices
Date: Wed, 8 Jun 2016 08:53:44 -0400 (EDT) [thread overview]
Message-ID: <1351257374.4596282.1465390424689.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <1465366312.23509.23.camel@redhat.com>
Hi
----- Original Message -----
> > > > - the vhost-user-backend is a helper object spawning, setting up and
> > > > holding a connection to a backend
> > > > - the vhost-user socket is set to be fd 3 in child process
> > >
> > > Which implies a 1:1 relationship between object and backend. Which
> > > isn't that great if we want allow for multiple backends in one process
> > > (your idea below, and I think it can be useful).
> > >
> >
> > That socket could use a different protocol to instantiate vhost-user
> > device/backends (passing vhost-user sockets per device)?
>
> I'd tend to simply hand the backend process one unix socket path per
> device. Maybe also allow libvirt to link things using monitor fd
> passing.
>
> It's a little less automatic, but more flexible.
Having explicit socket path is closer to the current vhost-user-net approach:
-chardev socket,id=char0,path=/tmp/vubr.sock -netdev type=vhost-user,id=mynet1,chardev=char0
so we could have:
-chardev socket,id=char0,path=/tmp/vgpu.sock
-object vhost-user-backend,id=vug,chardev=char0
-device virtio-vga,virgl=true,vhost-user=vug
This is not incompatible with what I proposed, and I think that would be enough to allow libvirt to link things using monitor fd pass.
Other option is to hide vhost-user-backend object behind a property, and use chardev only:
-chardev socket,id=char0,path=/tmp/vgpu.sock
-device virtio-vga,virgl=true,vhost-user=char0
But I found it more convenient to allow qemu to manage the backend process, if only for development.
>
> > > > - there are device specific vhost-user messages to be added, such as
> > > > VHOST_USER_INPUT_GET_CONFIG, or we may use extra fd for communication
> > > > to pass to child during fork
> > >
> > > Is that needed? I think it should be possible to create device-agnostic
> > > messages for config access.
> >
> > VHOST_USER_INPUT_GET_CONFIG is quite virtio-input specific, since it
> > returns the array of virtio_input_config, that is later read via
> > virtio config selection. Can this be generalized?
>
> Well, not as one-time init call. You have to forward every write access
> to the backend. For read access the easiest would be to forward every
> access too. Or have a shadow copy for read access which is updated
> after every write.
I see. But it would have to be explicit which device requires read/write config and which not, and many config details would have to be specified on backend side. So far, only input requires config data, gpu and net have "static" qemu side config.
> > > > - when there is a whole set of messages to add, like the VHOST_GPU*, I
> > > > decided to use a different socket, given to backend with
> > > > VHOST_USER_GPU_SET_SOCKET.
> > >
> > > I would tend to send it all over the same socket.
> >
> > It's possible, but currently vhost-user protocol is unidirectional
> > (master/slave request/reply relationship). The backend cannot easily
> > send messages on its own. So beside reinventing some display protocol,
> > it is hard to fit in vhost-user socket today.
>
> Ok. So maybe it isn't that useful to use vhost-user for the gpu? The
> fundamental issue here is that qemu needs to process some of the
> messages. So you send those back to qemu via VHOST_GPU*.
>
> So maybe it works better when we continue to terminate the rings in
> qemu, then forward messages relevant for virglrenderer to the external
> process.
I would have to think about it, I am not sure how this would impact performance. I would rather teach vhost-user protocol to be bidirectionnal (and async), there would be benefits of doing that for the protocol in general (the graceful shutdown request would benefit such backend-side request support)
>
> > > > I am not sold that we need to develop a new vhost protocol for the gpu
> > > > though. I am considering the Spice worker thread (handling cursor and
> > > > display) to actually run in the vhost backend.
> > >
> > > Interesting idea, would safe quite a few context switches for dma-buf
> > > passing. But it also brings new challenges, vga compatibility for
> > > example. Also spice channel management. vdagent, ...
> >
> > What I had in mind is to hand off only the cursor and display channel
> > to the vhost-gpu backend once the channel is up and the gpu is active.
> > Eventually hand it back to qemu when switching back to VGA (sounds
> > like it should be doable to me, but perhaps not worth it like this?)
>
> It's not clear to me how you want hand over the display channel from
> qemu (and spice-server running as thread in qemu process context) to the
> vhost backend (running in a separate process).
10000ft view would be a qemu call like spice_qxl_steal(&state, &statesize, &fds, &nfds), that would gather all config and state related data and clients fds for cursor and display (qxl instance), and stop the worker thread. Then it would send this over to the backend, and resume a worker thread with a call like spice_qxl_resume(state, fds). The server is not ready for this sort of operations today though.
prev parent reply other threads:[~2016-06-08 12:53 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-04 21:33 [Qemu-devel] [RFC 00/14] vhost-user backends for gpu & input virtio devices marcandre.lureau
2016-06-04 21:33 ` [Qemu-devel] [RFC 01/14] Add qemu_chr_open_socket() marcandre.lureau
2016-06-04 21:33 ` [Qemu-devel] [RFC 02/14] Add vhost-user-backend marcandre.lureau
2016-06-04 21:33 ` [Qemu-devel] [RFC 03/14] vhost-user: split vhost_user_read() marcandre.lureau
2016-06-04 21:33 ` [Qemu-devel] [RFC 04/14] vhost-user: add vhost_user_input_get_config() marcandre.lureau
2016-06-04 21:33 ` [Qemu-devel] [RFC 05/14] Add vhost-user backend to virtio-input-host marcandre.lureau
2016-06-06 6:22 ` Gerd Hoffmann
2016-06-04 21:33 ` [Qemu-devel] [RFC 06/14] contrib: add vhost-user-input marcandre.lureau
2016-06-04 21:33 ` [Qemu-devel] [RFC 07/14] misc: rename virtio-gpu.h header guard marcandre.lureau
2016-06-04 21:33 ` [Qemu-devel] [RFC 08/14] vhost: make sure call fd has been received marcandre.lureau
2016-06-04 21:33 ` [Qemu-devel] [RFC 09/14] qemu-char: use READ_RETRIES marcandre.lureau
2016-06-04 21:33 ` [Qemu-devel] [RFC 10/14] qemu-char: block during sync read marcandre.lureau
2016-06-04 21:33 ` [Qemu-devel] [RFC 11/14] console: add dpy_gl_scanout2() marcandre.lureau
2016-06-06 6:35 ` Gerd Hoffmann
2016-06-06 13:18 ` Marc-André Lureau
2016-06-06 14:04 ` Gerd Hoffmann
2016-06-04 21:33 ` [Qemu-devel] [RFC 12/14] contrib: add vhost-user-gpu marcandre.lureau
2016-06-04 21:33 ` [Qemu-devel] [RFC 13/14] vhost-user: add vhost_user_gpu_set_socket() marcandre.lureau
2016-06-06 6:36 ` Gerd Hoffmann
2016-06-04 21:33 ` [Qemu-devel] [RFC 14/14] Add virtio-gpu vhost-user backend marcandre.lureau
2016-06-06 6:54 ` Gerd Hoffmann
2016-06-06 13:54 ` [Qemu-devel] [RFC 00/14] vhost-user backends for gpu & input virtio devices Marc-André Lureau
2016-06-07 14:47 ` Gerd Hoffmann
2016-06-07 15:01 ` Marc-André Lureau
2016-06-08 6:11 ` Gerd Hoffmann
2016-06-08 12:53 ` Marc-André Lureau [this message]
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=1351257374.4596282.1465390424689.JavaMail.zimbra@redhat.com \
--to=mlureau@redhat.com \
--cc=kraxel@redhat.com \
--cc=marcandre.lureau@gmail.com \
--cc=marcandre.lureau@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).