xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Paul Durrant <paul.durrant@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	Paul Durrant <paul.durrant@citrix.com>,
	Jan Beulich <jbeulich@suse.com>
Subject: [PATCH v2 1/6] x86/viridian: fix xen-hvmcrash when vp_assist page is present
Date: Mon, 20 Mar 2017 17:08:16 +0000	[thread overview]
Message-ID: <1490029701-4311-2-git-send-email-paul.durrant@citrix.com> (raw)
In-Reply-To: <1490029701-4311-1-git-send-email-paul.durrant@citrix.com>

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 <paul.durrant@citrix.com>
---
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>

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;
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2017-03-20 17:08 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-20 17:08 [PATCH v2 0/6] viridian updates Paul Durrant
2017-03-20 17:08 ` Paul Durrant [this message]
2017-03-21 15:26   ` [PATCH v2 1/6] x86/viridian: fix xen-hvmcrash when vp_assist page is present Jan Beulich
2017-03-21 15:28     ` Paul Durrant
2017-03-20 17:08 ` [PATCH v2 2/6] x86/viridian: don't put Xen version information in CPUID leaf 2 Paul Durrant
2017-03-21 15:29   ` Jan Beulich
2017-03-21 15:45     ` Paul Durrant
2017-03-21 16:18       ` Jan Beulich
2017-03-20 17:08 ` [PATCH v2 3/6] x86/viridian: get rid of the magic numbers in CPUID leaves 1 and 2 Paul Durrant
2017-03-21 15:30   ` Jan Beulich
2017-03-20 17:08 ` [PATCH v2 4/6] x86/viridian: add warnings for unimplemented hypercalls and MSRs Paul Durrant
2017-03-21 15:32   ` Jan Beulich
2017-03-21 15:48     ` Paul Durrant
2017-03-20 17:08 ` [PATCH v2 5/6] x86/viridian: make the threshold for HvNotifyLongSpinWait tunable Paul Durrant
2017-03-21 15:35   ` Jan Beulich
2017-03-21 15:46     ` Paul Durrant
2017-03-20 17:08 ` [PATCH v2 6/6] x86/viridian: implement the crash MSRs Paul Durrant
2017-03-21 15:41   ` Jan Beulich
2017-03-21 15:50     ` Paul Durrant
2017-03-21 17:05   ` Wei Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1490029701-4311-2-git-send-email-paul.durrant@citrix.com \
    --to=paul.durrant@citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).