From 47a5554201f0bc1778e5bcbde8c39088707f727f Mon Sep 17 00:00:00 2001 From: Mukesh Rathor Date: Mon, 3 Feb 2014 11:45:52 -0500 Subject: [PATCH] pvh: Fix regression caused by assumption that HVM paths MUST use io-backend device. The commit 09bb434748af9bfe3f7fca4b6eef721a7d5042a4 "Nested VMX: prohibit virtual vmentry/vmexit during IO emulation" assumes that the HVM paths are only taken by HVM guests. With the PVH enabled that is no longer the case - which means that we do not have to have the IO-backend device (QEMU) enabled. As such, that patch can crash the hypervisor: Xen call trace: [] nvmx_switch_guest+0x4d/0x903 [] vmx_asm_vmexit_handler+0x4b/0xc0 Pagetable walk from 000000000000001e: L4[0x000] = 0000000000000000 ffffffffffffffff **************************************** Panic on CPU 7: FATAL PAGE FAULT [error_code=0000] Faulting linear address: 000000000000001e **************************************** as we do not have an io based backend. CC: Yang Zhang CC: Jun Nakajima Signed-off-by: Mukesh Rathor Signed-off-by: Konrad Rzeszutek Wilk --- xen/arch/x86/hvm/vmx/vvmx.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c index d2ba435..563b02f 100644 --- a/xen/arch/x86/hvm/vmx/vvmx.c +++ b/xen/arch/x86/hvm/vmx/vvmx.c @@ -1394,13 +1394,14 @@ void nvmx_switch_guest(void) struct vcpu *v = current; struct nestedvcpu *nvcpu = &vcpu_nestedhvm(v); struct cpu_user_regs *regs = guest_cpu_user_regs(); + ioreq_t *ioreq = get_ioreq(v); /* * a pending IO emualtion may still no finished. In this case, * no virtual vmswith is allowed. Or else, the following IO * emulation will handled in a wrong VCPU context. */ - if ( get_ioreq(v)->state != STATE_IOREQ_NONE ) + if ( ioreq && ioreq->state != STATE_IOREQ_NONE ) return; /* * a softirq may interrupt us between a virtual vmentry is -- 1.7.7.6