libxl: make vkbd tunable for HVM guests
PATCH v2 1/1 libxl: make vkbd tunable for HVM guests
Each HVM guest currently gets a vkbd frontend/backend pair (c/s ebbd2561b4c). This consumes host resources unnecessarily for guests that have no use for vkbd. Make this behaviour tunable to allow an administrator to choose. The commit retains the current behaviour -- HVM guests still get vkdb unless specified otherwise.
---
Changes in v2:
- Added a missing hunk / setting vkb_device per config
--- tools/libxl/libxl_create.c | 9 ++++++--- tools/libxl/libxl_types.idl | 1 + tools/xl/xl_parse.c | 1 + tools/xl/xl_sxp.c | 2 ++ 4 files changed, 10 insertions(+), 3 deletions(-)
tools/libxl/libxl_create.c +6 -3
@@ -310,6 +310,7 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,libxl_defbool_setdefault (&b_info->u.hvm.vpt_align, true);libxl_defbool_setdefault (&b_info->u.hvm.altp2m, false);libxl_defbool_setdefault (&b_info->u.hvm.usb, false); +libxl_defbool_setdefault (&b_info->u.hvm.vkb_device, true);libxl_defbool_setdefault (&b_info->u.hvm.xen_platform_pci, true);libxl_defbool_setdefault (&b_info->u.hvm.spice.enable, false);
@@ -1416,9 +1417,11 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev,libxl__device_console_add (gc, domid, &console, state, &device);libxl__device_console_dispose (&console); -libxl_device_vkb_init (&vkb); -libxl__device_add (gc, domid, &libxl__vkb_devtype, &vkb); -libxl_device_vkb_dispose (&vkb); +if (libxl_defbool_val (d_config->b_info.u.hvm.vkb_device)) { +libxl_device_vkb_init (&vkb); +libxl__device_add (gc, domid, &libxl__vkb_devtype, &vkb); +libxl_device_vkb_dispose (&vkb); + } dcs->sdss.dm.guest_domid = domid;if (libxl_defbool_val (d_config->b_info.device_model_stubdomain))
tools/libxl/libxl_types.idl +1 -0
@@ -583,6 +583,7 @@ libxl_domain_build_info = Struct("domain_build_info",[ # - "tablet" for absolute mouse, # - "mouse" for PS/2 protocol relative mouse ("usbdevice", string), + ("vkb_device", libxl_defbool), ("soundhw", string), ("xen_platform_pci", libxl_defbool), ("usbdevice_list", libxl_string_list),
tools/xl/xl_parse.c +1 -0
@@ -2652,6 +2652,7 @@ skip_usbdev:fprintf (stderr,"xl: Unable to parse usbdevice.\n" );exit (-ERROR_FAIL ); } +xlu_cfg_get_defbool (config,"vkb_device" , &b_info->u.hvm.vkb_device,0 );xlu_cfg_replace_string (config,"soundhw" , &b_info->u.hvm.soundhw,0 );xlu_cfg_get_defbool (config,"xen_platform_pci" , &b_info->u.hvm.xen_platform_pci,0 );
tools/xl/xl_sxp.c +2 -0
@@ -138,6 +138,8 @@ void printf_info_sexp(int domid, libxl_domain_config *d_config, FILE *fh)fprintf (fh,"\t\t\t(boot %s)\n" , b_info->u.hvm.boot);fprintf (fh,"\t\t\t(usb %s)\n" ,libxl_defbool_to_string (b_info->u.hvm.usb));fprintf (fh,"\t\t\t(usbdevice %s)\n" , b_info->u.hvm.usbdevice); +fprintf (fh,"\t\t\t(vkb_device %s)\n" , +libxl_defbool_to_string (b_info->u.hvm.vkb_device));fprintf (fh,"\t\t)\n" );break ;case LIBXL_DOMAIN_TYPE_PV :
Signature · 7 lines
2.15.3.AMZN _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 88 lines · Eslam Elnikety
Each HVM guest currently gets a vkbd frontend/backend pair (c/s
ebbd2561b4c). This consumes host resources unnecessarily for guests that have no use for vkbd. Make this behaviour tunable to allow an administrator to choose. The commit retains the current behaviour -- HVM guests still get vkdb unless specified otherwise.Signed-off-by Eslam Elnikety <[email protected]>---
Changes in v2:
- Added a missing hunk / settingvkb_deviceper config
---tools/libxl/libxl_create.c | 9 ++++++--- tools/libxl/libxl_types.idl | 1 + tools/xl/xl_parse.c | 1 + tools/xl/xl_sxp.c | 2 ++ 4 files changed, 10 insertions(+), 3 deletions(-)tools/libxl/libxl_create.c +6
-3@@ -310,6 +310,7 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,libxl_defbool_setdefault (&b_info->u.hvm.vpt_align, true);libxl_defbool_setdefault (&b_info->u.hvm.altp2m, false);libxl_defbool_setdefault (&b_info->u.hvm.usb, false); +libxl_defbool_setdefault (&b_info->u.hvm.vkb_device, true);libxl_defbool_setdefault (&b_info->u.hvm.xen_platform_pci, true);libxl_defbool_setdefault (&b_info->u.hvm.spice.enable, false);@@ -1416,9 +1417,11 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev,libxl__device_console_add (gc, domid, &console, state, &device);libxl__device_console_dispose (&console); -libxl_device_vkb_init (&vkb); -libxl__device_add (gc, domid, &libxl__vkb_devtype, &vkb); -libxl_device_vkb_dispose (&vkb); +if (libxl_defbool_val (d_config->b_info.u.hvm.vkb_device)) { +libxl_device_vkb_init (&vkb); +libxl__device_add (gc, domid, &libxl__vkb_devtype, &vkb); +libxl_device_vkb_dispose (&vkb); + } dcs->sdss.dm.guest_domid = domid;if (libxl_defbool_val (d_config->b_info.device_model_stubdomain))tools/libxl/libxl_types.idl +1
-0@@ -583,6 +583,7 @@ libxl_domain_build_info = Struct("domain_build_info",[ # - "tablet" for absolute mouse, # - "mouse" for PS/2 protocol relative mouse ("usbdevice", string), + ("vkb_device", libxl_defbool), ("soundhw", string), ("xen_platform_pci", libxl_defbool), ("usbdevice_list", libxl_string_list),tools/xl/xl_parse.c +1
-0@@ -2652,6 +2652,7 @@ skip_usbdev:fprintf (stderr,"xl: Unable to parse usbdevice.\n" );exit (-ERROR_FAIL ); } +xlu_cfg_get_defbool (config,"vkb_device" , &b_info->u.hvm.vkb_device,0 );xlu_cfg_replace_string (config,"soundhw" , &b_info->u.hvm.soundhw,0 );xlu_cfg_get_defbool (config,"xen_platform_pci" , &b_info->u.hvm.xen_platform_pci,0 );tools/xl/xl_sxp.c +2
-0@@ -138,6 +138,8 @@ void printf_info_sexp(int domid, libxl_domain_config *d_config, FILE *fh)fprintf (fh,"\t\t\t(boot %s)\n" , b_info->u.hvm.boot);fprintf (fh,"\t\t\t(usb %s)\n" ,libxl_defbool_to_string (b_info->u.hvm.usb));fprintf (fh,"\t\t\t(usbdevice %s)\n" , b_info->u.hvm.usbdevice); +fprintf (fh,"\t\t\t(vkb_device %s)\n" , +libxl_defbool_to_string (b_info->u.hvm.vkb_device));fprintf (fh,"\t\t)\n" );break ;case LIBXL_DOMAIN_TYPE_PV :Signature · 1 line
2.15.3.AMZN
Wei, any particular thoughts on v2?
Cheers,
Eslam
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 62 lines · Eslam Elnikety
Each HVM guest currently gets a vkbd frontend/backend pair (c/s
ebbd2561b4c). This consumes host resources unnecessarily for guests that have no use for vkbd. Make this behaviour tunable to allow an administrator to choose. The commit retains the current behaviour -- HVM guests still get vkdb unless specified otherwise.Signed-off-by Eslam Elnikety <[email protected]>---
Changes in v2:
- Added a missing hunk / settingvkb_deviceper config--- tools/libxl/libxl_create.c | 9 ++++++--- tools/libxl/libxl_types.idl | 1 + tools/xl/xl_parse.c | 1 + tools/xl/xl_sxp.c | 2 ++ 4 files changed, 10 insertions(+), 3 deletions(-)tools/libxl/libxl_create.c +6
-3@@ -310,6 +310,7 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,libxl_defbool_setdefault (&b_info->u.hvm.vpt_align, true);libxl_defbool_setdefault (&b_info->u.hvm.altp2m, false);libxl_defbool_setdefault (&b_info->u.hvm.usb, false); +libxl_defbool_setdefault (&b_info->u.hvm.vkb_device, true);libxl_defbool_setdefault (&b_info->u.hvm.xen_platform_pci, true);libxl_defbool_setdefault (&b_info->u.hvm.spice.enable, false);@@ -1416,9 +1417,11 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev,libxl__device_console_add (gc, domid, &console, state, &device);libxl__device_console_dispose (&console); -libxl_device_vkb_init (&vkb); -libxl__device_add (gc, domid, &libxl__vkb_devtype, &vkb); -libxl_device_vkb_dispose (&vkb); +if (libxl_defbool_val (d_config->b_info.u.hvm.vkb_device)) { +libxl_device_vkb_init (&vkb); +libxl__device_add (gc, domid, &libxl__vkb_devtype, &vkb); +libxl_device_vkb_dispose (&vkb); + } dcs->sdss.dm.guest_domid = domid;if (libxl_defbool_val (d_config->b_info.device_model_stubdomain))tools/libxl/libxl_types.idl +1
-0@@ -583,6 +583,7 @@ libxl_domain_build_info = Struct("domain_build_info",[ # - "tablet" for absolute mouse, # - "mouse" for PS/2 protocol relative mouse ("usbdevice", string), + ("vkb_device", libxl_defbool), ("soundhw", string), ("xen_platform_pci", libxl_defbool), ("usbdevice_list", libxl_string_list),tools/xl/xl_parse.c +0
-0
tools/xl/xl_parse.c skip_usbdev: · line 2658
Quoted 7 lines
tools/xl/xl_parse.c +1
-0@@ -2652,6 +2652,7 @@ skip_usbdev:fprintf (stderr,"xl: Unable to parse usbdevice.\n" );exit (-ERROR_FAIL ); } +xlu_cfg_get_defbool (config,"vkb_device" , &b_info->u.hvm.vkb_device,0 );xlu_cfg_replace_string (config,"soundhw" , &b_info->u.hvm.soundhw,0 );xlu_cfg_get_defbool (config,"xen_platform_pci" , &b_info->u.hvm.xen_platform_pci,0 );
Oh here it is the code which uses the new field -- in that case, you also need to document this in xl manpage.
The manpage is docs/man/xl.conf.pod.5.
Sorry for not having mentioned this earlier: we also ask for an accompanying macro for the new field in the public interface. See various LIBXL_HAVE macros in libxl.h.
Let me know if you have further questions.
Wei.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
On 13. May 2019, at 12:48, Wei Liu <[email protected]<mailto:[email protected]>> wrote:
On Tue, May 07, 2019 at 01:53:20PM +0000, Eslam Elnikety wrote:
Each HVM guest currently gets a vkbd frontend/backend pair (c/s ebbd2561b4c). This consumes host resources unnecessarily for guests that have no use for vkbd. Make this behaviour tunable to allow an administrator to choose. The commit retains the current behaviour -- HVM guests still get vkdb unless specified otherwise.
---
Changes in v2:
- Added a missing hunk / setting vkb_device per config
---
tools/libxl/libxl_create.c | 9 ++++++--- tools/libxl/libxl_types.idl | 1 + tools/xl/xl_parse.c | 1 + tools/xl/xl_sxp.c | 2 ++ 4 files changed, 10 insertions(+), 3 deletions(-)
tools/libxl/libxl_create.c +6 -3
@@ -310,6 +310,7 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,libxl_defbool_setdefault (&b_info->u.hvm.vpt_align, true);libxl_defbool_setdefault (&b_info->u.hvm.altp2m, false);libxl_defbool_setdefault (&b_info->u.hvm.usb, false); +libxl_defbool_setdefault (&b_info->u.hvm.vkb_device, true);libxl_defbool_setdefault (&b_info->u.hvm.xen_platform_pci, true);libxl_defbool_setdefault (&b_info->u.hvm.spice.enable, false);
@@ -1416,9 +1417,11 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev,libxl__device_console_add (gc, domid, &console, state, &device);libxl__device_console_dispose (&console); -libxl_device_vkb_init (&vkb); -libxl__device_add (gc, domid, &libxl__vkb_devtype, &vkb); -libxl_device_vkb_dispose (&vkb); +if (libxl_defbool_val (d_config->b_info.u.hvm.vkb_device)) { +libxl_device_vkb_init (&vkb); +libxl__device_add (gc, domid, &libxl__vkb_devtype, &vkb); +libxl_device_vkb_dispose (&vkb); + } dcs->sdss.dm.guest_domid = domid;if (libxl_defbool_val (d_config->b_info.device_model_stubdomain))
tools/libxl/libxl_types.idl +1 -0
@@ -583,6 +583,7 @@ libxl_domain_build_info = Struct("domain_build_info",[ # - "tablet" for absolute mouse, # - "mouse" for PS/2 protocol relative mouse ("usbdevice", string), + ("vkb_device", libxl_defbool), ("soundhw", string), ("xen_platform_pci", libxl_defbool), ("usbdevice_list", libxl_string_list),
tools/xl/xl_parse.c +1 -0
@@ -2652,6 +2652,7 @@ skip_usbdev:fprintf (stderr,"xl: Unable to parse usbdevice.\n" );exit (-ERROR_FAIL ); } +xlu_cfg_get_defbool (config,"vkb_device" , &b_info->u.hvm.vkb_device,0 );xlu_cfg_replace_string (config,"soundhw" , &b_info->u.hvm.soundhw,0 );xlu_cfg_get_defbool (config,"xen_platform_pci" , &b_info->u.hvm.xen_platform_pci,0 );
Oh here it is the code which uses the new field -- in that case, you also need to document this in xl manpage.
The manpage is docs/man/xl.conf.pod.5.
Sorry for not having mentioned this earlier: we also ask for an accompanying macro for the new field in the public interface. See various LIBXL_HAVE macros in libxl.h.
Let me know if you have further questions.
Wei.
Thanks for the feedback. Sending v3 now.
Cheers,
Eslam
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel