]> xenbits.xensource.com Git - xen.git/commitdiff
Nested VMX: load current_vmcs only when it exists
authorEdmund H White <edmund.h.white@intel.com>
Mon, 12 May 2014 09:59:19 +0000 (11:59 +0200)
committerJan Beulich <jbeulich@suse.com>
Mon, 12 May 2014 09:59:19 +0000 (11:59 +0200)
There may not have valid vmcs on current CPU. So only load it when it exists.

This original fixing is from Edmud <edmund.h.white@intel.com>.

Signed-off-by: Edmund H White <edmund.h.white@intel.com>
Signed-off-by: Yang Zhang <yang.z.zhang@Intel.com>
Acked-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/hvm/vmx/vmcs.c

index cc84ca276c3e8833ab4ae5f54ee45387642944d8..756489589210cd0de70cbb1817081bb4357bf6af 100644 (file)
@@ -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)