[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-3.4-testing] x86/vmx: don't call __vmxoff() blindly



# HG changeset patch
# User Keith Coleman <keith.coleman@xxxxxxxxxxxxx>
# Date 1325655120 18000
# Node ID c96f1d6f98d0aea013085cf933b6c9e01a6dadfd
# Parent  0a06336fd9f857778b6666aacd5258c83c6f7574
x86/vmx: don't call __vmxoff() blindly

If vmx_vcpu_up() failed, __vmxon() would generally not have got
(successfully) executed, and in that case __vmxoff() will #UD.

Additionally, any panic() during early resume (namely the tboot
related one) would cause vmx_cpu_down() to get executed without
vmx_cpu_up() having run before.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
xen-unstable changeset:   23848:cf37d2eec2ef
xen-unstable date:        Sat Sep 17 16:26:37 2011 +0100
---


diff -r 0a06336fd9f8 -r c96f1d6f98d0 xen/arch/x86/hvm/vmx/vmcs.c
--- a/xen/arch/x86/hvm/vmx/vmcs.c       Wed Jan 04 00:15:47 2012 -0500
+++ b/xen/arch/x86/hvm/vmx/vmcs.c       Wed Jan 04 00:32:00 2012 -0500
@@ -53,6 +53,7 @@
 static DEFINE_PER_CPU(struct vmcs_struct *, host_vmcs);
 static DEFINE_PER_CPU(struct vmcs_struct *, current_vmcs);
 static DEFINE_PER_CPU(struct list_head, active_vmcs_list);
+static DEFINE_PER_CPU(bool_t, vmxon);
 
 static u32 vmcs_revision_id __read_mostly;
 
@@ -375,6 +376,7 @@
         printk("CPU%d: unexpected VMXON failure\n", cpu);
         return 0;
     case 0: /* success */
+        this_cpu(vmxon) = 1;
         break;
     default:
         BUG();
@@ -392,6 +394,9 @@
     struct list_head *active_vmcs_list = &this_cpu(active_vmcs_list);
     unsigned long flags;
 
+    if ( !this_cpu(vmxon) )
+        return;
+
     local_irq_save(flags);
 
     while ( !list_empty(active_vmcs_list) )
@@ -399,6 +404,7 @@
                                     struct vcpu, arch.hvm_vmx.active_list));
 
     BUG_ON(!(read_cr4() & X86_CR4_VMXE));
+    this_cpu(vmxon) = 0;
     __vmxoff();
 
     local_irq_restore(flags);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.