From: Andrew Cooper Subject: [PATCH] x86/vmx: Improvements to vmentry failure handling Date: Fri, 23 Oct 2015 18:52:37 +0100 Message-ID: <1445622757-850-1-git-send-email-andrew.cooper3@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Xen-devel Cc: Andrew Cooper , Kevin Tian , Jun Nakajima , Jan Beulich List-Id: xen-devel@lists.xenproject.org Combine the almost identical vm_launch_fail() and vm_resume_fail() into a single vmx_vmentry_failure(). Re-save all GPRs so that domain_crash() prints the real register values, rather than the active stack of the vmx_vmentry_failure() callpath. Signed-off-by: Andrew Cooper --- CC: Jan Beulich CC: Jun Nakajima CC: Kevin Tian --- xen/arch/x86/hvm/vmx/entry.S | 9 +++++---- xen/arch/x86/hvm/vmx/vmcs.c | 15 ++++----------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/xen/arch/x86/hvm/vmx/entry.S b/xen/arch/x86/hvm/vmx/entry.S index 2a4ed57..a5438a4 100644 --- a/xen/arch/x86/hvm/vmx/entry.S +++ b/xen/arch/x86/hvm/vmx/entry.S @@ -101,14 +101,15 @@ UNLIKELY_END(realmode) /*.Lvmx_resume:*/ VMRESUME - sti - call vm_resume_fail - ud2 + jmp .Lvmx_vmentry_fail .Lvmx_launch: VMLAUNCH + +.Lvmx_vmentry_fail: sti - call vm_launch_fail + SAVE_ALL + call vmx_vmentry_failure ud2 ENTRY(vmx_asm_do_vmentry) diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c index 62e405f..7beac12 100644 --- a/xen/arch/x86/hvm/vmx/vmcs.c +++ b/xen/arch/x86/hvm/vmx/vmcs.c @@ -1588,21 +1588,14 @@ void vmx_destroy_vmcs(struct vcpu *v) free_xenheap_page(v->arch.hvm_vmx.msr_bitmap); } -void vm_launch_fail(void) -{ - unsigned long error; - - __vmread(VM_INSTRUCTION_ERROR, &error); - printk(" error code %lx\n", error); - domain_crash_synchronous(); -} - -void vm_resume_fail(void) +void vmx_vmentry_failure(void) { + struct vcpu *curr = current; unsigned long error; __vmread(VM_INSTRUCTION_ERROR, &error); - printk(" error code %lx\n", error); + printk(XENLOG_ERR "VM%s error: %#lx\n", + curr->arch.hvm_vmx.launched ? "RESUME" : "LAUNCH", error); domain_crash_synchronous(); } -- 2.1.4