qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Amit Shah <amit.shah@redhat.com>
To: Jamie Lokier <jamie@shareable.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>,
	virtualization@lists.linux-foundation.org,
	"Richard W.M. Jones" <rjones@redhat.com>,
	kvm@vger.kernel.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Re: virtio-serial: An interface for host-guest communication
Date: Fri, 7 Aug 2009 12:08:00 +0530	[thread overview]
Message-ID: <20090807063800.GA16769@amit-x200.redhat.com> (raw)
In-Reply-To: <20090806173740.GA1178@shareable.org>

On (Thu) Aug 06 2009 [18:37:40], Jamie Lokier wrote:
> Amit Shah wrote:
> > On (Thu) Aug 06 2009 [08:58:01], Anthony Liguori wrote:
> > > Amit Shah wrote:
> > >> On (Thu) Aug 06 2009 [08:29:40], Anthony Liguori wrote:
> > >>   
> > >>> Amit Shah wrote:
> > >>>     
> > >>>> Sure; but there's been no resistance from anyone from including the
> > >>>> virtio-serial device driver so maybe we don't need to discuss that.
> > >>>>         
> > >>> There certainly is from me.  The userspace interface is not 
> > >>> reasonable  for guest applications to use.
> > >>>     
> > >>
> > >> One example that would readily come to mind is dbus. A daemon running on
> > >> the guest that reads data off the port and interacts with the desktop by
> > >> appropriate dbus commands. All that's needed is a stream of bytes and
> > >> virtio-serial provides just that.
> > >>   
> > >
> > > dbus runs as an unprivileged user, how does dbus know which  
> > > virtio-serial port to open and who sets the permissions on that port?
> > 
> > The permission part can be handled by package maintainers and sysadmins
> > via udev policies.
> > 
> > So all data destined for dbus consumption gets to a daemon and that
> > daemon then sends it over to dbus.
> 
> virtio-serial is nice, easy, simple and versatile.  We like that; it
> should stay that way.
> 
> dbus isn't a good match for this.
> 
> dbus is not intended for communication between hosts, by design.

Oh; I don't mean to say dbus on the host will communicate directly with
dbus on the guest via virtio-serial. I'm just saying there'll be some
daemon on the guest and if there's a request for, say, updating guest
clipboard with some contents, it can be passed on to dbus on the guest.

> It depends on per-app configuration files in
> /etc/dbus/{session,system}.d/, which are expected to match the
> installed services.
> 
> For this, the guest's files in /etc/dbus/ would have to match the QEMU
> host host services in detail.  dbus doesn't have a good mechanism for
> copying with version skew between both of them, because normally
> everything resides on the same machine and the config and service are
> updated at the same time.  This is hard to guarantee with a VM.

Right. Not proposing this at all.

> Apart from dbus, hard-coded meanings of small N in /dev/vmchN are
> asking for trouble.  It is bound to break when widely deployed and

It's no different from the way major-minor numbering works on the Linux
kernel: they uniquely identify a device. Or the way tcp port number
works. In the same way, /dev/vmchN will uniquely identify some function
over a port. You idea of introducing a symlink to /dev/clipboard is a
good one and it takes one udev rule to generate that link.

> guest/host configs don't match.  It also doesn't fit comfortably when
> you have, say, bob and alice both logged in with desktops on separate
> VTs.  Clashes are inevitable, as third-party apps pick N values for
> themselves then get distributed - unless N values can be large
> (/dev/vmch44324 == kernelstats...).

Hm, so there can be one daemon on the guest handling all clipboard
events. There's some work done already by the fast-user-switch support
and that can be extended to daemons that talk over virtio-serial.

> Sysadmins shouldn't have to hand-configure each app, and shouldn't
> have to repair clashes in defaults.  Just Work is better.

No; they shouldn't need to.

> virtio-serial is nice.  The only ugly part is _finding_ the right
> /dev/vmchN.
> 
> Fortunately, _any_ out-of-band id string or id number makes it perfect.
> 
> An option to specify PCI vendor/product ids in the QEMU host
> configuration is good enough.
> 
> An option to specify one or more id strings is nicer.
> 
> Finally, Anthony hit on an interesting idea with USB.  Emulating USB
> sucks.  But USB's _descriptors_ are quite effective, and the USB basic
> protocol is quite reasonable too.
> 
> Descriptors are just a binary blob in a particular format, which
> describe a device and also say what it supports, and what standard
> interfaces can be used with it too.  Bluetooth is similar; they might
> even use the same byte format, I'm not sure.

And doing something similar is akin to populating some files in /sys.

> All the code for parsing USB descriptors is already present in guest
> kernels, and the code for making appropriate device nodes and
> launching apps is already in udev.  libusb also allows devices to be
> used without a kernel driver, and is cross-platform.  There are plenty
> of examples of creating USB descriptors in QEMU, and may be the code
> can be reused.
> 
> The only down side of USB is that emulating it sucks :-)  That's mainly
> due to the host controllers, and the way interrupts use polling.
> 
> So here's a couple of ideas:
> 
>    - virtio-usb, using virtio instead of a hardware USB host
>      controller.  That would provide all the features of USB
>      naturally, like hotplug, device binding, access from userspace,
>      but with high performance, low overhead, and no interrupt polling.

I wonder how that's any different or less complex that virtio-serial.
Essentially the idea is the same. It's just the name that's different,
the way I see it.

>      You'd even have the option of cross-platform guest apps, as well
>      as working on all Linux versions, by emulating a host controller
>      when the guest doesn't have virtio-usb.
> 
>      As a bonus, existing USB support would be accelerated.
> 
>    - virtio-serial providing a binary id blob, whose format is the
>      same as USB descriptors.  Reuse the guest's USB parsing and
>      binding to find and identify, but the actual device functionality
>      would just be a byte pipe.
> 
>      That might be simple, as all it involves is a blob passed to the
>      guest from QEMU.  QEMU would build the id blob, maybe reusing
>      existing USB code, and the guest would parse the blob as it
>      already does for USB devices, with udev creating devices as it
>      already does.

Hm, making a very simple transport into something complicated involving
a few more subsystems just to expose a usb device which functions as a
char device in the end. I don't see a big benefit. People are deploying
virtio anyway for block and net. I don't see why using the same
transport for a char device would be an impediment.

		Amit

  reply	other threads:[~2009-08-07  6:38 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-27 18:04 [Qemu-devel] virtio-serial: An interface for host-guest communication Amit Shah
2009-07-27 18:04 ` [Qemu-devel] [PATCH 1/1] virtio_serial: A char device for simple guest <-> host communication Amit Shah
2009-07-27 18:04   ` [Qemu-devel] [PATCH 1/3] virtio-serial: virtio device for simple host <-> guest communication Amit Shah
2009-07-27 18:04     ` [Qemu-devel] [PATCH 2/3] vnc: add a is_vnc_active() helper Amit Shah
2009-07-27 18:04       ` [Qemu-devel] [PATCH 3/3] virtio-serial: vnc: support for sending / receiving guest clipboard Amit Shah
2009-08-05  0:03   ` [Qemu-devel] Re: [PATCH 1/1] virtio_serial: A char device for simple guest <-> host communication Rusty Russell
2009-08-05  5:12     ` Amit Shah
2009-08-05  9:58     ` Amit Shah
2009-07-27 20:22 ` [Qemu-devel] Re: virtio-serial: An interface for host-guest communication Anthony Liguori
2009-07-27 20:32   ` Daniel P. Berrange
2009-07-27 20:37     ` Anthony Liguori
2009-07-27 20:46     ` Jamie Lokier
2009-07-27 23:44       ` Anthony Liguori
2009-07-28 10:36         ` Amit Shah
     [not found]           ` <4A6F0048.1000103@codemonkey.ws>
2009-07-29  7:44             ` Amit Shah
2009-07-29  7:48               ` Gleb Natapov
2009-08-05 18:00                 ` Jamie Lokier
     [not found]         ` <20090728140029.GA16067@amd.home.annexia.org>
2009-07-28 14:48           ` Anthony Liguori
2009-07-28 14:55             ` Richard W.M. Jones
2009-07-28 15:00               ` Anthony Liguori
2009-08-03 19:57           ` Anthony Liguori
2009-08-05 17:57             ` Jamie Lokier
2009-08-05 18:00               ` Anthony Liguori
2009-08-06 10:38                 ` Amit Shah
2009-08-06 13:29                   ` Anthony Liguori
2009-08-06 13:41                     ` Amit Shah
2009-08-06 13:58                       ` Anthony Liguori
2009-08-06 14:04                         ` Amit Shah
2009-08-06 17:37                           ` Jamie Lokier
2009-08-07  6:38                             ` Amit Shah [this message]
2009-08-07 14:14                               ` Anthony Liguori
2009-08-10  6:55                                 ` Amit Shah
2009-08-10  9:47                                   ` Gerd Hoffmann
2009-08-10 13:02                                     ` Anthony Liguori
2009-08-10 14:02                                       ` Gerd Hoffmann
2009-08-10 14:20                                         ` Anthony Liguori
2009-08-10 15:34                                           ` Gerd Hoffmann
2009-08-10 16:59                                             ` Anthony Liguori
2009-08-10 17:27                                               ` Anthony Liguori
2009-08-12 18:27                                               ` Paul Brook
2009-08-14  8:15                                               ` Amit Shah
2009-08-14 13:29                                                 ` Anthony Liguori
2009-08-14 13:41                                                   ` Amit Shah
2009-08-20 13:42                                                   ` Amit Shah
2009-08-20 14:25                                                     ` Daniel P. Berrange
2009-08-20 14:38                                                       ` Amit Shah
2009-08-20 14:42                                                         ` Amit Shah
2009-08-14 13:49                                                 ` Gerd Hoffmann
2009-08-14 16:25                                                   ` Anthony Liguori
2009-08-20  7:31                                                     ` Rusty Russell
2009-08-20  7:44                                                       ` Gerd Hoffmann
2009-08-20  7:55                                                         ` Amit Shah
2009-08-20 17:10                                                           ` Jamie Lokier
2009-08-25 12:43                                                         ` Rusty Russell
2009-08-25 13:00                                                           ` Gerd Hoffmann
2009-08-10 14:20                                         ` Anthony Liguori
2009-08-10 23:09                                     ` Rusty Russell
2009-08-11  0:16                                       ` Anthony Liguori
2009-08-10 14:27                                   ` Anthony Liguori
2009-08-10 15:57                                     ` Gerd Hoffmann
2009-08-06 10:35               ` Amit Shah
2009-08-05 18:32             ` Richard W.M. Jones

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=20090807063800.GA16769@amit-x200.redhat.com \
    --to=amit.shah@redhat.com \
    --cc=jamie@shareable.org \
    --cc=kvm@vger.kernel.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rjones@redhat.com \
    --cc=rusty@rustcorp.com.au \
    --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).