From patchwork Thu Mar 10 15:00:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?SsO8cmdlbiBHcm/Dnw==?= X-Patchwork-Id: 8557691 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 072819F46A for ; Thu, 10 Mar 2016 15:04:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 19E0B20382 for ; Thu, 10 Mar 2016 15:04:15 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1619320380 for ; Thu, 10 Mar 2016 15:04:13 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xen.org with esmtp (Exim 4.84) (envelope-from ) id 1ae25B-0005tG-H3; Thu, 10 Mar 2016 15:00:57 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.84) (envelope-from ) id 1ae25A-0005sy-GR for xen-devel@lists.xen.org; Thu, 10 Mar 2016 15:00:56 +0000 Received: from [85.158.137.68] by server-17.bemta-3.messagelabs.com id 33/E9-03109-72C81E65; Thu, 10 Mar 2016 15:00:55 +0000 X-Env-Sender: jgross@suse.com X-Msg-Ref: server-3.tower-31.messagelabs.com!1457622055!28231645!1 X-Originating-IP: [195.135.220.15] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.11; banners=-,-,- X-VirusChecked: Checked Received: (qmail 63437 invoked from network); 10 Mar 2016 15:00:55 -0000 Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by server-3.tower-31.messagelabs.com with DHE-RSA-CAMELLIA256-SHA encrypted SMTP; 10 Mar 2016 15:00:55 -0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 637A2AD14; Thu, 10 Mar 2016 15:00:54 +0000 (UTC) From: Juergen Gross To: xen-devel@lists.xen.org Date: Thu, 10 Mar 2016 16:00:50 +0100 Message-Id: <1457622051-30189-3-git-send-email-jgross@suse.com> X-Mailer: git-send-email 2.6.2 In-Reply-To: <1457622051-30189-1-git-send-email-jgross@suse.com> References: <1457622051-30189-1-git-send-email-jgross@suse.com> Cc: Juergen Gross , wei.liu2@citrix.com, ian.jackson@eu.citrix.com, cyliu@suse.com, stefano.stabellini@eu.citrix.com Subject: [Xen-devel] [PATCH 2/3] libxl: add domain config parameter to force start of qemu X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Today the device model (qemu) is started for a pv domain only in case a device requiring qemu is specified in the domain configuration (qdisk, vfb, channel). If there is no such device the device model isn't started and hence it is possible to add such a device to the domain later. Add a domain configuration parameter to specify the device model is to be started in any case. This will enable adding devices with a qemu based backend later. While the optimal solution would be to start the device model automatically when needed this would require some major rework of libxl at multiple places. Signed-off-by: Juergen Gross --- docs/man/xl.cfg.pod.5 | 6 ++++++ tools/libxl/libxl_create.c | 1 + tools/libxl/libxl_dm.c | 5 +++++ tools/libxl/libxl_types.idl | 1 + tools/libxl/xl_cmdimpl.c | 3 +++ 5 files changed, 16 insertions(+) diff --git a/docs/man/xl.cfg.pod.5 b/docs/man/xl.cfg.pod.5 index b156caa..1dde66b 100644 --- a/docs/man/xl.cfg.pod.5 +++ b/docs/man/xl.cfg.pod.5 @@ -1939,6 +1939,12 @@ xen-qemudepriv-domid$domid or xen-qemudepriv-shared or root. Please note that running QEMU as non-root causes migration and PCI passthrough not to work properly. +=item B + +If true, start the device model for paravirtualized domains even if this isn't +required according to the configured devices. This allows to add such devices +later when the domain is already running. + =back =head2 Keymaps diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index 0e2b0a0..52a0a2f 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -73,6 +73,7 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc, return ERROR_INVAL; } + libxl_defbool_setdefault(&b_info->device_model_always, false); libxl_defbool_setdefault(&b_info->device_model_stubdomain, false); if (libxl_defbool_val(b_info->device_model_stubdomain) && diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c index 4b840f4..637b11d 100644 --- a/tools/libxl/libxl_dm.c +++ b/tools/libxl/libxl_dm.c @@ -2115,6 +2115,11 @@ int libxl__need_xenpv_qemu(libxl__gc *gc, libxl_domain_config *d_config) ret = libxl__get_domid(gc, &domid); if (ret) goto out; + if (libxl_defbool_val(d_config->b_info.device_model_always)) { + ret = 1; + goto out; + } + if (d_config->num_vfbs > 0) { ret = 1; goto out; diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl index 2a99eeb..b0a9776 100644 --- a/tools/libxl/libxl_types.idl +++ b/tools/libxl/libxl_types.idl @@ -450,6 +450,7 @@ libxl_domain_build_info = Struct("domain_build_info",[ ("device_model_ssidref", uint32), ("device_model_ssid_label", string), ("device_model_user", string), + ("device_model_always", libxl_defbool), # extra parameters pass directly to qemu, NULL terminated ("extra", libxl_string_list), diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index a3610fc..0fdca73 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -2269,6 +2269,9 @@ skip_usbdev: } /* parse device model arguments, this works for pv, hvm and stubdom */ + xlu_cfg_get_defbool (config, "device_model_always", + &b_info->device_model_always, 0); + if (!xlu_cfg_get_string (config, "device_model", &buf, 0)) { fprintf(stderr, "WARNING: ignoring device_model directive.\n"