Message ID | 20190507083548.27883-1-elnikety@amazon.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | libxl: make vkbd tunable for HVM guests | expand |
On Tue, May 07, 2019 at 08:35:48AM +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. > > Signed-off-by: Eslam Elnikety <elnikety@amazon.com> Who / what is to set this field? It appears this patch only contains one change to xl to print out its value. > --- > tools/libxl/libxl_create.c | 9 ++++++--- > tools/libxl/libxl_types.idl | 1 + > tools/xl/xl_sxp.c | 2 ++ > 3 files changed, 9 insertions(+), 3 deletions(-) > > diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c > index 89fe80fc9c..b09244058f 100644 > --- a/tools/libxl/libxl_create.c > +++ b/tools/libxl/libxl_create.c > @@ -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) ) { No space inside if() please. Wei.
On 07.05.19, 15:17, "Wei Liu" <wei.liu2@citrix.com> wrote: On Tue, May 07, 2019 at 08:35:48AM +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. > > Signed-off-by: Eslam Elnikety <elnikety@amazon.com> Who / what is to set this field? It appears this patch only contains one change to xl to print out its value. Missed a hunk when preparing the patch. Sending v2 now .. > --- > tools/libxl/libxl_create.c | 9 ++++++--- > tools/libxl/libxl_types.idl | 1 + > tools/xl/xl_sxp.c | 2 ++ > 3 files changed, 9 insertions(+), 3 deletions(-) > > diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c > index 89fe80fc9c..b09244058f 100644 > --- a/tools/libxl/libxl_create.c > +++ b/tools/libxl/libxl_create.c > @@ -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) ) { No space inside if() please. Yup -- Will fix in v2. Wei.
diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index 89fe80fc9c..b09244058f 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -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)) diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl index b685ac47ac..9a0b92f1d4 100644 --- a/tools/libxl/libxl_types.idl +++ b/tools/libxl/libxl_types.idl @@ -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), diff --git a/tools/xl/xl_sxp.c b/tools/xl/xl_sxp.c index 3e6117d0cd..359a001570 100644 --- a/tools/xl/xl_sxp.c +++ b/tools/xl/xl_sxp.c @@ -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:
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 <elnikety@amazon.com> --- tools/libxl/libxl_create.c | 9 ++++++--- tools/libxl/libxl_types.idl | 1 + tools/xl/xl_sxp.c | 2 ++ 3 files changed, 9 insertions(+), 3 deletions(-)