Skip to contentSkip to conversation

libxl: Introduce functions to add and remove USB devices to an HVM guest

RFC PATCH In review George Dunlap 2 participants 6 messages Apr 8, 2013 – Apr 9, 2013

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 libxl: Introduce functions to add and remove USB devices to an HVM guest

I'm mailing this intermediate form of v3 to get feedback before I go all the way through the process of implementing the whole thing and ironing out the bugs.

THIS IS STILL A PROTOTYPE.

This patch exposes a generic interface which can be expanded in the future to implement USB for PVUSB, qemu, and stubdoms. It can also be extended to include other types of USB other than host USB (for example, tablets, mice, or keyboards).

For each device removed or added, one of three protocols is available:
* PVUSB
* qemu (DEVICEMODEL)
* stubdom (i.e., stubdom -> pvusb, domain -> stubdom qemu)

The caller can additionally specify "AUTO", in which case the library will try to determine the best protocol automatically.

At the moment, the only protocol implemented is DEVICEMODEL, and the only device type impelmented is HOSTDEV.

This uses the qmp functionality, and is thus only available for qemu-xen, not qemu-traditional.

v3 (RFC):
- Complete re-write with new generalized protocol
- Store list of assigned USB devices in xenstore
v2:
- Make interface async-ready
- usb_del takes libxl_device_host_usb struct
- usb_del will re-construct original id given device info if no id is given

---
 tools/libxl/Makefile         |    2 +-
 tools/libxl/libxl.h          |   38 ++++
 tools/libxl/libxl_internal.h |    4 +
 tools/libxl/libxl_qmp.c      |   80 ++++++++
 tools/libxl/libxl_types.idl  |   23 +++
 tools/libxl/libxl_usb.c      |  438 ++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 584 insertions(+), 1 deletion(-)
 create mode 100644 tools/libxl/libxl_usb.c
tools/libxl/Makefile +1 -1
index 2984051..866960a 100644
@@ -74,7 +74,7 @@ LIBXL_OBJS = flexarray.o libxl.o libxl_create.o libxl_dm.o libxl_pci.o \
 			libxl_internal.o libxl_utils.o libxl_uuid.o \
 			libxl_json.o libxl_aoutils.o libxl_numa.o \
 			libxl_save_callout.o _libxl_save_msgs_callout.o \
-			libxl_qmp.o libxl_event.o libxl_fork.o $(LIBXL_OBJS-y)
+			libxl_qmp.o libxl_event.o libxl_fork.o libxl_usb.o $(LIBXL_OBJS-y)
 LIBXL_OBJS += _libxl_types.o libxl_flask.o _libxl_types_internal.o
 
 $(LIBXL_OBJS): CFLAGS += $(CFLAGS_LIBXL) -include $(XEN_ROOT)/tools/config.h
tools/libxl/libxl.h +38 -0
index 030aa86..47dbef4 100644
@@ -75,6 +75,11 @@
 #define LIBXL_HAVE_FIRMWARE_PASSTHROUGH 1
 
 /*
+ * FIXME: Update comment
+ */
+#define LIBXL_HAVE_USB 1
+
+/*
  * libxl ABI compatibility
  *
  * The only guarantee which libxl makes regarding ABI compatibility
@@ -719,6 +724,39 @@ int libxl_cdrom_insert(libxl_ctx *ctx, uint32_t domid, libxl_device_disk *disk,
                        const libxl_asyncop_how *ao_how)
                        LIBXL_EXTERNAL_CALLERS_ONLY;
 
+/*
+ * USB
+ * 
+ * For each device removed or added, one of three protocols is available:
+ * - PVUSB
+ * - qemu (DEVICEMODEL)
+ * - stubdom (i.e., stubdom -> pvusb, domain -> stubdom qemu)
+ *
+ * The caller can additionally specify "AUTO", in which case the library will
+ * try to determine the best protocol automatically.
+ *
+ * At the moment, the only protocol implemented is DEVICEMODEL, and the only
+ * device type impelmented is HOSTDEV.
+ *
+ * This uses the qmp functionality, and is thus only available for
+ * qemu-xen, not qemu-traditional.
+ *
+ */
+#define LIBXL_DEVICE_HOST_USB_ANY (-1)
+#define LIBXL_DEVICE_USB_BACKEND_DEFAULT (-1)
+int libxl_device_usb_add(libxl_ctx *ctx, uint32_t domid,
+                         libxl_device_usb *dev,
+                         const libxl_asyncop_how *ao_how)
+                         LIBXL_EXTERNAL_CALLERS_ONLY;
+int libxl_device_usb_remove(libxl_ctx *ctx, uint32_t domid, 
+                            libxl_device_usb *dev,
+                            const libxl_asyncop_how *ao_how)
+                            LIBXL_EXTERNAL_CALLERS_ONLY;
+int libxl_device_usb_list(libxl_ctx *ctx, uint32_t domid, 
+                          libxl_device_usb **dev,
+                          const libxl_asyncop_how *ao_how)
+                          LIBXL_EXTERNAL_CALLERS_ONLY;
+
 /* Network Interfaces */
 int libxl_device_nic_add(libxl_ctx *ctx, uint32_t domid, libxl_device_nic *nic,
                          const libxl_asyncop_how *ao_how)
tools/libxl/libxl_internal.h +4 -0
index 3ba3a21..15d70ed 100644
@@ -1412,6 +1412,10 @@ _hidden int libxl__qmp_save(libxl__gc *gc, int domid, const char *filename);
 /* Set dirty bitmap logging status */
 _hidden int libxl__qmp_set_global_dirty_log(libxl__gc *gc, int domid, bool enable);
 _hidden int libxl__qmp_insert_cdrom(libxl__gc *gc, int domid, const libxl_device_disk *disk);
+_hidden int libxl__qmp_usb_add(libxl__gc *gc, int domid, 
+                               libxl_device_usb *dev);
+_hidden int libxl__qmp_usb_remove(libxl__gc *gc, int domid, 
+                                  libxl_device_usb *dev);
 /* close and free the QMP handler */
 _hidden void libxl__qmp_close(libxl__qmp_handler *qmp);
 /* remove the socket file, if the file has already been removed,
tools/libxl/libxl_qmp.c +80 -0

92 lines not on this page · raw message

tools/libxl/libxl_types.idl +23 -0
index f3c212b..8d9bae7 100644
@@ -406,6 +406,29 @@ libxl_device_vtpm = Struct("device_vtpm", [
     ("uuid",             libxl_uuid),
 ])
 
+libxl_device_usb_protocol = Enumeration("usb_protocol", [
+    (0, "AUTO"),
+    (1, "PV"),
+    (2, "DEVICEMODEL"),
+    (3, "STUBDOM"),
+    ])
+
+libxl_device_usb_type = Enumeration("device_usb_type", [
+    (1, "HOSTDEV"),
+    ])
+
+libxl_device_usb = Struct("device_usb", [
+        ("protocol", libxl_device_usb_protocol, {'init_val': 'LIBXL_USB_PROTOCOL_AUTO'}),
+        ("backend_domid", libxl_domid, {'init_val': 'LIBXL_DEVICE_USB_BACKEND_DEFAULT'}),
+        ("u", KeyedUnion(None, libxl_device_usb_type, "type",
+                         [("hostdev", Struct(None, [
+                                ("hostbus",   integer, {'init_val': 'LIBXL_DEVICE_HOST_USB_ANY'}),
+                                ("hostaddr",  integer, {'init_val': 'LIBXL_DEVICE_HOST_USB_ANY'}),
+                                ("vendorid",  integer, {'init_val': 'LIBXL_DEVICE_HOST_USB_ANY'}),
+                                ("productid", integer, {'init_val': 'LIBXL_DEVICE_HOST_USB_ANY'}) ]))
+                          ]))
+    ])
+
 libxl_domain_config = Struct("domain_config", [
     ("c_info", libxl_domain_create_info),
     ("b_info", libxl_domain_build_info),
tools/libxl/libxl_usb.c new file +438 -0

438 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#1 lore raw

George Dunlap writes ("[Xen-devel] [PATCH RFC] libxl: Introduce functions to add and remove USB devices to an HVM guest"):

Quoted 3 lines

I'm mailing this intermediate form of v3 to get feedback before I go all the way through the process of implementing the whole thing and ironing out the bugs.

Thanks. The basic approach seems plausible.

Quoted 4 lines

For each device removed or added, one of three protocols is available:
* PVUSB
* qemu (DEVICEMODEL)
* stubdom (i.e., stubdom -> pvusb, domain -> stubdom qemu)

You seem to be making this specifiable separately for each device, which doesn't seem like it could be right.

I think it would be best to make the protocol (as specified in the libxl api, xl config files etc.), simply specify what the guest sees:
PV or HVM. In the case of HVM, that's the stub-dm if the guest has one or qemu in dom0 if not.

tools/libxl/libxl.h int libxl_cdrom_insert(libxl_ctx *ctx, uint32_t domid, libxl_device_disk *disk, · line 750

Quoted 6 lines
tools/libxl/libxl.h +6 -0
+#define LIBXL_DEVICE_HOST_USB_ANY (-1)
+#define LIBXL_DEVICE_USB_BACKEND_DEFAULT (-1)
+int libxl_device_usb_add(libxl_ctx *ctx, uint32_t domid,
+                         libxl_device_usb *dev,
+                         const libxl_asyncop_how *ao_how)
+                         LIBXL_EXTERNAL_CALLERS_ONLY;

What are the semantics if multiple host devices match *dev ? How is the id returned ?

I think dev should probably be
const libxl_device_usb *dev

tools/libxl/libxl_qmp.c int libxl__qmp_insert_cdrom(libxl__gc *gc, int domid, · line 943

Quoted 8 lines
tools/libxl/libxl_qmp.c +8 -0
+    libxl__json_object *args = NULL;
+    char *id;
+
+    id = libxl__sprintf(NOGC, HOST_USB_QDEV_ID,
+                        (uint16_t) dev->u.hostdev.hostbus,
+                        (uint16_t) dev->u.hostdev.hostaddr,
+                        (uint16_t) dev->u.hostdev.vendorid,
+                        (uint16_t) dev->u.hostdev.productid);

If hostbus and hostaddr aren't specified and we pass through multiple devices with the same vendor and product id, this won't yield unique ids.

tools/libxl/libxl_usb.c line 32

Quoted 6 lines
tools/libxl/libxl_usb.c new file +6 -0
+struct enum_str {
+    int min,max;
+    const char * str[];
+};
+
+static char * __enum_to_str(libxl__gc *gc, struct enum_str *e, libxl_usb_protocol t)

(Trailing whitespace, and needs wrapping.)

This is a lot of enum-handling machinery. Don't we have something similar already which could be pressed into service ? If not then this should be in a separate file.

tools/libxl/libxl_usb.c line 57

Quoted 7 lines
tools/libxl/libxl_usb.c new file +7 -0
+struct enum_str enum_protocol = {
+    .min = 1,
+    .max = LIBXL_USB_PROTOCOL_STUBDOM,
+    .str = {
+        [LIBXL_USB_PROTOCOL_PV] = "pv",
+        [LIBXL_USB_PROTOCOL_DEVICEMODEL] = "dm",
+        [LIBXL_USB_PROTOCOL_STUBDOM] = "stubdom",

Perhaps this should be generated by the idl compiler ?

Quoted 1 line

+static char * create_hostdev_xenstore_entry(libxl__gc *gc, uint32_t domid, l

ibxl_device_usb *usbdev, flexarray_t *a)

tools/libxl/libxl_usb.c

Quoted 9 lines
tools/libxl/libxl_usb.c new file +8 -0
+{
+    char * path;
+
+    path = libxl__sprintf(gc, "/libxl/usb/%d/%s",
+                          domid,
+                          libxl__sprintf(gc, USB_HOSTDEV_ID,
+                                        (uint16_t)usbdev->u.hostdev.hostbus,
 
+                                        (uint16_t)usbdev->u.hostdev.hostaddr

,

Quoted 1 line

+ (uint16_t)usbdev->u.hostdev.vendorid

,

Quoted 1 line

+ (uint16_t)usbdev->u.hostdev.producti

d));

I stopped reading here because of the wrap damage I'm afraid. (Reproduced it by adding hard CRs where my MUA wraps it, so you can see what it looks like.)

Ian.

#2 lore raw
Quoted 10 lines · Ian Jackson

George Dunlap writes ("[Xen-devel] [PATCH RFC] libxl: Introduce functions to add and remove USB devices to an HVM guest"):

Quoted 3 lines

I'm mailing this intermediate form of v3 to get feedback before I go all the way through the process of implementing the whole thing and ironing out the bugs.

Thanks. The basic approach seems plausible.

Quoted 4 lines

For each device removed or added, one of three protocols is available:
* PVUSB
* qemu (DEVICEMODEL)
* stubdom (i.e., stubdom -> pvusb, domain -> stubdom qemu)

Quoted 7 lines

You seem to be making this specifiable separately for each device, which doesn't seem like it could be right.

I think it would be best to make the protocol (as specified in the libxl api, xl config files etc.), simply specify what the guest sees:
PV or HVM. In the case of HVM, that's the stub-dm if the guest has one or qemu in dom0 if not.

The dichotomy isn't PV / HVM; it's PVUSB vs qemu (or "devicemodel"). Remember that HVM guests can have PVUSB front-ends, and thus can use the PVUSB protocol.

The reason for specifying STUBDOM I guess is that STUBDOM is really a special case, where it's really both a PVUSB and a DEVICEMODEL; so in theory you could specify a backend_domid.

The question, I guess, is whether we should assume that the caller can be trusted to know whether the VM in question is using a stub domain or not. It's certainly possible to make the interface only specify PVUSB or DEVICEMODEL, and to make it (someday) so that calling DEVICEMODEL for a stubdom will set up PVUSB for the stubdom, then tell the device model to make the device available via emulation all automatically.

But since we're not implementing stubdom at the moment anyway, we can probably just take out STUBDOM entirely and discuss whether to add a new protocol when we actually decide to implement it.

Quoted 8 lines

tools/libxl/libxl.h int libxl_cdrom_insert(libxl_ctx *ctx, uint32_t domid, libxl_device_disk *disk, · line 750

Quoted 6 lines
tools/libxl/libxl.h +6 -0
+#define LIBXL_DEVICE_HOST_USB_ANY (-1)
+#define LIBXL_DEVICE_USB_BACKEND_DEFAULT (-1)
+int libxl_device_usb_add(libxl_ctx *ctx, uint32_t domid,
+                         libxl_device_usb *dev,
+                         const libxl_asyncop_how *ao_how)
+                         LIBXL_EXTERNAL_CALLERS_ONLY;

What are the semantics if multiple host devices match *dev ? How is the id returned ?

I think in general if it matches multiple devices then it should fail. That's what qemu will do, so at the moment that is implemented by default for us.

Quoted 2 lines

I think dev should probably be
const libxl_device_usb *dev

Sure.

Quoted 11 lines

tools/libxl/libxl_qmp.c int libxl__qmp_insert_cdrom(libxl__gc *gc, int domid, · line 943

Quoted 8 lines
tools/libxl/libxl_qmp.c +8 -0
+    libxl__json_object *args = NULL;
+    char *id;
+
+    id = libxl__sprintf(NOGC, HOST_USB_QDEV_ID,
+                        (uint16_t) dev->u.hostdev.hostbus,
+                        (uint16_t) dev->u.hostdev.hostaddr,
+                        (uint16_t) dev->u.hostdev.vendorid,
+                        (uint16_t) dev->u.hostdev.productid);

If hostbus and hostaddr aren't specified and we pass through multiple devices with the same vendor and product id, this won't yield unique ids.

If multiple devices match, then qemu will fail to add the device.

We could do a lot of this checking in the library itself rather than qemu. (In fact for PVUSB I think we're going to have to.) But again, there's no way I'm going to get that coded up by Friday; getting that done would mean waiting until 4.4.

Quoted 12 lines

tools/libxl/libxl_usb.c line 32

Quoted 6 lines
tools/libxl/libxl_usb.c new file +6 -0
+struct enum_str {
+    int min,max;
+    const char * str[];
+};
+
+static char * __enum_to_str(libxl__gc *gc, struct enum_str *e, libxl_usb_protocol t)

(Trailing whitespace, and needs wrapping.)

This is a lot of enum-handling machinery. Don't we have something similar already which could be pressed into service ? If not then this should be in a separate file.

Quoted 8 lines

tools/libxl/libxl_usb.c line 57

Quoted 7 lines
tools/libxl/libxl_usb.c new file +7 -0
+struct enum_str enum_protocol = {
+    .min = 1,
+    .max = LIBXL_USB_PROTOCOL_STUBDOM,
+    .str = {
+        [LIBXL_USB_PROTOCOL_PV] = "pv",
+        [LIBXL_USB_PROTOCOL_DEVICEMODEL] = "dm",
+        [LIBXL_USB_PROTOCOL_STUBDOM] = "stubdom",

Perhaps this should be generated by the idl compiler ?\

I'm not going to be able to make that happen by the feature freeze this Friday.

Perhaps just writing the raw numeric values for now?

Quoted 13 lines
Quoted 3 lines

+static char * create_hostdev_xenstore_entry(libxl__gc *gc, uint32_t domid, l

ibxl_device_usb *usbdev, flexarray_t *a)

tools/libxl/libxl_usb.c

Quoted 8 lines
tools/libxl/libxl_usb.c new file +8 -0
+{
+    char * path;
+
+    path = libxl__sprintf(gc, "/libxl/usb/%d/%s",
+                          domid,
+                          libxl__sprintf(gc, USB_HOSTDEV_ID,
+                                        (uint16_t)usbdev->u.hostdev.hostbus,
+                                        (uint16_t)usbdev->u.hostdev.hostaddr

,

Quoted 8 lines
Quoted 1 line

+ (uint16_t)usbdev->u.hostdev.vendorid

,

Quoted 1 line

+ (uint16_t)usbdev->u.hostdev.producti

d));

I stopped reading here because of the wrap damage I'm afraid. (Reproduced it by adding hard CRs where my MUA wraps it, so you can see what it looks like.)

Well the main purpose of this mail was to see if this could be implemented by Friday, or if it would need to wait until 4.4. We've uncovered a couple of things which if required would mean waiting -- what do you think? I'm fine with waiting -- that's why I sent the e-mail, so I could stop early if there was little chance of success. :-)

-George

#3 lore raw

George Dunlap writes ("Re: [Xen-devel] [PATCH RFC] libxl: Introduce functions to add and remove USB devices to an HVM guest"):

Quoted 3 lines

The reason for specifying STUBDOM I guess is that STUBDOM is really a special case, where it's really both a PVUSB and a DEVICEMODEL; so in theory you could specify a backend_domid.

I think in principle you could specify a backend domid for a non-stub dm too.

Quoted 6 lines

The question, I guess, is whether we should assume that the caller can be trusted to know whether the VM in question is using a stub domain or not. It's certainly possible to make the interface only specify PVUSB or DEVICEMODEL, and to make it (someday) so that calling DEVICEMODEL for a stubdom will set up PVUSB for the stubdom, then tell the device model to make the device available via emulation all automatically.

libxl can tell whether the guest is using a stub-dm.

Quoted 3 lines

But since we're not implementing stubdom at the moment anyway, we can probably just take out STUBDOM entirely and discuss whether to add a new protocol when we actually decide to implement it.

It affects the documentation now, I thinki.

Quoted 6 lines
Quoted 2 lines

What are the semantics if multiple host devices match *dev ? How is the id returned ?

I think in general if it matches multiple devices then it should fail. That's what qemu will do, so at the moment that is implemented by default for us.

This should be documented.

Quoted 4 lines
Quoted 2 lines

I think dev should probably be
const libxl_device_usb *dev

Sure.

You didn't ask my question about ids.

Quoted 3 lines
Quoted 3 lines

This is a lot of enum-handling machinery. Don't we have something similar already which could be pressed into service ? If not then this should be in a separate file.

...

Quoted 6 lines
Quoted 1 line

Perhaps this should be generated by the idl compiler ?\

I'm not going to be able to make that happen by the feature freeze this Friday.

Perhaps just writing the raw numeric values for now?

If it's just needed for xenstore for the toolstack's own consumption then that's fine, as when you upgrade the toolstack you need to upgrade xen and thus migrate away all your domains. Alternatively I think the IDL compiler produces long names which might be useable too.

Quoted 9 lines
Quoted 3 lines

I stopped reading here because of the wrap damage I'm afraid. (Reproduced it by adding hard CRs where my MUA wraps it, so you can see what it looks like.)

Well the main purpose of this mail was to see if this could be implemented by Friday, or if it would need to wait until 4.4. We've uncovered a couple of things which if required would mean waiting -- what do you think? I'm fine with waiting -- that's why I sent the e-mail, so I could stop early if there was little chance of success. :-)

I don't think my questions need to be answered in a way that means we have to wait, so long as we have a route to improving things later.

Ian.

#4 lore raw
Quoted 6 lines · Ian Jackson

George Dunlap writes ("Re: [Xen-devel] [PATCH RFC] libxl: Introduce functions to add and remove USB devices to an HVM guest"):

Quoted 3 lines

The reason for specifying STUBDOM I guess is that STUBDOM is really a special case, where it's really both a PVUSB and a DEVICEMODEL; so in theory you could specify a backend_domid.

I think in principle you could specify a backend domid for a non-stub dm too.

How is that supposed to work?

Quoted 7 lines
Quoted 6 lines

The question, I guess, is whether we should assume that the caller can be trusted to know whether the VM in question is using a stub domain or not. It's certainly possible to make the interface only specify PVUSB or DEVICEMODEL, and to make it (someday) so that calling DEVICEMODEL for a stubdom will set up PVUSB for the stubdom, then tell the device model to make the device available via emulation all automatically.

libxl can tell whether the guest is using a stub-dm.

Yes, but the question is about all the extra random plumbing that libxl would be doing, and the extra codepaths that will be in use, and whether doing all that automatically is really a good interface or not.

For example, most distro kernels (apparently) have buggy PVUSB back-ends; possibly stubdoms have buggy PVUSB front-ends. Now suppose that a user is using HVM domains without stubdoms, and is used to (without thinking) just adding in USB devices via qemu. And then suppose that he decides he wants security / scalability / whatever, and implements stubdoms. But he doesn't realize the implications; so the next time he happens to pass in a device, it suddenly starts using the buggy PVUSB path, and hilarity ensues. Perhaps someday we even unify the config file and the hot-plug USB stuff, like it's unified for pci devices; and the user just forgets that he has devices passed through specified, and hilarity ensues without his even taking an active step to cause it.

I agree that we should in general honor the principle of "Ask what the caller/user is trying to do, not the technical details of how to do it". But I think we should also honor the "Principle of least surprise", and I'm afraid that we may not be able to honor both fully in this case. The question is which one can we fudge while causing the least damage.

Quoted 4 lines
Quoted 3 lines

But since we're not implementing stubdom at the moment anyway, we can probably just take out STUBDOM entirely and discuss whether to add a new protocol when we actually decide to implement it.

It affects the documentation now, I thinki.

Can we not just say that only HVM domains without stub domains are supported? And then later either change the documentation to say, "stub domains are supported automatically" or to say "stub domains require a different protocol" (whichever we end up deciding)?

Quoted 7 lines
Quoted 6 lines
Quoted 3 lines

What are the semantics if multiple host devices match *dev ? How is the id returned ?

I think in general if it matches multiple devices then it should fail. That's what qemu will do, so at the moment that is implemented by default for us.

This should be documented.

Ack.

Quoted 5 lines
Quoted 4 lines
Quoted 3 lines

I think dev should probably be
const libxl_device_usb *dev

Sure.

You didn't ask my question about ids.

I looked at the other interfaces, and they seem to just use a re-specification of the same parameters to specify the same device. (IOW I took out the whole "device handle" thing.)

One thing we could do is just get rid of the "vendorid:productid" thing entirely, at least for now. hostbus.hostaddr is unique, it's just potentially a bit less convenient if the topology tends to change across reboots / sessions (e.g., plugging in your device into a different port). That would make it much more like pci devices, which are specified uniquely with domain:bus:device.function.

We could then consider adding "vendorid:productid" as a properly-supported interface for either PVUSB or DEVICEMODEL at some point in the future -- i.e., have libxl look it up, check that it's unique, and translate it into hostbus.hostaddr.

Quoted 6 lines
Quoted 4 lines
Quoted 4 lines

This is a lot of enum-handling machinery. Don't we have something similar already which could be pressed into service ? If not then this should be in a separate file.

...

Quoted 1 line
Quoted 1 line

Perhaps this should be generated by the idl compiler ?\

Quoted 8 lines
Quoted 4 lines

I'm not going to be able to make that happen by the feature freeze this Friday.

Perhaps just writing the raw numeric values for now?

If it's just needed for xenstore for the toolstack's own consumption then that's fine, as when you upgrade the toolstack you need to upgrade xen and thus migrate away all your domains. Alternatively I think the IDL compiler produces long names which might be useable too.

OK, I'll take a look.

Quoted 13 lines
Quoted 9 lines
Quoted 4 lines

I stopped reading here because of the wrap damage I'm afraid. (Reproduced it by adding hard CRs where my MUA wraps it, so you can see what it looks like.)

Well the main purpose of this mail was to see if this could be implemented by Friday, or if it would need to wait until 4.4. We've uncovered a couple of things which if required would mean waiting -- what do you think? I'm fine with waiting -- that's why I sent the e-mail, so I could stop early if there was little chance of success. :-)

I don't think my questions need to be answered in a way that means we have to wait, so long as we have a route to improving things later.

Ian.

#5 lore raw

George Dunlap writes ("Re: [Xen-devel] [PATCH RFC] libxl: Introduce functions to add and remove USB devices to an HVM guest"):

Quoted 5 lines · Ian Jackson
Quoted 2 lines

I think in principle you could specify a backend domid for a non-stub dm too.

How is that supposed to work?

It would set up a PV frontend in qemu in dom0. I think this is a bit silly because it's hard to see why you'd want to but it's not an inherently absurd configuration. I'm not saying this should be implemented, but it demonstrates that things are more orthogonal than they seem.

Quoted 5 lines
Quoted 1 line

libxl can tell whether the guest is using a stub-dm.

Yes, but the question is about all the extra random plumbing that libxl would be doing, and the extra codepaths that will be in use, and whether doing all that automatically is really a good interface or not.

I think it is. It's what happens when you ask for emulated block or network devices in the stubdom case. I don't see how USB is different.

Quoted 2 lines

For example, most distro kernels (apparently) have buggy PVUSB back-ends; possibly stubdoms have buggy PVUSB front-ends.

stubdoms are part of the Xen support infrastructure. If they have buggy front-ends we should fix them. We don't have a compatibility guarantee to uphold.

Quoted 5 lines

And then suppose that he decides he wants security / scalability / whatever, and implements stubdoms. But he doesn't realize the implications; so the next time he happens to pass in a device, it suddenly starts using the buggy PVUSB path, and hilarity ensues.

This is no different with s/USB/block/.

Quoted 4 lines

We could then consider adding "vendorid:productid" as a properly-supported interface for either PVUSB or DEVICEMODEL at some point in the future -- i.e., have libxl look it up, check that it's unique, and translate it into hostbus.hostaddr.

Well you might want something more automatic.

I guess the question now is whether to include vid:pid in the API. Maybe that would be in a device spec struct form introduced later.

It occurs to me to wonder whether one might want to pass through "any and all devices with this vid:pid".

Ian.