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

[Xen-changelog] [xen-3.4-testing] vmx: Don't enable irq for machine check vmexit handling



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1265625386 0
# Node ID 85e852ef0d7468ad7a54b5413b7ad99077de1d99
# Parent  12b5a705c29fb0af5d9ca10bcb6b3cbaeed13be2
vmx: Don't enable irq for machine check vmexit handling

We should not enable irq for machine check VMExit

In changeset 18658:824892134573, IRQ is enabled during VMExit except
external interrupt. The exception should apply for machine check also,
because :
a) The mce_logout_lock should be held in irq_disabled context.
b) The machine check event should be handled as quickly as possible,
enable irq will increase the period greatly.

Signed-off-by: Jiang, Yunhong <yunhong.jiang@xxxxxxxxx>
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
xen-unstable changeset:   20907:4f2d9156424d
xen-unstable date:        Mon Feb 08 08:43:25 2010 +0000
---
 xen/arch/x86/hvm/vmx/vmx.c |   31 ++++++++++++++++++-------------
 1 files changed, 18 insertions(+), 13 deletions(-)

diff -r 12b5a705c29f -r 85e852ef0d74 xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c        Mon Feb 08 10:34:31 2010 +0000
+++ b/xen/arch/x86/hvm/vmx/vmx.c        Mon Feb 08 10:36:26 2010 +0000
@@ -2177,7 +2177,7 @@ static void vmx_failed_vmentry(unsigned 
     case EXIT_REASON_MCE_DURING_VMENTRY:
         printk("caused by machine check.\n");
         HVMTRACE_0D(MCE);
-        do_machine_check(regs);
+        /* Already handled. */
         break;
     default:
         printk("reason not known yet!");
@@ -2204,7 +2204,7 @@ asmlinkage void vmx_enter_realmode(struc
 
 asmlinkage void vmx_vmexit_handler(struct cpu_user_regs *regs)
 {
-    unsigned int exit_reason, idtv_info;
+    unsigned int exit_reason, idtv_info, intr_info = 0, vector = 0;
     unsigned long exit_qualification, inst_len = 0;
     struct vcpu *v = current;
 
@@ -2226,8 +2226,22 @@ asmlinkage void vmx_vmexit_handler(struc
     perfc_incra(vmexits, exit_reason);
 
     /* Handle the interrupt we missed before allowing any more in. */
-    if ( exit_reason == EXIT_REASON_EXTERNAL_INTERRUPT )
+    switch ( (uint16_t)exit_reason )
+    {
+    case EXIT_REASON_EXTERNAL_INTERRUPT:
         vmx_do_extint(regs);
+        break;
+    case EXIT_REASON_EXCEPTION_NMI:
+        intr_info = __vmread(VM_EXIT_INTR_INFO);
+        BUG_ON(!(intr_info & INTR_INFO_VALID_MASK));
+        vector = intr_info & INTR_INFO_VECTOR_MASK;
+        if ( vector == TRAP_machine_check )
+            do_machine_check(regs);
+        break;
+    case EXIT_REASON_MCE_DURING_VMENTRY:
+        do_machine_check(regs);
+        break;
+    }
 
     /* Now enable interrupts so it's safe to take locks. */
     local_irq_enable();
@@ -2237,8 +2251,6 @@ asmlinkage void vmx_vmexit_handler(struc
 
     if ( v->arch.hvm_vmx.vmx_realmode )
     {
-        unsigned int vector;
-
         /* Put RFLAGS back the way the guest wants it */
         regs->eflags &= ~(X86_EFLAGS_VM | X86_EFLAGS_IOPL);
         regs->eflags |= (v->arch.hvm_vmx.vm86_saved_eflags & X86_EFLAGS_IOPL);
@@ -2248,7 +2260,6 @@ asmlinkage void vmx_vmexit_handler(struc
         switch ( exit_reason )
         {
         case EXIT_REASON_EXCEPTION_NMI:
-            vector = __vmread(VM_EXIT_INTR_INFO) & INTR_INFO_VECTOR_MASK;;
             if ( vector != TRAP_page_fault
                  && vector != TRAP_nmi 
                  && vector != TRAP_machine_check ) 
@@ -2307,12 +2318,6 @@ asmlinkage void vmx_vmexit_handler(struc
          * (1) We can get an exception (e.g. #PG) in the guest, or
          * (2) NMI
          */
-        unsigned int intr_info, vector;
-
-        intr_info = __vmread(VM_EXIT_INTR_INFO);
-        BUG_ON(!(intr_info & INTR_INFO_VALID_MASK));
-
-        vector = intr_info & INTR_INFO_VECTOR_MASK;
 
         /*
          * Re-set the NMI shadow if vmexit caused by a guest IRET fault (see 3B
@@ -2386,7 +2391,7 @@ asmlinkage void vmx_vmexit_handler(struc
             break;
         case TRAP_machine_check:
             HVMTRACE_0D(MCE);
-            do_machine_check(regs);
+            /* Already handled above. */
             break;
         default:
             goto exit_and_crash;

_______________________________________________
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®.