]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
libxl: make vkbd tunable for HVM guests
authorEslam Elnikety <elnikety@amazon.com>
Tue, 14 May 2019 08:43:25 +0000 (08:43 +0000)
committerWei Liu <wei.liu2@citrix.com>
Wed, 15 May 2019 09:46:25 +0000 (10:46 +0100)
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>
Acked-by: Wei Liu <wei.liu2@citrix.com>
docs/man/xl.cfg.5.pod.in
tools/libxl/libxl.h
tools/libxl/libxl_create.c
tools/libxl/libxl_types.idl
tools/xl/xl_parse.c
tools/xl/xl_sxp.c

index c7d70e618b8b1a702020b53caff711ae24507d94..c99d40307e9d0afe1677032cf15a475fe8d92bd4 100644 (file)
@@ -2423,6 +2423,10 @@ devices are defined by the device model configuration, please see the
 B<qemu(1)> manpage for details. The default is not to export any sound
 device.
 
+=item B<vkb_device=BOOLEAN>
+
+Specifies that the HVM guest gets a vkdb. The default is true (1).
+
 =item B<usb=BOOLEAN>
 
 Enables or disables an emulated USB bus in the guest.
index e0f6916b6651acb86fdc4f6158de108c3bd85585..bab5be4bf8ff35ba928bacc43020196288c0bf80 100644 (file)
@@ -656,6 +656,15 @@ typedef struct libxl__ctx libxl_ctx;
  */
 #define LIBXL_HAVE_BUILDINFO_VCPU_AFFINITY_ARRAYS 1
 
+/*
+ * LIBXL_HAVE_BUILDINFO_VKB_DEVICE
+ *
+ * If this is defined, then the libxl_domain_build_info structure will
+ * contain a boolean hvm.vkb_device which instructs libxl whether to include
+ * a vkbd at build time or not.
+ */
+#define LIBXL_HAVE_BUILDINFO_VKB_DEVICE 1
+
 /*
  * LIBXL_HAVE_BUILDINFO_USBDEVICE_LIST
  *
index 64336b0d29118cd5fc526e5eb847203b01f21bde..89f99f7f4412cf0d231721247e1fefe6ca14c469 100644 (file)
@@ -335,6 +335,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);
@@ -1447,9 +1448,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))
index 75bde095bc37fdd14d57fdb0c87c314b5b0d7aba..06b8f49aba07b4194faec0146b807094d68b8faf 100644 (file)
@@ -587,6 +587,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),
index 352cd214ddf58b94a752d1748e23493d2155e2d2..e105bda2bb11877561fed62d58cacaf24b82ca48 100644 (file)
@@ -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);
index 3e6117d0cd61eeddda2bc48bec355b30fadfd3ed..359a0015709ee5de6590968ab0786f8c1aac1e4e 100644 (file)
@@ -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: