libxl: add support for qemu base pvusb backend
v2 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.
Changes in V2:
- patch 1: Return false if libxl__get_domid() fails as requested by George Dunlap
- Swapped patches 2 and 3 as former patch 2 has been questioned to make sense for 4.7. This will remove an obstacle for former patch 3 to go in.
Juergen Gross (3):
libxl: make libxl__need_xenpv_qemu() operate on domain config
libxl: add new pvusb backend "qusb" provided by qemu
libxl: add domain config parameter to force start of 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 | 64 +++++++++------------- 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, 131 insertions(+), 77 deletions(-)
Signature · 7 lines
2.6.2 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
PATCH v2 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.
---
V2: Return false if libxl__get_domid() fails as requested by George Dunlap
--- tools/libxl/libxl_create.c | 9 +------ tools/libxl/libxl_dm.c | 57 ++++++++++++-------------------------------- tools/libxl/libxl_internal.h | 5 +--- 3 files changed, 17 insertions(+), 54 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 +15 -42
76 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
PATCH v2 2/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
@@ -2138,6 +2138,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 v2 2/3] libxl: add new pvusb backend "qusb" provided by qemu
Quoted 92 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]>--- 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@@ -2138,6 +2138,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 +1
-0@@ -22,6 +22,21 @@#define USBHUB_CLASS_CODE 9 +static int usbback_is_loaded (libxl__gc *gc)
tools/libxl/libxl_pvusb.c line 35
Quoted 10 lines
tools/libxl/libxl_pvusb.c +10
-0+{ +int r; +struct stat st; + + r =lstat (SYSFS_USBBACK_DRIVER , &st); + +if (r ==0 ) +return 1 ; +if (r <0 && errno ==ENOENT ) +return 0 ;
I believe the CODING STYLE in libxl asks for you to use { } for these ones.
tools/libxl/libxl_pvusb.c line 36
Quoted 1 line
tools/libxl/libxl_pvusb.c +1
-0+LOGE (ERROR ,"Accessing %s" ,SYSFS_USBBACK_DRIVER );
Why is this an error?
tools/libxl/libxl_pvusb.c line 39
Quoted 3 lines
tools/libxl/libxl_pvusb.c +3
-0+return -1 ; +} +
Otherwise looks OK to me.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 2/3] libxl: add new pvusb backend "qusb" provided by qemu
Quoted 92 lines · Konrad Rzeszutek Wilk
Quoted 91 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]>--- 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@@ -2138,6 +2138,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 +0
-0@@ -22,6 +22,21 @@#define USBHUB_CLASS_CODE 9
Quoted 14 lines
tools/libxl/libxl_pvusb.c line 35
Quoted 11 lines
tools/libxl/libxl_pvusb.c +11
-0+static int usbback_is_loaded (libxl__gc *gc) +{ +int r; +struct stat st; + + r =lstat (SYSFS_USBBACK_DRIVER , &st); + +if (r ==0 ) +return 1 ; +if (r <0 && errno ==ENOENT ) +return 0 ;I believe the CODING STYLE in libxl asks for you to use { } for these ones.
No, it doesn't:
Quote from tools/libxl/CODING_STYLE:
5. Block structure
Every indented statement is braced apart from blocks that contain just one statement.
Quoted 4 lines
tools/libxl/libxl_pvusb.c line 36
Quoted 2 lines
tools/libxl/libxl_pvusb.c +1
-0+LOGE (ERROR ,"Accessing %s" ,SYSFS_USBBACK_DRIVER );Why is this an error?
What else? We can't determine whether the driver is loaded or not. ENOENT is tested above, so it must be something weird.
Quoted 6 lines
tools/libxl/libxl_pvusb.c line 39
Quoted 4 lines
tools/libxl/libxl_pvusb.c +3
-0+return -1 ; +} +Otherwise looks OK to me.
Thanks,
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 2/3] libxl: add new pvusb backend "qusb" provided by qemu
Quoted 15 lines
Quoted 6 lines
Quoted 6 lines
tools/libxl/libxl_pvusb.c +6
-0+static int usbback_is_loaded (libxl__gc *gc) +{ +int r; +struct stat st; + + r =lstat (SYSFS_USBBACK_DRIVER , &st);Quoted 8 lines
tools/libxl/libxl_pvusb.c line 35
Quoted 5 lines
tools/libxl/libxl_pvusb.c +5
-0+ +if (r ==0 ) +return 1 ; +if (r <0 && errno ==ENOENT ) +return 0 ;I believe the CODING STYLE in libxl asks for you to use { } for these ones.
Quoted 8 lines
No, it doesn't:
Quote from
tools/libxl/CODING_STYLE:5. Block structure
Every indented statement is braced apart from blocks that contain just one statement.
You are right. I am so used to 'if (..) else'!
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
+
LOGE(ERROR, "Accessing %s", SYSFS_USBBACK_DRIVER);Why is this an error?
What else? We can't determine whether the driver is loaded or not. ENOENT is tested above, so it must be something weird.
Or it could be EPERM.
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
+ return -1;
Which results in the code assuming (the caller of this function) it is an kernel driver. Is that OK? Or should we bail out completly?
Quoted 9 lines
Quoted 4 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+} +Otherwise looks OK to me.
Thanks,
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 2/3] libxl: add new pvusb backend "qusb" provided by qemu
Quoted 27 lines · Konrad Rzeszutek Wilk
Quoted 15 lines
Quoted 6 lines
Quoted 6 lines
tools/libxl/libxl_pvusb.c +6
-0+static int usbback_is_loaded (libxl__gc *gc) +{ +int r; +struct stat st; + + r =lstat (SYSFS_USBBACK_DRIVER , &st);Quoted 8 lines
tools/libxl/libxl_pvusb.c line 35
Quoted 5 lines
tools/libxl/libxl_pvusb.c +5
-0+ +if (r ==0 ) +return 1 ; +if (r <0 && errno ==ENOENT ) +return 0 ;I believe the CODING STYLE in libxl asks for you to use { } for these ones.
Quoted 8 lines
No, it doesn't:
Quote from
tools/libxl/CODING_STYLE:5. Block structure
Every indented statement is braced apart from blocks that contain just one statement.
You are right. I am so used to 'if (..) else'!
Quoted 2 lines
Quoted 2 lines
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
+
LOGE(ERROR, "Accessing %s", SYSFS_USBBACK_DRIVER);Why is this an error?
What else? We can't determine whether the driver is loaded or not. ENOENT is tested above, so it must be something weird.
Or it could be EPERM.
Which is weird in this case. :-)
Quoted 6 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
+ return -1;
Which results in the code assuming (the caller of this function) it is an kernel driver. Is that OK? Or should we bail out completly?
Have a look in V4 of the patches. :-)
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
PATCH v2 3/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
@@ -1956,6 +1956,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)if (libxl__get_domid (gc, &domid)) 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
@@ -451,6 +451,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 v2 3/3] libxl: add domain config parameter to force start of qemu
Quoted 9 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.
.. s/devices/PV devices/
As surely PV guests can't use emulated devices. Or could they? That would be quite interesting in a not kind of fun way.
Quoted 4 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.
But you are not using this now (late start of QEMU), so why this patch?
Quoted 89 lines
Signed-off-by Juergen Gross <[email protected]>--- 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@@ -1956,6 +1956,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 Keymapstools/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)if (libxl__get_domid (gc, &domid)) 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@@ -451,6 +451,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
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 3/3] libxl: add domain config parameter to force start of qemu
Quoted 7 lines · Konrad Rzeszutek Wilk
Quoted 6 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.
Quoted 8 lines
Quoted 3 lines
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.
.. s/devices/PV devices/
As surely PV guests can't use emulated devices. Or could they? That would be quite interesting in a not kind of fun way.
Would require some work.
Quoted 7 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.
But you are not using this now (late start of QEMU), so why this patch?
This was the reason for the patch: start the device model early in order to have it running in case it would be needed later.
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 3/3] libxl: add domain config parameter to force start of qemu
Quoted 21 lines · Juergen Gross
Quoted 7 lines · Konrad Rzeszutek Wilk
Quoted 6 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.
Quoted 8 lines
Quoted 3 lines
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.
.. s/devices/PV devices/
As surely PV guests can't use emulated devices. Or could they? That would be quite interesting in a not kind of fun way.
Would require some work.
Quoted 2 lines
Quoted 2 lines
Quoted 8 lines
Quoted 5 lines
Quoted 3 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.
But you are not using this now (late start of QEMU), so why this patch?
This was the reason for the patch: start the device model early in order to have it running in case it would be needed later.
OK. However I am missing something here. My understanding is that the QEMU Xen PV USB backend is not in the code-base. So why do this if QEMU won't even support this?
Would it make more sense to wait until QEMU has this support, then have this patch, or work on making libxl be able to start QEMU later (during the time QEMU gains the XEn PV USB backend)?
Quoted 2 lines
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Re: [PATCH v2 3/3] libxl: add domain config parameter to force start of qemu
Quoted 32 lines · Konrad Rzeszutek Wilk
Quoted 21 lines · Juergen Gross
Quoted 7 lines · Konrad Rzeszutek Wilk
Quoted 6 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.
Quoted 8 lines
Quoted 3 lines
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.
.. s/devices/PV devices/
As surely PV guests can't use emulated devices. Or could they? That would be quite interesting in a not kind of fun way.
Would require some work.
Quoted 2 lines
Quoted 2 lines
Quoted 8 lines
Quoted 5 lines
Quoted 3 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.
But you are not using this now (late start of QEMU), so why this patch?
This was the reason for the patch: start the device model early in order to have it running in case it would be needed later.
Quoted 7 lines
OK. However I am missing something here. My understanding is that the QEMU Xen PV USB backend is not in the code-base. So why do this if QEMU won't even support this?
Would it make more sense to wait until QEMU has this support, then have this patch, or work on making libxl be able to start QEMU later (during the time QEMU gains the XEn PV USB backend)?
The qemu patches are sent already. I hope they are being accepted rather soon.
I'm planning to add support for starting qemu as needed when 4.7 is out.
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 11 lines · Juergen Gross
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.
Changes in V2:
- patch 1: Return false iflibxl__get_domid()fails as requested by George Dunlap
- Swapped patches 2 and 3 as former patch 2 has been questioned to make sense for 4.7. This will remove an obstacle for former patch 3 to go in.
Quoted 4 lines
Juergen Gross (3):
libxl: makelibxl__need_xenpv_qemu()operate on domain config
libxl: add new pvusb backend "qusb" provided by qemu
libxl: add domain config parameter to force start of qemu
I had a try with detecting a missing device model when adding a device to an already running domain. Instead of silently failing it would now print an appropriate error message. This could be changed later to start the device model in that situation.
Would you like me to send another version of the complete series (the v2 patches are not changed), or the new patches only?
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel