From: Edmund H White Date: Mon, 12 May 2014 09:59:19 +0000 (+0200) Subject: Nested VMX: load current_vmcs only when it exists X-Git-Tag: 4.5.0-rc1~880 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=99c03bc6a1f8c6722926d2db781ece045f9d09ae;p=xen.git Nested VMX: load current_vmcs only when it exists There may not have valid vmcs on current CPU. So only load it when it exists. This original fixing is from Edmud . Signed-off-by: Edmund H White Signed-off-by: Yang Zhang Acked-by: Kevin Tian Reviewed-by: Andrew Cooper --- diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c index cc84ca276c..7564895892 100644 --- a/xen/arch/x86/hvm/vmx/vmcs.c +++ b/xen/arch/x86/hvm/vmx/vmcs.c @@ -824,8 +824,12 @@ void virtual_vmcs_enter(void *vvmcs) void virtual_vmcs_exit(void *vvmcs) { + struct vmcs_struct *cur = this_cpu(current_vmcs); + __vmpclear(pfn_to_paddr(domain_page_map_to_mfn(vvmcs))); - __vmptrld(virt_to_maddr(this_cpu(current_vmcs))); + if ( cur ) + __vmptrld(virt_to_maddr(cur)); + } u64 virtual_vmcs_vmread(void *vvmcs, u32 vmcs_encoding)