debuggers.hg

changeset 20953:4f2d9156424d

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@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Feb 08 08:43:25 2010 +0000 (2010-02-08)
parents 6be26c708bc9
children a06e9def02bb
files xen/arch/x86/hvm/vmx/vmx.c
line diff
     1.1 --- a/xen/arch/x86/hvm/vmx/vmx.c	Mon Feb 08 08:41:51 2010 +0000
     1.2 +++ b/xen/arch/x86/hvm/vmx/vmx.c	Mon Feb 08 08:43:25 2010 +0000
     1.3 @@ -2168,7 +2168,7 @@ static void vmx_failed_vmentry(unsigned 
     1.4      case EXIT_REASON_MCE_DURING_VMENTRY:
     1.5          printk("caused by machine check.\n");
     1.6          HVMTRACE_0D(MCE);
     1.7 -        do_machine_check(regs);
     1.8 +        /* Already handled. */
     1.9          break;
    1.10      default:
    1.11          printk("reason not known yet!");
    1.12 @@ -2263,7 +2263,7 @@ err:
    1.13  
    1.14  asmlinkage void vmx_vmexit_handler(struct cpu_user_regs *regs)
    1.15  {
    1.16 -    unsigned int exit_reason, idtv_info;
    1.17 +    unsigned int exit_reason, idtv_info, intr_info = 0, vector = 0;
    1.18      unsigned long exit_qualification, inst_len = 0;
    1.19      struct vcpu *v = current;
    1.20  
    1.21 @@ -2285,8 +2285,22 @@ asmlinkage void vmx_vmexit_handler(struc
    1.22      perfc_incra(vmexits, exit_reason);
    1.23  
    1.24      /* Handle the interrupt we missed before allowing any more in. */
    1.25 -    if ( exit_reason == EXIT_REASON_EXTERNAL_INTERRUPT )
    1.26 +    switch ( (uint16_t)exit_reason )
    1.27 +    {
    1.28 +    case EXIT_REASON_EXTERNAL_INTERRUPT:
    1.29          vmx_do_extint(regs);
    1.30 +        break;
    1.31 +    case EXIT_REASON_EXCEPTION_NMI:
    1.32 +        intr_info = __vmread(VM_EXIT_INTR_INFO);
    1.33 +        BUG_ON(!(intr_info & INTR_INFO_VALID_MASK));
    1.34 +        vector = intr_info & INTR_INFO_VECTOR_MASK;
    1.35 +        if ( vector == TRAP_machine_check )
    1.36 +            do_machine_check(regs);
    1.37 +        break;
    1.38 +    case EXIT_REASON_MCE_DURING_VMENTRY:
    1.39 +        do_machine_check(regs);
    1.40 +        break;
    1.41 +    }
    1.42  
    1.43      /* Now enable interrupts so it's safe to take locks. */
    1.44      local_irq_enable();
    1.45 @@ -2296,8 +2310,6 @@ asmlinkage void vmx_vmexit_handler(struc
    1.46  
    1.47      if ( v->arch.hvm_vmx.vmx_realmode )
    1.48      {
    1.49 -        unsigned int vector;
    1.50 -
    1.51          /* Put RFLAGS back the way the guest wants it */
    1.52          regs->eflags &= ~(X86_EFLAGS_VM | X86_EFLAGS_IOPL);
    1.53          regs->eflags |= (v->arch.hvm_vmx.vm86_saved_eflags & X86_EFLAGS_IOPL);
    1.54 @@ -2307,7 +2319,6 @@ asmlinkage void vmx_vmexit_handler(struc
    1.55          switch ( exit_reason )
    1.56          {
    1.57          case EXIT_REASON_EXCEPTION_NMI:
    1.58 -            vector = __vmread(VM_EXIT_INTR_INFO) & INTR_INFO_VECTOR_MASK;
    1.59              if ( vector != TRAP_page_fault
    1.60                   && vector != TRAP_nmi 
    1.61                   && vector != TRAP_machine_check ) 
    1.62 @@ -2366,12 +2377,6 @@ asmlinkage void vmx_vmexit_handler(struc
    1.63           * (1) We can get an exception (e.g. #PG) in the guest, or
    1.64           * (2) NMI
    1.65           */
    1.66 -        unsigned int intr_info, vector;
    1.67 -
    1.68 -        intr_info = __vmread(VM_EXIT_INTR_INFO);
    1.69 -        BUG_ON(!(intr_info & INTR_INFO_VALID_MASK));
    1.70 -
    1.71 -        vector = intr_info & INTR_INFO_VECTOR_MASK;
    1.72  
    1.73          /*
    1.74           * Re-set the NMI shadow if vmexit caused by a guest IRET fault (see 3B
    1.75 @@ -2448,7 +2453,7 @@ asmlinkage void vmx_vmexit_handler(struc
    1.76              break;
    1.77          case TRAP_machine_check:
    1.78              HVMTRACE_0D(MCE);
    1.79 -            do_machine_check(regs);
    1.80 +            /* Already handled above. */
    1.81              break;
    1.82          case TRAP_invalid_op:
    1.83              vmx_vmexit_ud_intercept(regs);