From patchwork Fri Dec 9 17:55:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Durrant X-Patchwork-Id: 9468871 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id F1E55602F0 for ; Fri, 9 Dec 2016 18:21:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EA27C2863E for ; Fri, 9 Dec 2016 18:21:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DF3BF28680; Fri, 9 Dec 2016 18:21:01 +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, 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 AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BB0102863E for ; Fri, 9 Dec 2016 18:21:00 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cFPkQ-0003Fj-8m; Fri, 09 Dec 2016 18:18:18 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cFPkP-0003Fd-UI for xen-devel@lists.xenproject.org; Fri, 09 Dec 2016 18:18:18 +0000 Received: from [193.109.254.147] by server-6.bemta-6.messagelabs.com id 05/16-28843-965FA485; Fri, 09 Dec 2016 18:18:17 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrNLMWRWlGSWpSXmKPExsXitHSDvW7GV68 Ig81bdC2+b5nM5MDocfjDFZYAxijWzLyk/IoE1oxpvacZC7bzVXx42MjSwLiQu4uRk0NCwF9i 9/e7bCA2m4COxNSnl1i7GDk4RARUJG7vNQAxmQXKJTom1IJUCAs4SNxfMJcZxGYBqmh9PJ0Rx OYVcJfYuPoxM8REOYnzx3+C2UJANeunzmKDqBGUODnzCQuIzSwgIXHwxQvmCYzcs5CkZiFJLW BkWsWoUZxaVJZapGtooJdUlJmeUZKbmJkD5Jnp5aYWFyemp+YkJhXrJefnbmIEBgIDEOxgvLc s4BCjJAeTkihvMZNXhBBfUn5KZUZicUZ8UWlOavEhRhkODiUJ3vQvQDnBotT01Iq0zBxgSMKk JTh4lER4m0HSvMUFibnFmekQqVOMilLivOEgCQGQREZpHlwbLA4uMcpKCfMyAh0ixFOQWpSbW YIq/4pRnINRSZi3FWQKT2ZeCdz0V0CLmYAWz7vhDrK4JBEhJdXA2PrRd9kK06w8p+07NxW/NX H64TaNbd3Vn7wTfLL8ypSuxS7uDfvXZs350S9l4zHlWyv7b4nt7wi5YRYx8xRT+T/lj/NvXCk LupqkbbXv7DV/Xn62XWfWmf4+fOoWs5kP76zLPfPY5b4Ws1kX5Lizfhc4addgOnOlZ8S9zooT l69Ni0hIkW95osRSnJFoqMVcVJwIAIMpFvh+AgAA X-Env-Sender: prvs=1445a9fb7=Paul.Durrant@citrix.com X-Msg-Ref: server-5.tower-27.messagelabs.com!1481307495!71119609!1 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 9.1.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 49886 invoked from network); 9 Dec 2016 18:18:16 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-5.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 9 Dec 2016 18:18:16 -0000 X-IronPort-AV: E=Sophos;i="5.33,324,1477958400"; d="scan'208";a="402822953" From: Paul Durrant To: Date: Fri, 9 Dec 2016 17:55:43 +0000 Message-ID: <1481306143-19534-1-git-send-email-paul.durrant@citrix.com> X-Mailer: git-send-email 2.1.4 MIME-Version: 1.0 Cc: Andrew Cooper , Paul Durrant , Jan Beulich Subject: [Xen-devel] [PATCH] x86/hvm: don't create a default ioreq server... 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: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP ...if the domain is not under construction. If upstream QEMU is in use then it will explicitly create an ioreq server rather than implicitly creating the default ioreq server, which is a side-effect of reading HVM_PARAM_IOREQ_PFN, HVM_PARAM_BUFIOREQ_PFN, or HVM_PARAM_BUFIOREQ_EVTCHN (as is done by legacy QEMUs). However, if the domain is subsequently saved/migrated then those parameters are read and hence the default server will be unnecessarily instantiated. This patch adds an extra check of the 'creation_finished' flag when those HVM params are read and will only instantiate the server if the domain is under construction, which will always be the case when QEMU is invoked. Signed-off-by: Paul Durrant Reviewed-by: Andrew Cooper Tested-by: Zhang Chen --- Cc: Jan Beulich Cc: Andrew Cooper --- xen/arch/x86/hvm/hvm.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index e0f936b..c531f37 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -5337,7 +5337,16 @@ static int hvmop_get_param( { domid_t domid; - /* May need to create server. */ + /* + * It may be necessary to create a default ioreq server here, + * because legacy versions of QEMU are not aware of the new API + * for explicit ioreq server creation. However, if the domain + * is not under construction then it will not be QEMU querying + * the parameters and thus the query should have that side-effect. + */ + if ( d->creation_finished ) + break; + domid = d->arch.hvm_domain.params[HVM_PARAM_DM_DOMAIN]; rc = hvm_create_ioreq_server(d, domid, 1, HVM_IOREQSRV_BUFIOREQ_LEGACY, NULL);