From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xen.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
Kevin Tian <kevin.tian@intel.com>,
Jun Nakajima <jun.nakajima@intel.com>,
Jan Beulich <JBeulich@suse.com>
Subject: [PATCH] x86/VT-x: Dump VMCS on VMLAUNCH/VMRESUME failure
Date: Fri, 1 Jul 2016 18:52:54 +0100 [thread overview]
Message-ID: <1467395574-15074-1-git-send-email-andrew.cooper3@citrix.com> (raw)
If a VMLAUNCH/VMRESUME fails due to invalid control or host state, dump the
VMCS before crashing the domain.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Jun Nakajima <jun.nakajima@intel.com>
CC: Kevin Tian <kevin.tian@intel.com>
---
xen/arch/x86/hvm/vmx/vmcs.c | 5 +++++
xen/include/asm-x86/hvm/vmx/vmcs.h | 4 ++++
2 files changed, 9 insertions(+)
diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index 46b63b6..1bd875a 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -1637,6 +1637,11 @@ void vmx_vmentry_failure(void)
__vmread(VM_INSTRUCTION_ERROR, &error);
gprintk(XENLOG_ERR, "VM%s error: %#lx\n",
curr->arch.hvm_vmx.launched ? "RESUME" : "LAUNCH", error);
+
+ if ( error == VMX_INSN_INVALID_CONTROL_STATE ||
+ error == VMX_INSN_INVALID_HOST_STATE )
+ vmcs_dump_vcpu(curr);
+
domain_crash_synchronous();
}
diff --git a/xen/include/asm-x86/hvm/vmx/vmcs.h b/xen/include/asm-x86/hvm/vmx/vmcs.h
index 9f1729d..1e33d9c 100644
--- a/xen/include/asm-x86/hvm/vmx/vmcs.h
+++ b/xen/include/asm-x86/hvm/vmx/vmcs.h
@@ -567,6 +567,10 @@ enum vmcs_field {
#define VMX_GUEST_MSR 0
#define VMX_HOST_MSR 1
+/* VM Instruction error numbers. */
+#define VMX_INSN_INVALID_CONTROL_STATE 7
+#define VMX_INSN_INVALID_HOST_STATE 8
+
void vmx_disable_intercept_for_msr(struct vcpu *v, u32 msr, int type);
void vmx_enable_intercept_for_msr(struct vcpu *v, u32 msr, int type);
int vmx_read_guest_msr(u32 msr, u64 *val);
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next reply other threads:[~2016-07-01 17:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-01 17:52 Andrew Cooper [this message]
2016-07-04 6:25 ` [PATCH] x86/VT-x: Dump VMCS on VMLAUNCH/VMRESUME failure Tian, Kevin
2016-07-04 8:24 ` Jan Beulich
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=1467395574-15074-1-git-send-email-andrew.cooper3@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.com \
--cc=jun.nakajima@intel.com \
--cc=kevin.tian@intel.com \
--cc=xen-devel@lists.xen.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).