diff mbox series

[v2] libxl: make vkbd tunable for HVM guests

Message ID 20190507135320.103953-1-elnikety@amazon.com (mailing list archive)
State Superseded
Headers show
Series [v2] libxl: make vkbd tunable for HVM guests | expand

Commit Message

Eslam Elnikety May 7, 2019, 1:53 p.m. UTC
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>

---
    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(-)

Comments

Eslam Elnikety May 13, 2019, 7:55 a.m. UTC | #1
> On 7. May 2019, at 15:53, Eslam Elnikety <elnikety@amazon.com> 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>
> 
> ---
>    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(-)
> 
> diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
> index 89fe80fc9c..03ce166f4f 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_parse.c b/tools/xl/xl_parse.c
> index 352cd214dd..e105bda2bb 100644
> --- a/tools/xl/xl_parse.c
> +++ b/tools/xl/xl_parse.c
> @@ -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);
> 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:
> -- 
> 2.15.3.AMZN
> 


Wei, any particular thoughts on v2?

Cheers,
Eslam
Wei Liu May 13, 2019, 10:48 a.m. UTC | #2
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.
> 
> Signed-off-by: Eslam Elnikety <elnikety@amazon.com>
> 
> ---
>     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(-)
> 
> diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
> index 89fe80fc9c..03ce166f4f 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_parse.c b/tools/xl/xl_parse.c
> index 352cd214dd..e105bda2bb 100644
> --- a/tools/xl/xl_parse.c
> +++ b/tools/xl/xl_parse.c
> @@ -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.
Eslam Elnikety May 14, 2019, 8:37 a.m. UTC | #3
On 13. May 2019, at 12:48, Wei Liu <wei.liu2@citrix.com<mailto:wei.liu2@citrix.com>> 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.

Signed-off-by: Eslam Elnikety <elnikety@amazon.com<mailto:elnikety@amazon.com>>

---
   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(-)

diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index 89fe80fc9c..03ce166f4f 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_parse.c b/tools/xl/xl_parse.c
index 352cd214dd..e105bda2bb 100644
--- a/tools/xl/xl_parse.c
+++ b/tools/xl/xl_parse.c
@@ -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
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<br class="">
<div>
<blockquote type="cite" class="">
<div class="">On 13. May 2019, at 12:48, Wei Liu &lt;<a href="mailto:wei.liu2@citrix.com" class="">wei.liu2@citrix.com</a>&gt; wrote:</div>
<br class="Apple-interchange-newline">
<div class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">On
 Tue, May 07, 2019 at 01:53:20PM &#43;0000, Eslam Elnikety wrote:</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">
<blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">
Each HVM guest currently gets a vkbd frontend/backend pair (c/s ebbd2561b4c).<br class="">
This consumes host resources unnecessarily for guests that have no use for<br class="">
vkbd. Make this behaviour tunable to allow an administrator to choose. The<br class="">
commit retains the current behaviour -- HVM guests still get vkdb unless<br class="">
specified otherwise.<br class="">
<br class="">
Signed-off-by: Eslam Elnikety &lt;<a href="mailto:elnikety@amazon.com" class="">elnikety@amazon.com</a>&gt;<br class="">
<br class="">
---<br class="">
&nbsp;&nbsp;&nbsp;Changes in v2:<br class="">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- Added a missing hunk / setting vkb_device per config<br class="">
---<br class="">
tools/libxl/libxl_create.c &nbsp;| 9 &#43;&#43;&#43;&#43;&#43;&#43;---<br class="">
tools/libxl/libxl_types.idl | 1 &#43;<br class="">
tools/xl/xl_parse.c &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| 1 &#43;<br class="">
tools/xl/xl_sxp.c &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| 2 &#43;&#43;<br class="">
4 files changed, 10 insertions(&#43;), 3 deletions(-)<br class="">
<br class="">
diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c<br class="">
index 89fe80fc9c..03ce166f4f 100644<br class="">
--- a/tools/libxl/libxl_create.c<br class="">
&#43;&#43;&#43; b/tools/libxl/libxl_create.c<br class="">
@@ -310,6 &#43;310,7 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,<br class="">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;libxl_defbool_setdefault(&amp;b_info-&gt;u.hvm.vpt_align, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;true);<br class="">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;libxl_defbool_setdefault(&amp;b_info-&gt;u.hvm.altp2m, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;false);<br class="">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;libxl_defbool_setdefault(&amp;b_info-&gt;u.hvm.usb, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;false);<br class="">
&#43; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;libxl_defbool_setdefault(&amp;b_info-&gt;u.hvm.vkb_device, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;true);<br class="">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;libxl_defbool_setdefault(&amp;b_info-&gt;u.hvm.xen_platform_pci, &nbsp;&nbsp;true);<br class="">
<br class="">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;libxl_defbool_setdefault(&amp;b_info-&gt;u.hvm.spice.enable, false);<br class="">
@@ -1416,9 &#43;1417,11 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *multidev,<br class="">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;libxl__device_console_add(gc, domid, &amp;console, state, &amp;device);<br class="">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;libxl__device_console_dispose(&amp;console);<br class="">
<br class="">
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;libxl_device_vkb_init(&amp;vkb);<br class="">
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;libxl__device_add(gc, domid, &amp;libxl__vkb_devtype, &amp;vkb);<br class="">
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;libxl_device_vkb_dispose(&amp;vkb);<br class="">
&#43; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (libxl_defbool_val(d_config-&gt;b_info.u.hvm.vkb_device)) {<br class="">
&#43; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;libxl_device_vkb_init(&amp;vkb);<br class="">
&#43; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;libxl__device_add(gc, domid, &amp;libxl__vkb_devtype, &amp;vkb);<br class="">
&#43; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;libxl_device_vkb_dispose(&amp;vkb);<br class="">
&#43; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br class="">
<br class="">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dcs-&gt;sdss.dm.guest_domid = domid;<br class="">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (libxl_defbool_val(d_config-&gt;b_info.device_model_stubdomain))<br class="">
diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl<br class="">
index b685ac47ac..9a0b92f1d4 100644<br class="">
--- a/tools/libxl/libxl_types.idl<br class="">
&#43;&#43;&#43; b/tools/libxl/libxl_types.idl<br class="">
@@ -583,6 &#43;583,7 @@ libxl_domain_build_info = Struct(&quot;domain_build_info&quot;,[<br class="">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# - &quot;tablet&quot; for absolute mouse,<br class="">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;# - &quot;mouse&quot; for PS/2 protocol relative mouse<br class="">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(&quot;usbdevice&quot;, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;string),<br class="">
&#43; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(&quot;vkb_device&quot;, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;libxl_defbool),<br class="">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(&quot;soundhw&quot;, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;string),<br class="">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(&quot;xen_platform_pci&quot;, libxl_defbool),<br class="">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(&quot;usbdevice_list&quot;, &nbsp;&nbsp;libxl_string_list),<br class="">
diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c<br class="">
index 352cd214dd..e105bda2bb 100644<br class="">
--- a/tools/xl/xl_parse.c<br class="">
&#43;&#43;&#43; b/tools/xl/xl_parse.c<br class="">
@@ -2652,6 &#43;2652,7 @@ skip_usbdev:<br class="">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;fprintf(stderr,&quot;xl: Unable to parse usbdevice.\n&quot;);<br class="">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;exit(-ERROR_FAIL);<br class="">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br class="">
&#43; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xlu_cfg_get_defbool(config, &quot;vkb_device&quot;, &amp;b_info-&gt;u.hvm.vkb_device, 0);<br class="">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xlu_cfg_replace_string (config, &quot;soundhw&quot;, &amp;b_info-&gt;u.hvm.soundhw, 0);<br class="">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xlu_cfg_get_defbool(config, &quot;xen_platform_pci&quot;,<br class="">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&amp;b_info-&gt;u.hvm.xen_platform_pci, 0);<br class="">
</blockquote>
<br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">
<span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Oh
 here it is the code which uses the new field -- in that case, you</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">
<span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">also
 need to document this in xl manpage.</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">
<br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">
<span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">The
 manpage is docs/man/xl.conf.pod.5.</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">
<br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">
<span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Sorry
 for not having mentioned this earlier: we also ask for an</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">
<span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">accompanying
 macro for the new field in the public interface. See</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">
<span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">various
 LIBXL_HAVE macros in libxl.h.</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">
<br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">
<span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Let
 me know if you have further questions.</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">
<br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">
<span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Wei.</span></div>
</blockquote>
</div>
<br class="">
<div class="">Thanks for the feedback. Sending v3 now.</div>
<div class=""><br class="">
</div>
<div class="">Cheers,</div>
<div class="">Eslam</div>
<div class=""><br class="">
</div>
</body>
</html>
diff mbox series

Patch

diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index 89fe80fc9c..03ce166f4f 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_parse.c b/tools/xl/xl_parse.c
index 352cd214dd..e105bda2bb 100644
--- a/tools/xl/xl_parse.c
+++ b/tools/xl/xl_parse.c
@@ -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);
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: