libxl: add support for qemu base pvusb backend
cover libxl: add support for qemu base pvusb backend
This patch series is meant to be applied on top of Chunyan's series to support pvusb in libxl.
It is adding support for an alternative pvusb backend "qusb" via qemu.
Juergen Gross (3):
libxl: make libxl__need_xenpv_qemu() operate on domain config
libxl: add domain config parameter to force start of qemu
libxl: add new pvusb backend "qusb" provided by qemu
docs/man/xl.cfg.pod.5 | 17 +++++- tools/libxl/libxl_create.c | 10 +--- tools/libxl/libxl_device.c | 3 +- tools/libxl/libxl_dm.c | 66 +++++++++-------------- tools/libxl/libxl_internal.h | 6 +-- tools/libxl/libxl_pvusb.c | 102 +++++++++++++++++++++++++++-------- tools/libxl/libxl_types.idl | 2 + tools/libxl/libxl_types_internal.idl | 1 + tools/libxl/xl_cmdimpl.c | 3 ++ 9 files changed, 132 insertions(+), 78 deletions(-)
Signature · 7 lines
2.6.2 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
PATCH 1/3 libxl: make libxl__need_xenpv_qemu() operate on domain config
libxl__need_xenpv_qemu() is called with configuration data for console, vfbs, disks and channels today in order to evaluate the need for starting a device model for a pv domain.
The console data is local to the caller and setup in a way to never require a device model. All other data is taken from the domain config structure.
In order to support other device backends via qemu change the interface of libxl__need_xenpv_qemu() to take the domain config structure as input instead of the single device arrays.
--- tools/libxl/libxl_create.c | 9 +------ tools/libxl/libxl_dm.c | 59 ++++++++++++-------------------------------- tools/libxl/libxl_internal.h | 5 +--- 3 files changed, 18 insertions(+), 55 deletions(-)
tools/libxl/libxl_create.c +1 -8
@@ -1304,7 +1304,6 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev, }case LIBXL_DOMAIN_TYPE_PV : { -int need_qemu =0 ;libxl__device_console console;libxl__device device;
@@ -1314,17 +1313,11 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev, }init_console_info (gc, &console,0 ); - - need_qemu =libxl__need_xenpv_qemu (gc,1 , &console, - d_config->num_vfbs, d_config->vfbs, - d_config->num_disks, &d_config->disks[0 ], - d_config->num_channels, &d_config->channels[0 ]); - console.backend_domid = state->console_domid;libxl__device_console_add (gc, domid, &console, state, &device);libxl__device_console_dispose (&console); -if (need_qemu) { +if (libxl__need_xenpv_qemu (gc, d_config)) { dcs->dmss.dm.guest_domid = domid;libxl__spawn_local_dm (egc, &dcs->dmss.dm);return ;
tools/libxl/libxl_dm.c +16 -43
77 lines not on this page · raw message
tools/libxl/libxl_internal.h +1 -4
@@ -1616,10 +1616,7 @@ _hidden int libxl__domain_build(libxl__gc *gc, _hidden const char *libxl__domain_device_model(libxl__gc *gc,const libxl_domain_build_info *info); _hidden int libxl__need_xenpv_qemu(libxl__gc *gc, -int nr_consoles,libxl__device_console *consoles, -int nr_vfbs,libxl_device_vfb *vfbs, -int nr_disks,libxl_device_disk *disks, -int nr_channels,libxl_device_channel *channels); +libxl_domain_config *d_config);/* * This function will fix reserved device memory conflict
Signature · 7 lines
2.6.2 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Re: [PATCH 1/3] libxl: make libxl__need_xenpv_qemu() operate on domain config
Quoted 68 lines · Juergen Gross
libxl__need_xenpv_qemu()is called with configuration data for console, vfbs, disks and channels today in order to evaluate the need for starting a device model for a pv domain.The console data is local to the caller and setup in a way to never require a device model. All other data is taken from the domain config structure.
In order to support other device backends via qemu change the interface of
libxl__need_xenpv_qemu()to take the domain config structure as input instead of the single device arrays.Signed-off-by Juergen Gross <[email protected]>--- tools/libxl/libxl_create.c | 9 +------ tools/libxl/libxl_dm.c | 59 ++++++++++++-------------------------------- tools/libxl/libxl_internal.h | 5 +--- 3 files changed, 18 insertions(+), 55 deletions(-)tools/libxl/libxl_create.c +1
-8@@ -1304,7 +1304,6 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev, }case LIBXL_DOMAIN_TYPE_PV : { -int need_qemu =0 ;libxl__device_console console;libxl__device device;@@ -1314,17 +1313,11 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev, }init_console_info (gc, &console,0 ); - - need_qemu =libxl__need_xenpv_qemu (gc,1 , &console, - d_config->num_vfbs, d_config->vfbs, - d_config->num_disks, &d_config->disks[0 ], - d_config->num_channels, &d_config->channels[0 ]); - console.backend_domid = state->console_domid;libxl__device_console_add (gc, domid, &console, state, &device);libxl__device_console_dispose (&console); -if (need_qemu) { +if (libxl__need_xenpv_qemu (gc, d_config)) { dcs->dmss.dm.guest_domid = domid;libxl__spawn_local_dm (egc, &dcs->dmss.dm);return ;tools/libxl/libxl_dm.c +2
-6@@ -2107,61 +2107,34 @@ int libxl__destroy_device_model(libxl__gc *gc, uint32_t domid) GCSPRINTF("/local/domain/%d/image/device-model-pid", domid)); } -int libxl__need_xenpv_qemu (libxl__gc *gc, -int nr_consoles,libxl__device_console *consoles, -int nr_vfbs,libxl_device_vfb *vfbs, -int nr_disks,libxl_device_disk *disks, -int nr_channels,libxl_device_channel *channels) +int libxl__need_xenpv_qemu (libxl__gc *gc,libxl_domain_config *d_config) { -int i, ret =0 ; +int i, ret;uint32_t domid;
tools/libxl/libxl_dm.c int libxl__destroy_device_model(libxl__gc *gc, uint32_t domid) · line 2116
Quoted 10 lines
tools/libxl/libxl_dm.c +2
-7-/* -* qemu is required in order to support 2 or more consoles. So switch all -* backends to qemu if this is the case -*/ -if (nr_consoles >1 ) { -for (i =0 ; i < nr_consoles; i++) - consoles[i].consback =LIBXL__CONSOLE_BACKEND_IOEMU ; + ret =libxl__get_domid (gc, &domid); +if (ret) goto out;
Doesn't this mean that if libxl__get_domid() fails, libxl__need_xenpv_qemu() will effectively return "true"?
I realize this is a bug in the existing code but there's no need to be bug-for-bug compatible here. :-)
Maybe add an 'rc' variable, and make this:
rc = libxl__get_domid();
if(rc) goto out;
Other than that, looks good to me.
-George
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH 1/3] libxl: make libxl__need_xenpv_qemu() operate on domain config
Quoted 83 lines · George Dunlap
Quoted 68 lines · Juergen Gross
libxl__need_xenpv_qemu()is called with configuration data for console, vfbs, disks and channels today in order to evaluate the need for starting a device model for a pv domain.The console data is local to the caller and setup in a way to never require a device model. All other data is taken from the domain config structure.
In order to support other device backends via qemu change the interface of
libxl__need_xenpv_qemu()to take the domain config structure as input instead of the single device arrays.Signed-off-by Juergen Gross <[email protected]>--- tools/libxl/libxl_create.c | 9 +------ tools/libxl/libxl_dm.c | 59 ++++++++++++-------------------------------- tools/libxl/libxl_internal.h | 5 +--- 3 files changed, 18 insertions(+), 55 deletions(-)tools/libxl/libxl_create.c +1
-8@@ -1304,7 +1304,6 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev, }case LIBXL_DOMAIN_TYPE_PV : { -int need_qemu =0 ;libxl__device_console console;libxl__device device;@@ -1314,17 +1313,11 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev, }init_console_info (gc, &console,0 ); - - need_qemu =libxl__need_xenpv_qemu (gc,1 , &console, - d_config->num_vfbs, d_config->vfbs, - d_config->num_disks, &d_config->disks[0 ], - d_config->num_channels, &d_config->channels[0 ]); - console.backend_domid = state->console_domid;libxl__device_console_add (gc, domid, &console, state, &device);libxl__device_console_dispose (&console); -if (need_qemu) { +if (libxl__need_xenpv_qemu (gc, d_config)) { dcs->dmss.dm.guest_domid = domid;libxl__spawn_local_dm (egc, &dcs->dmss.dm);return ;tools/libxl/libxl_dm.c +2
-6@@ -2107,61 +2107,34 @@ int libxl__destroy_device_model(libxl__gc *gc, uint32_t domid) GCSPRINTF("/local/domain/%d/image/device-model-pid", domid)); } -int libxl__need_xenpv_qemu (libxl__gc *gc, -int nr_consoles,libxl__device_console *consoles, -int nr_vfbs,libxl_device_vfb *vfbs, -int nr_disks,libxl_device_disk *disks, -int nr_channels,libxl_device_channel *channels) +int libxl__need_xenpv_qemu (libxl__gc *gc,libxl_domain_config *d_config) { -int i, ret =0 ; +int i, ret;uint32_t domid;tools/libxl/libxl_dm.c int libxl__destroy_device_model(libxl__gc *gc, uint32_t domid) · line 2116
Quoted 10 lines
tools/libxl/libxl_dm.c +2
-7-/* -* qemu is required in order to support 2 or more consoles. So switch all -* backends to qemu if this is the case -*/ -if (nr_consoles >1 ) { -for (i =0 ; i < nr_consoles; i++) - consoles[i].consback =LIBXL__CONSOLE_BACKEND_IOEMU ; + ret =libxl__get_domid (gc, &domid); +if (ret) goto out;Doesn't this mean that if
libxl__get_domid()fails,libxl__need_xenpv_qemu()will effectively return "true"?
Quoted 7 lines
I realize this is a bug in the existing code but there's no need to be bug-for-bug compatible here. :-)
Maybe add an 'rc' variable, and make this:
rc =
libxl__get_domid();
if(rc) goto out;
Okay, will do (next week).
Quoted 2 lines
Other than that, looks good to me.
Thanks,
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
PATCH 2/3 libxl: add domain config parameter to force start of qemu
In reply to Juergen GrossToday the device model (qemu) is started for a pv domain only in case a device requiring qemu is specified in the domain configuration (qdisk, vfb, channel). If there is no such device the device model isn't started and hence it is possible to add such a device to the domain later.
Add a domain configuration parameter to specify the device model is to be started in any case. This will enable adding devices with a qemu based backend later.
While the optimal solution would be to start the device model automatically when needed this would require some major rework of libxl at multiple places.
--- docs/man/xl.cfg.pod.5 | 6 ++++++ tools/libxl/libxl_create.c | 1 + tools/libxl/libxl_dm.c | 5 +++++ tools/libxl/libxl_types.idl | 1 + tools/libxl/xl_cmdimpl.c | 3 +++ 5 files changed, 16 insertions(+)
docs/man/xl.cfg.pod.5 +6 -0
@@ -1939,6 +1939,12 @@ xen-qemudepriv-domid$domid or xen-qemudepriv-shared or root. Please note that running QEMU as non-root causes migration and PCI passthrough not to work properly. +=item B<device_model_always=BOOLEAN> + +If true, start the device model for paravirtualized domains even if this isn't +required according to the configured devices. This allows to add such devices +later when the domain is already running. + =back =head2 Keymaps
tools/libxl/libxl_create.c +1 -0
@@ -73,6 +73,7 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,return ERROR_INVAL ; } +libxl_defbool_setdefault (&b_info->device_model_always, false);libxl_defbool_setdefault (&b_info->device_model_stubdomain, false); if (libxl_defbool_val(b_info->device_model_stubdomain) &&
tools/libxl/libxl_dm.c +5 -0
@@ -2115,6 +2115,11 @@ int libxl__need_xenpv_qemu(libxl__gc *gc, libxl_domain_config *d_config) ret =libxl__get_domid (gc, &domid);if (ret) goto out; +if (libxl_defbool_val (d_config->b_info.device_model_always)) { + ret =1 ; + goto out; + } +if (d_config->num_vfbs >0 ) { ret =1 ; goto out;
tools/libxl/libxl_types.idl +1 -0
@@ -450,6 +450,7 @@ libxl_domain_build_info = Struct("domain_build_info",[ ("device_model_ssidref", uint32), ("device_model_ssid_label", string), ("device_model_user", string), + ("device_model_always", libxl_defbool), # extra parameters pass directly to qemu, NULL terminated ("extra", libxl_string_list),
tools/libxl/xl_cmdimpl.c +3 -0
@@ -2269,6 +2269,9 @@ skip_usbdev: }/* parse device model arguments, this works for pv, hvm and stubdom */ +xlu_cfg_get_defbool (config,"device_model_always" , + &b_info->device_model_always,0 ); +if (!xlu_cfg_get_string (config,"device_model" , &buf,0 )) {fprintf (stderr, "WARNING: ignoring device_model directive.\n"
Signature · 7 lines
2.6.2 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Re: [PATCH 2/3] libxl: add domain config parameter to force start of qemu
Quoted 10 lines · Juergen Gross
Today the device model (qemu) is started for a pv domain only in case a device requiring qemu is specified in the domain configuration (qdisk, vfb, channel). If there is no such device the device model isn't started and hence it is possible to add such a device to the domain later.
Add a domain configuration parameter to specify the device model is to be started in any case. This will enable adding devices with a qemu based backend later.
Quoted 5 lines
While the optimal solution would be to start the device model automatically when needed this would require some major rework of libxl at multiple places.
Signed-off-by Juergen Gross <[email protected]>
So wait -- what happens now if you try to attach a disk with a qdisk backend to a PV guest that didn't start with qemu running?
I'd really like to see patch 3 get in, but I'm not really in favor of this sort of a user-visible hack, particularly as we have to support it in libxl more or less indefinitely.
-George
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH 2/3] libxl: add domain config parameter to force start of qemu
Quoted 11 lines · George Dunlap
Quoted 10 lines · Juergen Gross
Today the device model (qemu) is started for a pv domain only in case a device requiring qemu is specified in the domain configuration (qdisk, vfb, channel). If there is no such device the device model isn't started and hence it is possible to add such a device to the domain later.
Add a domain configuration parameter to specify the device model is to be started in any case. This will enable adding devices with a qemu based backend later.
Quoted 8 lines
Quoted 5 lines
While the optimal solution would be to start the device model automatically when needed this would require some major rework of libxl at multiple places.
Signed-off-by Juergen Gross <[email protected]>So wait -- what happens now if you try to attach a disk with a qdisk backend to a PV guest that didn't start with qemu running?
It won't work (that was my test case for the patch).
Quoted 3 lines
I'd really like to see patch 3 get in, but I'm not really in favor of this sort of a user-visible hack, particularly as we have to support it in libxl more or less indefinitely.
Hmm, really? We can add a smarter variant later which will start the device model in case it isn't started yet. Then the new config parameter could be just ignored.
I didn't do the smart variant as I'm not sure I could set it up in time for 4.7. I'd be happy to do it with some assistance regarding the async framework of libxl I'm not at all familiar with.
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH 2/3] libxl: add domain config parameter to force start of qemu
Quoted 23 lines · Juergen Gross
Quoted 11 lines · George Dunlap
Quoted 10 lines · Juergen Gross
Today the device model (qemu) is started for a pv domain only in case a device requiring qemu is specified in the domain configuration (qdisk, vfb, channel). If there is no such device the device model isn't started and hence it is possible to add such a device to the domain later.
Add a domain configuration parameter to specify the device model is to be started in any case. This will enable adding devices with a qemu based backend later.
Quoted 8 lines
Quoted 5 lines
While the optimal solution would be to start the device model automatically when needed this would require some major rework of libxl at multiple places.
Signed-off-by Juergen Gross <[email protected]>So wait -- what happens now if you try to attach a disk with a qdisk backend to a PV guest that didn't start with qemu running?
It won't work (that was my test case for the patch).
Quoted 7 lines
Quoted 3 lines
I'd really like to see patch 3 get in, but I'm not really in favor of this sort of a user-visible hack, particularly as we have to support it in libxl more or less indefinitely.
Hmm, really? We can add a smarter variant later which will start the device model in case it isn't started yet. Then the new config parameter could be just ignored.
Sure; but it will (probably) only actually be useful for one release cycle (now 6 months), and then it will sit around cluttering up the interface for years to come. The situation wrt hotplug has been this way for years now, and nobody has complained; I don't think an extra 6 months will be a big deal.
Ultimately it's the tools maintainers' call; I wouldn't argue against it if one of them think it's a good idea.
Quoted 3 lines
I didn't do the smart variant as I'm not sure I could set it up in time for 4.7. I'd be happy to do it with some assistance regarding the async framework of libxl I'm not at all familiar with.
I'm sure help could be arranged; but it might be difficult to do by 4.7.
-George
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH 2/3] libxl: add domain config parameter to force start of qemu
Quoted 38 lines · George Dunlap
Quoted 23 lines · Juergen Gross
Quoted 11 lines · George Dunlap
Quoted 10 lines · Juergen Gross
Today the device model (qemu) is started for a pv domain only in case a device requiring qemu is specified in the domain configuration (qdisk, vfb, channel). If there is no such device the device model isn't started and hence it is possible to add such a device to the domain later.
Add a domain configuration parameter to specify the device model is to be started in any case. This will enable adding devices with a qemu based backend later.
Quoted 8 lines
Quoted 5 lines
While the optimal solution would be to start the device model automatically when needed this would require some major rework of libxl at multiple places.
Signed-off-by Juergen Gross <[email protected]>So wait -- what happens now if you try to attach a disk with a qdisk backend to a PV guest that didn't start with qemu running?
It won't work (that was my test case for the patch).
Quoted 7 lines
Quoted 3 lines
I'd really like to see patch 3 get in, but I'm not really in favor of this sort of a user-visible hack, particularly as we have to support it in libxl more or less indefinitely.
Hmm, really? We can add a smarter variant later which will start the device model in case it isn't started yet. Then the new config parameter could be just ignored.
Sure; but it will (probably) only actually be useful for one release cycle (now 6 months), and then it will sit around cluttering up the interface for years to come. The situation wrt hotplug has been this way for years now, and nobody has complained; I don't think an extra 6 months will be a big deal.
Quoted 8 lines
Ultimately it's the tools maintainers' call; I wouldn't argue against it if one of them think it's a good idea.
Quoted 3 lines
I didn't do the smart variant as I'm not sure I could set it up in time for 4.7. I'd be happy to do it with some assistance regarding the async framework of libxl I'm not at all familiar with.
I'm sure help could be arranged; but it might be difficult to do by 4.7.
Okay, let's see what can be arranged.
BTW: This patch is not strictly required for patch 3. Patch 3 is just adding another case where no device model is available when needed.
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
PATCH 3/3 libxl: add new pvusb backend "qusb" provided by qemu
In reply to Juergen GrossAdd a new pvusb backend type "qusb" which is provided by qemu. It can be selected either by specifying the type directly in the configuration or it is selected automatically by libxl in case there is no "usbback" driver loaded.
--- docs/man/xl.cfg.pod.5 | 11 +++- tools/libxl/libxl_device.c | 3 +- tools/libxl/libxl_dm.c | 8 +++ tools/libxl/libxl_internal.h | 1 + tools/libxl/libxl_pvusb.c | 102 +++++++++++++++++++++++++++-------- tools/libxl/libxl_types.idl | 1 + tools/libxl/libxl_types_internal.idl | 1 + 7 files changed, 101 insertions(+), 26 deletions(-)
docs/man/xl.cfg.pod.5 +9 -2
@@ -737,8 +737,15 @@ Possible B<KEY>s are: =item B<type=TYPE> -Specifies the usb controller type. Currently only 'pv' and 'auto' -are supported. +Specifies the usb controller type. + +"pv" denotes a kernel based pvusb backend. + +"qusb" specifies a qemu base backend for pvusb. + +"auto" (the default) determines whether a kernel based backend is installed. +If this is the case, "pv" is selected, "qusb" will be selected if no kernel +backend is currently available. =item B<version=VERSION>
tools/libxl/libxl_device.c +2 -1
@@ -680,7 +680,8 @@ void libxl__devices_destroy(libxl__egc *egc, libxl__devices_remove_state *drs) aodev->action =LIBXL__DEVICE_ACTION_REMOVE ; aodev->dev = dev; aodev->force = drs->force; -if (dev->backend_kind ==LIBXL__DEVICE_KIND_VUSB ) +if (dev->backend_kind ==LIBXL__DEVICE_KIND_VUSB || + dev->backend_kind ==LIBXL__DEVICE_KIND_QUSB )libxl__initiate_device_usbctrl_remove (egc, aodev);else libxl__initiate_device_generic_remove (egc, aodev);
tools/libxl/libxl_dm.c +8 -0
@@ -2143,6 +2143,14 @@ int libxl__need_xenpv_qemu(libxl__gc *gc, libxl_domain_config *d_config) } } +for (i =0 ; i < d_config->num_usbctrls; i++) { +if (d_config->usbctrls[i].type ==LIBXL_USBCTRL_TYPE_QUSB && + d_config->usbctrls[i].backend_domid == domid) { + ret =1 ; + goto out; + } + } + out:return ret; }
tools/libxl/libxl_internal.h +1 -0
@@ -487,6 +487,7 @@ typedef struct {#define QEMU_BACKEND (dev) (\ (dev)->backend_kind == LIBXL__DEVICE_KIND_QDISK || \ (dev)->backend_kind == LIBXL__DEVICE_KIND_VFB || \ + (dev)->backend_kind == LIBXL__DEVICE_KIND_QUSB || \ (dev)->backend_kind == LIBXL__DEVICE_KIND_VKBD)#define XC_PCI_BDF "0x%x, 0x%x, 0x%x, 0x%x"
tools/libxl/libxl_pvusb.c +79 -23
237 lines not on this page · raw message
tools/libxl/libxl_types.idl +1 -0
@@ -618,6 +618,7 @@ libxl_usbctrl_type = Enumeration("usbctrl_type", [ (0, "AUTO"), (1, "PV"), (2, "DEVICEMODEL"), + (3, "QUSB"), ]) libxl_usbdev_type = Enumeration("usbdev_type", [
tools/libxl/libxl_types_internal.idl +1 -0
@@ -23,6 +23,7 @@ libxl__device_kind = Enumeration("device_kind", [ (7, "CONSOLE"), (8, "VTPM"), (9, "VUSB"), + (10, "QUSB"), ]) libxl__console_backend = Enumeration("console_backend", [
Signature · 7 lines
2.6.2 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Re: [PATCH 3/3] libxl: add new pvusb backend "qusb" provided by qemu
Quoted 6 lines · Juergen Gross
Add a new pvusb backend type "qusb" which is provided by qemu. It can be selected either by specifying the type directly in the configuration or it is selected automatically by libxl in case there is no "usbback" driver loaded.
Signed-off-by Juergen Gross <[email protected]>
It would be awesome if we could get a patch like this in for 4.7.
However...
Quoted 19 lines
--- docs/man/xl.cfg.pod.5 | 11 +++- tools/libxl/libxl_device.c | 3 +- tools/libxl/libxl_dm.c | 8 +++ tools/libxl/libxl_internal.h | 1 + tools/libxl/libxl_pvusb.c | 102 +++++++++++++++++++++++++++-------- tools/libxl/libxl_types.idl | 1 + tools/libxl/libxl_types_internal.idl | 1 + 7 files changed, 101 insertions(+), 26 deletions(-)docs/man/xl.cfg.pod.5 +0
-1@@ -737,8 +737,15 @@ Possible B<KEY>s are: =item B<type=TYPE> -Specifies the usb controller type. Currently only 'pv' and 'auto'
docs/man/xl.cfg.pod.5 Possible B<KEY>s are: · line 748
Quoted 10 lines
docs/man/xl.cfg.pod.5 +9
-1-are supported. +Specifies the usb controller type. + +"pv" denotes a kernel based pvusb backend. + +"qusb" specifies a qemu base backend for pvusb. + +"auto" (the default) determines whether a kernel based backend is installed. +If this is the case, "pv" is selected, "qusb" will be selected if no kernel +backend is currently available.
I'm going back and forth a bit about whether having a "qusb" option here makes the most sense, or whether it makes more sense to have a separate option, like "backendtype" (as we have for disks).
The reason I suggested having "type" here at all is that libxl cannot know ahead of time whether the guest has pvusbfront available. It *can*, however, tell whether pvusbback is available (as your code demonstrates).
On the other hand -- given that qemu will shortly have pvusbback, I'm wondering if it's possible to make pvusbfront do something similar to what the blkfront drivers do -- write a magic port that tell qemu, "Actually, I have pvusb drivers; unplug the emulated controller."
From a UI point of view that would be the best, right? Just like disks or network cards -- you can simply say you want a controller, and you automatically get the most appropriate kind based on what the kernel you run actually has available.
I think you've been working on the pvusbfront drivers for Linux, as well as the qusb backend in qemu -- do you think that's workable?
If so, I think adding 'qusb' to this field is probably the right thing to do.
One technical question...
docs/man/xl.cfg.pod.5 int libxl_ctrlport_to_device_usbdev(libxl_ctx *ctx, · line 1618
Quoted 4 lines
docs/man/xl.cfg.pod.5 +0
-0@@ -1559,7 +1616,6 @@ int libxl_ctrlport_to_device_usbdev(libxl_ctx *ctx, dompath = libxl__xs_get_dompath(gc, domid); fe_path = GCSPRINTF("%s/device/vusb/%d", dompath, ctrl);
Did you miss a vusb -> %s here?
-George
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH 3/3] libxl: add new pvusb backend "qusb" provided by qemu
Quoted 56 lines · George Dunlap
Quoted 6 lines · Juergen Gross
Add a new pvusb backend type "qusb" which is provided by qemu. It can be selected either by specifying the type directly in the configuration or it is selected automatically by libxl in case there is no "usbback" driver loaded.
Signed-off-by Juergen Gross <[email protected]>It would be awesome if we could get a patch like this in for 4.7.
However...
Quoted 19 lines
--- docs/man/xl.cfg.pod.5 | 11 +++- tools/libxl/libxl_device.c | 3 +- tools/libxl/libxl_dm.c | 8 +++ tools/libxl/libxl_internal.h | 1 + tools/libxl/libxl_pvusb.c | 102 +++++++++++++++++++++++++++-------- tools/libxl/libxl_types.idl | 1 + tools/libxl/libxl_types_internal.idl | 1 + 7 files changed, 101 insertions(+), 26 deletions(-)docs/man/xl.cfg.pod.5 +0
-1@@ -737,8 +737,15 @@ Possible B<KEY>s are: =item B<type=TYPE> -Specifies the usb controller type. Currently only 'pv' and 'auto'docs/man/xl.cfg.pod.5 Possible B<KEY>s are: · line 748
Quoted 10 lines
docs/man/xl.cfg.pod.5 +9
-1-are supported. +Specifies the usb controller type. + +"pv" denotes a kernel based pvusb backend. + +"qusb" specifies a qemu base backend for pvusb. + +"auto" (the default) determines whether a kernel based backend is installed. +If this is the case, "pv" is selected, "qusb" will be selected if no kernel +backend is currently available.I'm going back and forth a bit about whether having a "qusb" option here makes the most sense, or whether it makes more sense to have a separate option, like "backendtype" (as we have for disks).
The reason I suggested having "type" here at all is that libxl cannot know ahead of time whether the guest has pvusbfront available. It *can*, however, tell whether pvusbback is available (as your code demonstrates).
On the other hand -- given that qemu will shortly have pvusbback, I'm wondering if it's possible to make pvusbfront do something similar to what the blkfront drivers do -- write a magic port that tell qemu, "Actually, I have pvusb drivers; unplug the emulated controller."
Quoted 7 lines
From a UI point of view that would be the best, right? Just like disks or network cards -- you can simply say you want a controller, and you automatically get the most appropriate kind based on what the kernel you run actually has available.
I think you've been working on the pvusbfront drivers for Linux, as well as the qusb backend in qemu -- do you think that's workable?
Hmm, could work. This would require the frontend to register rather early at boot in order to bind the devices to it before the emulated USB connector can grab them, right? Or would the emulated USB devices seem to be unplugged from the emulated adapter and then again plugged in via the pvusb frontend?
Quoted 10 lines
If so, I think adding 'qusb' to this field is probably the right thing to do.
One technical question...
docs/man/xl.cfg.pod.5 int libxl_ctrlport_to_device_usbdev(libxl_ctx *ctx, · line 1618
Quoted 4 lines
docs/man/xl.cfg.pod.5 +0
-0@@ -1559,7 +1616,6 @@ int libxl_ctrlport_to_device_usbdev(libxl_ctx *ctx, dompath = libxl__xs_get_dompath(gc, domid); fe_path = GCSPRINTF("%s/device/vusb/%d", dompath, ctrl);Did you miss a vusb -> %s here?
No. The frontend won't need to know whether the backend is kernel or qemu based.
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH 3/3] libxl: add new pvusb backend "qusb" provided by qemu
In reply to Juergen GrossQuoted 6 lines · Juergen Gross
Add a new pvusb backend type "qusb" which is provided by qemu. It can be selected either by specifying the type directly in the configuration or it is selected automatically by libxl in case there is no "usbback" driver loaded.
Signed-off-by Juergen Gross <[email protected]>
Oh, last thing -- shouldn't we have a way for libxl to tell whether qemu can provide a qusb backend before we offer to start it up?
-George
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH 3/3] libxl: add new pvusb backend "qusb" provided by qemu
Quoted 10 lines · George Dunlap
Quoted 6 lines · Juergen Gross
Add a new pvusb backend type "qusb" which is provided by qemu. It can be selected either by specifying the type directly in the configuration or it is selected automatically by libxl in case there is no "usbback" driver loaded.
Signed-off-by Juergen Gross <[email protected]>Oh, last thing -- shouldn't we have a way for libxl to tell whether qemu can provide a qusb backend before we offer to start it up?
How? Is this possible for qdisk? Or for an emulated frame buffer?
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH 3/3] libxl: add new pvusb backend "qusb" provided by qemu
Quoted 7 lines · Juergen Gross
Quoted 6 lines · George Dunlap
Quoted 5 lines · Juergen Gross
Add a new pvusb backend type "qusb" which is provided by qemu. It can be selected either by specifying the type directly in the configuration or it is selected automatically by libxl in case there is no "usbback" driver loaded.
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
Signed-off-by Juergen Gross <[email protected]>Oh, last thing -- shouldn't we have a way for libxl to tell whether qemu can provide a qusb backend before we offer to start it up?
How? Is this possible for qdisk? Or for an emulated frame buffer?
I don't think it is possible at the moment. But I think you might be able to do it either via qmp command or parsing qemu help string. The latter functionality is implemented in Ian's device model deprivilege patch series IIRC -- but it is not yet merged either.
Wei.
Quoted 3 lines
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH 3/3] libxl: add new pvusb backend "qusb" provided by qemu
Quoted 13 lines · Wei Liu
Quoted 12 lines · Juergen Gross
Quoted 10 lines · George Dunlap
Quoted 6 lines · Juergen Gross
Add a new pvusb backend type "qusb" which is provided by qemu. It can be selected either by specifying the type directly in the configuration or it is selected automatically by libxl in case there is no "usbback" driver loaded.
Signed-off-by Juergen Gross <[email protected]>Oh, last thing -- shouldn't we have a way for libxl to tell whether qemu can provide a qusb backend before we offer to start it up?
Quoted 7 lines
Quoted 2 lines
How? Is this possible for qdisk? Or for an emulated frame buffer?
I don't think it is possible at the moment. But I think you might be able to do it either via qmp command or parsing qemu help string. The latter functionality is implemented in Ian's device model deprivilege patch series IIRC -- but it is not yet merged either.
Won't help for qusb, as there is no qemu parameter or help text related to the backend. It would be possible to add a qmp command to print the supported backend types, of course.
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH 3/3] libxl: add new pvusb backend "qusb" provided by qemu
Quoted 17 lines · Juergen Gross
Quoted 16 lines · Wei Liu
Quoted 14 lines · Juergen Gross
Quoted 10 lines · George Dunlap
Quoted 6 lines · Juergen Gross
Add a new pvusb backend type "qusb" which is provided by qemu. It can be selected either by specifying the type directly in the configuration or it is selected automatically by libxl in case there is no "usbback" driver loaded.
Signed-off-by Juergen Gross <[email protected]>Oh, last thing -- shouldn't we have a way for libxl to tell whether qemu can provide a qusb backend before we offer to start it up?
How? Is this possible for qdisk? Or for an emulated frame buffer?
Quoted 8 lines
Quoted 4 lines
I don't think it is possible at the moment. But I think you might be able to do it either via qmp command or parsing qemu help string. The latter functionality is implemented in Ian's device model deprivilege patch series IIRC -- but it is not yet merged either.
Won't help for qusb, as there is no qemu parameter or help text related to the backend. It would be possible to add a qmp command to print the supported backend types, of course.
Well as I understand it, for qemu-upstream we can't assume what version of qemu we'll end up getting: we need to be compatible with recent releases of qemu which don't provide qusb. Which I'm pretty sure means failing gracefully (i.e., giving a sensible warning message) if someone tries to add qusb when their qemu binary doesn't support it.
If you can tell from the qemu failure that qusb is at fault, that's OK I think; but if not, I think you'll have to add some way to query whether qusb is supported by the qemu binary before starting it.
-George
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH 3/3] libxl: add new pvusb backend "qusb" provided by qemu
Quoted 34 lines · George Dunlap
Quoted 17 lines · Juergen Gross
Quoted 16 lines · Wei Liu
Quoted 14 lines · Juergen Gross
Quoted 10 lines · George Dunlap
Quoted 6 lines · Juergen Gross
Add a new pvusb backend type "qusb" which is provided by qemu. It can be selected either by specifying the type directly in the configuration or it is selected automatically by libxl in case there is no "usbback" driver loaded.
Signed-off-by Juergen Gross <[email protected]>Oh, last thing -- shouldn't we have a way for libxl to tell whether qemu can provide a qusb backend before we offer to start it up?
How? Is this possible for qdisk? Or for an emulated frame buffer?
Quoted 8 lines
Quoted 4 lines
I don't think it is possible at the moment. But I think you might be able to do it either via qmp command or parsing qemu help string. The latter functionality is implemented in Ian's device model deprivilege patch series IIRC -- but it is not yet merged either.
Won't help for qusb, as there is no qemu parameter or help text related to the backend. It would be possible to add a qmp command to print the supported backend types, of course.
Well as I understand it, for qemu-upstream we can't assume what version of qemu we'll end up getting: we need to be compatible with recent releases of qemu which don't provide qusb. Which I'm pretty sure means failing gracefully (i.e., giving a sensible warning message) if someone tries to add qusb when their qemu binary doesn't support it.
Quoted 3 lines
If you can tell from the qemu failure that qusb is at fault, that's OK I think; but if not, I think you'll have to add some way to query whether qusb is supported by the qemu binary before starting it.
So we would want a qemu command line option (e.g. -xen-help) printing the supported pv backends. I think this should be easy to setup.
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH 3/3] libxl: add new pvusb backend "qusb" provided by qemu
Quoted 35 lines · Juergen Gross
Quoted 34 lines · George Dunlap
Quoted 17 lines · Juergen Gross
Quoted 16 lines · Wei Liu
Quoted 14 lines · Juergen Gross
Quoted 10 lines · George Dunlap
Quoted 6 lines · Juergen Gross
Add a new pvusb backend type "qusb" which is provided by qemu. It can be selected either by specifying the type directly in the configuration or it is selected automatically by libxl in case there is no "usbback" driver loaded.
Signed-off-by Juergen Gross <[email protected]>Oh, last thing -- shouldn't we have a way for libxl to tell whether qemu can provide a qusb backend before we offer to start it up?
How? Is this possible for qdisk? Or for an emulated frame buffer?
Quoted 8 lines
Quoted 4 lines
I don't think it is possible at the moment. But I think you might be able to do it either via qmp command or parsing qemu help string. The latter functionality is implemented in Ian's device model deprivilege patch series IIRC -- but it is not yet merged either.
Won't help for qusb, as there is no qemu parameter or help text related to the backend. It would be possible to add a qmp command to print the supported backend types, of course.
Well as I understand it, for qemu-upstream we can't assume what version of qemu we'll end up getting: we need to be compatible with recent releases of qemu which don't provide qusb. Which I'm pretty sure means failing gracefully (i.e., giving a sensible warning message) if someone tries to add qusb when their qemu binary doesn't support it.
Quoted 6 lines
Quoted 3 lines
If you can tell from the qemu failure that qusb is at fault, that's OK I think; but if not, I think you'll have to add some way to query whether qusb is supported by the qemu binary before starting it.
So we would want a qemu command line option (e.g. -xen-help) printing the supported pv backends. I think this should be easy to setup.
Actually there is a solution which is _really_ simple: before setting it's state to "running" in xenstore, qemu could write the supported backend types to xenstore, too. I'd add a xenstore directory
/local/domain/<backend-domid>/device-model/<domid>/backends
containing a directory for each supported backend. By using a directory for each backend it would even be possible to indicate supported features and/or parameters in the future.
"qusb" backend would be regarded to be supported only if /local/domain/<backend-domid>/device-model/<domid>/backends/qusb is existing.
"qdisk" would be regarded to be supported if either:
- /local/domain/<backend-domid>/device-model/<domid>/backends/qdisk is existing or:
- /local/domain/<backend-domid>/device-model/<domid>/backends is not existing.
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel