From patchwork Tue May 7 13:53:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eslam Elnikety X-Patchwork-Id: 10933039 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C93391390 for ; Tue, 7 May 2019 13:55:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B81A428396 for ; Tue, 7 May 2019 13:55:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AA89E283C9; Tue, 7 May 2019 13:55:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_ADSP_ALL, DKIM_INVALID,DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3735028396 for ; Tue, 7 May 2019 13:55:15 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hO0XT-000874-3D; Tue, 07 May 2019 13:53:47 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hO0XR-00086y-Uh for xen-devel@lists.xenproject.org; Tue, 07 May 2019 13:53:45 +0000 X-Inumbo-ID: 8354c690-70cf-11e9-80c6-ab741627a37c Received: from smtp-fw-9102.amazon.com (unknown [207.171.184.29]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 8354c690-70cf-11e9-80c6-ab741627a37c; Tue, 07 May 2019 13:53:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1557237218; x=1588773218; h=from:to:cc:subject:date:message-id:mime-version; bh=9XzVmwmU4ascT+jYvF6xzK897xYq8gwXyd8KcynMD5I=; b=CgSTqHftCShXnL6PspU3IbGYPc7pn9xlfeMy/gloQfrpdvjSl/TEIuLV 5Pv4GfFwAQjvE75ILCY9awKdka0fVOv3n4wS6WaeJwguof3GRDNMHIlkq gWe+kObf4F0Nt4gkGkPjqxmBbn+QO0qM30MG/f9NDGOz+tQJtvxkaZteb k=; X-IronPort-AV: E=Sophos;i="5.60,441,1549929600"; d="scan'208";a="673056707" Received: from sea3-co-svc-lb6-vlan3.sea.amazon.com (HELO email-inbound-relay-1d-38ae4ad2.us-east-1.amazon.com) ([10.47.22.38]) by smtp-border-fw-out-9102.sea19.amazon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 07 May 2019 13:53:34 +0000 Received: from EX13MTAUEA001.ant.amazon.com (iad55-ws-svc-p15-lb9-vlan2.iad.amazon.com [10.40.159.162]) by email-inbound-relay-1d-38ae4ad2.us-east-1.amazon.com (8.14.7/8.14.7) with ESMTP id x47DrTup027908 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL); Tue, 7 May 2019 13:53:33 GMT Received: from EX13D18EUC002.ant.amazon.com (10.43.164.50) by EX13MTAUEA001.ant.amazon.com (10.43.61.243) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Tue, 7 May 2019 13:53:32 +0000 Received: from EX13MTAUWB001.ant.amazon.com (10.43.161.207) by EX13D18EUC002.ant.amazon.com (10.43.164.50) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Tue, 7 May 2019 13:53:30 +0000 Received: from dev-dsk-elnikety-1c-28a13cba.eu-west-1.amazon.com (10.15.5.186) by mail-relay.amazon.com (10.43.161.249) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Tue, 7 May 2019 13:53:29 +0000 Received: by dev-dsk-elnikety-1c-28a13cba.eu-west-1.amazon.com (Postfix, from userid 6438462) id CAC22463E2; Tue, 7 May 2019 13:53:28 +0000 (UTC) From: Eslam Elnikety To: Date: Tue, 7 May 2019 13:53:20 +0000 Message-ID: <20190507135320.103953-1-elnikety@amazon.com> X-Mailer: git-send-email 2.15.3.AMZN MIME-Version: 1.0 Precedence: Bulk Subject: [Xen-devel] [PATCH v2] libxl: make vkbd tunable for HVM guests X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Wei Liu , Ian Jackson , Eslam Elnikety , Amit Shah Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 Signed-off-by: Eslam Elnikety > 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: