All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: Amit Shah <amit.shah@redhat.com>
Cc: Anthony Liguori <anthony@codemonkey.ws>,
	kvm@vger.kernel.org, qemu-devel@nongnu.org,
	Rusty Russell <rusty@rustcorp.com.au>,
	"Richard W.M. Jones" <rjones@redhat.com>,
	virtualization@lists.linux-foundation.org
Subject: Re: [Qemu-devel] Re: virtio-serial: An interface for host-guest	communication
Date: Mon, 10 Aug 2009 11:47:54 +0200	[thread overview]
Message-ID: <4A7FECCA.8080804@redhat.com> (raw)
In-Reply-To: <20090810065508.GA4499@amit-x200.redhat.com>

On 08/10/09 08:55, Amit Shah wrote:
>> Bad example.  Quite a lot of modern devices drivers are using dynamic
>> major/minor numbers because they have proven to be such a pain in the
>> butt.  That's why we have more sophisticated mechanisms like udev for
>> userspace to make use of.
>
> Let me explain how we came to this numbering: we first had support for
> 'naming' ports and the names were obtained by userspace programs by an
> ioctl. Rusty suggested to use some numbering scheme where some ports
> could exist at predefined locations so that we wouldn't need the naming
> and the ioctls around it.

I think the naming is very important.  The guest needs to know who is 
listening on the other end of the line.  I think a sysfs attribute (as 
suggested by Jamie IIRC) will work nicely here.  So each device gets a 
property called 'class' or 'protocol' or something simliar named, 
therein a string which specifies the protocol it speaks.


Host side would look like this:

   -virtioserial port=4,protocol=clipboard

... in case the protocol is implemented in qemu or like this:

   -virtioserial port=2,protocol=libguestfs,char=unix:something

... for stuff provided by external apps.


Within the guest the two lines above would create vmch4 and vmch2, both 
having a protocol attribute, and udev then can create symlinks named by 
protocol, i.e.

   /dev/vmchannel/clipboard  symlinked to /dev/vmch4    and
   /dev/vmchannel/libguestfs symlinked to /dev/vmch2

The port=<nr> attribute can be optional and dynamically auto-allocated 
by default.


>> So for instance, I could have an "com.ibm.my-awesome-channel" and never
>> have to worry about conflicts.

reverse fqdn name space is a good idea.  We don't need a central 
protocol name registry then.  The examples above would then become 
something like this:

   protocol=orq.qemu.clipboard    and
   protocol=org.libguestfs.fish

... and within the guest

   /dev/vmchannel/org/qemu/clipboard  and
   /dev/vmchannel/org/libguestfs/fish


> There are some other problems with usb too: It's not transparent to
> users. Any hotplug event could alert users and that's not desired. It's
> a system-only thing and should also remain that way.

I think virtio-serial is the better way to handle vmchannel.  Unlike usb 
virtio is designed to work nicely in a virtual environment.

But vmchannel-over-usbserial should be easy too though in case some 
guests lacks virtio backports or something.  I think you can just stick 
a name like "vmchannel:orq.qemu.clipboard" into the usbserial product 
name, then have udev match that and create
   /dev/vmchannel/org/qemu/clipboard symlinking to /dev/ttyUSB<nr>

Voila, you can switch transports and the apps don't even notice.

cheers,
   Gerd

WARNING: multiple messages have this Message-ID (diff)
From: Gerd Hoffmann <kraxel@redhat.com>
To: Amit Shah <amit.shah@redhat.com>
Cc: kvm@vger.kernel.org, qemu-devel@nongnu.org,
	Rusty Russell <rusty@rustcorp.com.au>,
	"Richard W.M. Jones" <rjones@redhat.com>,
	virtualization@lists.linux-foundation.org
Subject: Re: [Qemu-devel] Re: virtio-serial: An interface for host-guest	communication
Date: Mon, 10 Aug 2009 11:47:54 +0200	[thread overview]
Message-ID: <4A7FECCA.8080804@redhat.com> (raw)
In-Reply-To: <20090810065508.GA4499@amit-x200.redhat.com>

On 08/10/09 08:55, Amit Shah wrote:
>> Bad example.  Quite a lot of modern devices drivers are using dynamic
>> major/minor numbers because they have proven to be such a pain in the
>> butt.  That's why we have more sophisticated mechanisms like udev for
>> userspace to make use of.
>
> Let me explain how we came to this numbering: we first had support for
> 'naming' ports and the names were obtained by userspace programs by an
> ioctl. Rusty suggested to use some numbering scheme where some ports
> could exist at predefined locations so that we wouldn't need the naming
> and the ioctls around it.

I think the naming is very important.  The guest needs to know who is 
listening on the other end of the line.  I think a sysfs attribute (as 
suggested by Jamie IIRC) will work nicely here.  So each device gets a 
property called 'class' or 'protocol' or something simliar named, 
therein a string which specifies the protocol it speaks.


Host side would look like this:

   -virtioserial port=4,protocol=clipboard

... in case the protocol is implemented in qemu or like this:

   -virtioserial port=2,protocol=libguestfs,char=unix:something

... for stuff provided by external apps.


Within the guest the two lines above would create vmch4 and vmch2, both 
having a protocol attribute, and udev then can create symlinks named by 
protocol, i.e.

   /dev/vmchannel/clipboard  symlinked to /dev/vmch4    and
   /dev/vmchannel/libguestfs symlinked to /dev/vmch2

The port=<nr> attribute can be optional and dynamically auto-allocated 
by default.


>> So for instance, I could have an "com.ibm.my-awesome-channel" and never
>> have to worry about conflicts.

reverse fqdn name space is a good idea.  We don't need a central 
protocol name registry then.  The examples above would then become 
something like this:

   protocol=orq.qemu.clipboard    and
   protocol=org.libguestfs.fish

... and within the guest

   /dev/vmchannel/org/qemu/clipboard  and
   /dev/vmchannel/org/libguestfs/fish


> There are some other problems with usb too: It's not transparent to
> users. Any hotplug event could alert users and that's not desired. It's
> a system-only thing and should also remain that way.

I think virtio-serial is the better way to handle vmchannel.  Unlike usb 
virtio is designed to work nicely in a virtual environment.

But vmchannel-over-usbserial should be easy too though in case some 
guests lacks virtio backports or something.  I think you can just stick 
a name like "vmchannel:orq.qemu.clipboard" into the usbserial product 
name, then have udev match that and create
   /dev/vmchannel/org/qemu/clipboard symlinking to /dev/ttyUSB<nr>

Voila, you can switch transports and the apps don't even notice.

cheers,
   Gerd

  reply	other threads:[~2009-08-10  9:48 UTC|newest]

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

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=4A7FECCA.8080804@redhat.com \
    --to=kraxel@redhat.com \
    --cc=amit.shah@redhat.com \
    --cc=anthony@codemonkey.ws \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.