[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] RFC: xl and HVM usb devices



I've been looking into implementing functions to xl to allow
hot-plugging of USB devices into HVM domains, similar to the usb-add
and usb-del xm commands, and have run into a bit of a puzzle, to which
I'd like to have some other opinions.  (Or perhaps, just writing this
e-mail will help me sort things out.)

So to begin with, here is what I've found.

* xm has two sets of commands which look similar but which are
actually completely different. usb-add and usb-del are for HVM
domains, and talk to qemu; usb-attach, usb-detach, usb-list,
usb-list-assignable-devices, usb-hc-create, and usb-hc-destroy all
have to do with PVUSB.

* The xm commands and the xm configuration file (which xl now copies)
seem to be basically clones of the old-style qemu USB specification:
The strings in the configuration file is passed in directly on the
qemu command-line after "-usbdevice", and the strings in usb-add and
usb-del are passed directly to the monitor of qemu.

* There doesn't seem to be a way in xm to list the USB devices
currently enabled in a VM via qemu.

* This old-style usb format is deprecated; it is recommended to use
the new "qdev" format now, which unifies all different devices under
the "-device" argument.  The old-style formats are still supported on
the command-line, and via the monitor, but not via qmp.  I'm not sure
how long the old-style argument will be supported on the command-line,
but it seems reasonable to suppose that someday they will go away.  (A
summary of the qdev format can be found in the qemu source tree, under
docs/qdev-device-use.txt .)

* At the moment, xl uses the old-style arguments for USB even on
qemu-xen.  However, for qemu-xen, it meant to only use qmp.

* The monitor-style has a command, "info usb", which can be used to
list USB devices.  In qmp, there does not at the moment seem to be a
way to list USB devices, even as part of a more generic list.  For
example, "query-pci" will list all PCI devices, but there is no
"query-usb", or "query-devices".

* It appears that removal of devices in qmp must be done by "id".  It
appears that the only way a device can get an "id" is for one to be
assigned when it is created by device_add; devices created without an
id simply don't have an id (and I'm presuming can therefore not be
removed).  (I could be wrong about this.)

All of this leaves me a bit wondering what the best thing is to do,
especially given the looming feature freeze.

Long term it seems like making sense out of doing USB stuff with qemu
and with PVUSB needs to be sorted out in a better fashion.  It also
seems like it would make sense to expose more of the qdev
functionality: with the qdev specification you can do things like
attach fake USB drives and all kinds of interesting things.  On the
other hand, such a qdev-based interface could likely not be used with
qemu-traditional, which I don't think we want to completely deprecate
just yet.

I also think that a proper interface includes not only adding, but
removing and listing what is already there.  That could be implemented
at the moment by storing the keys in xenstore or something, but that
seems fairly fragile -- it seems like it would be better to ask qemu
what devices it thinks it has.  But that would involve yet another
level of complication.

None of the big ideas above seem do-able before the feature freeze.
It would be easy to hack up a basic hvm-usb-add, and probably not too
much work to implement a xenstore-based hvm-usb-del; but then are we
stuck with those interfaces indefinitely?  The xl commands are perhaps
less important than the libxl interface that we choose to expose.

So the questions are:

* Whatever we do, do we do it for 4.3 or put it off until 4.4?

* How important is it to do both qemu-xen and qemu-traditional?

* Do we use the old-style device specification for usb-add and usb-del
on the xl command-line, and translate it into qdev?  Or try to come up
with something closer to the qdev model (and back-translate it to the
old model if we are doing something for qemu-traditional)?

* If we try to do something for 4.3, should we just do usb-add?  Or
usb-add and usb-del?  Or try to implement usb-add, usb-del, and
usb-list?

* What kind of naming convention should we use? Using "hvm_usb_add"
and "pv_usb_add" comes to mind; I'm not entirely satisfied with that,
but other options seem less appealing.

I'm sort of wavering between just about all of these options, so any
input would be welcome. :-)

 -George

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.