From patchwork Mon Mar 20 17:08:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Durrant X-Patchwork-Id: 9634603 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 8C00960132 for ; Mon, 20 Mar 2017 17:11:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 778D420453 for ; Mon, 20 Mar 2017 17:11:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6BF6327D4D; Mon, 20 Mar 2017 17:11:11 +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 02E4820453 for ; Mon, 20 Mar 2017 17:11:11 +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 1cq0nZ-00075N-U3; Mon, 20 Mar 2017 17:08:49 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cq0nX-00074V-OP for xen-devel@lists.xenproject.org; Mon, 20 Mar 2017 17:08:47 +0000 Received: from [85.158.137.68] by server-8.bemta-3.messagelabs.com id FB/FC-00609-E9C00D85; Mon, 20 Mar 2017 17:08:46 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpikeJIrShJLcpLzFFi42JxWrohUncez4U Ig+a/Chbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8bVRSoFU3gr7pz9xdzAOJW7i5GTQ0LAX2LC s71sIDabgI7E1KeXWLsYOThEBFQkbu81ADGZBcolOibUglQIC4RK/L3/jRXEZhFQlVjzeQFYJ 6+Am8TrhrWsEBPlJM4f/8kMYnMKuEvse3abBcQWAqp5uGQPI4StIrF+6iyoXkGJkzOfgNUwC0 hIHHzxgnkCI+8sJKlZSFILGJlWMWoUpxaVpRbpGpnrJRVlpmeU5CZm5ugaGhjr5aYWFyemp+Y kJhXrJefnbmIEhk09AwPjDsaWvX6HGCU5mJREeVUET0QI8SXlp1RmJBZnxBeV5qQWH2KU4eBQ kuCdshAoJ1iUmp5akZaZAwxgmLQEB4+SCO9UkDRvcUFibnFmOkTqFKOilDjvI5CEAEgiozQPr g0WNZcYZaWEeRkZGBiEeApSi3IzS1DlXzGKczAqCfNqLwKawpOZVwI3/RXQYiagxYk/j4AsLk lESEk1MGb1NrLUtE4Kv8Rwdn7o2dtfb7XXrHneGBKXoHDxBk9a+Ptqv/f24tPPek4+IGX31cP M4P2pewvKT605lOzIV7DMiDmFV4Rz7noFoSXv1wrZ2U/4xLagQ/XG9eUmGap5U7Pfn/R7duBo wMWyoO1vy84ci58Ydykku+8yv6Ng45q0sntOAV0zuZRYijMSDbWYi4oTAVBZQ22VAgAA X-Env-Sender: prvs=245da84ed=Paul.Durrant@citrix.com X-Msg-Ref: server-4.tower-31.messagelabs.com!1490029723!33058188!2 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 9.2.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 63539 invoked from network); 20 Mar 2017 17:08:46 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-4.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 20 Mar 2017 17:08:46 -0000 X-IronPort-AV: E=Sophos;i="5.36,195,1486425600"; d="scan'208";a="415033664" From: Paul Durrant To: Date: Mon, 20 Mar 2017 17:08:16 +0000 Message-ID: <1490029701-4311-2-git-send-email-paul.durrant@citrix.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1490029701-4311-1-git-send-email-paul.durrant@citrix.com> References: <1490029701-4311-1-git-send-email-paul.durrant@citrix.com> MIME-Version: 1.0 Cc: Andrew Cooper , Paul Durrant , Jan Beulich Subject: [Xen-devel] [PATCH v2 1/6] x86/viridian: fix xen-hvmcrash when vp_assist page is present 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 Currently use of xen-hvmcrash will cause an immediate domain_crash() in initialize_vp_assist() because it is called from viridian_load_vcpu_ctxt() without having first cleared any previous mapping. This patch addes a check into viridian_load_vcpu_ctxt() to avoid re- initialization and turned the domain_crash() in initialize_vp_assist() into an ASSERT() since neither codepath into that function should allow it to be hit. Signed-off-by: Paul Durrant --- Cc: Jan Beulich Cc: Andrew Cooper v2: - Patch significantly simplified --- xen/arch/x86/hvm/viridian.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/hvm/viridian.c b/xen/arch/x86/hvm/viridian.c index f2c9613..3a2611b 100644 --- a/xen/arch/x86/hvm/viridian.c +++ b/xen/arch/x86/hvm/viridian.c @@ -283,6 +283,8 @@ static void initialize_vp_assist(struct vcpu *v) struct page_info *page = get_page_from_gfn(d, gmfn, NULL, P2M_ALLOC); void *va; + ASSERT(!v->arch.hvm_vcpu.viridian.vp_assist.va); + /* * See section 7.8.7 of the specification for details of this * enlightenment. @@ -904,7 +906,8 @@ static int viridian_load_vcpu_ctxt(struct domain *d, hvm_domain_context_t *h) return -EINVAL; v->arch.hvm_vcpu.viridian.vp_assist.msr.raw = ctxt.vp_assist_msr; - if ( v->arch.hvm_vcpu.viridian.vp_assist.msr.fields.enabled ) + if ( v->arch.hvm_vcpu.viridian.vp_assist.msr.fields.enabled && + !v->arch.hvm_vcpu.viridian.vp_assist.va ) initialize_vp_assist(v); v->arch.hvm_vcpu.viridian.vp_assist.vector = ctxt.vp_assist_vector;