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

Re: [Xen-devel] RE: [PATCH] Don't enable irq for machine check vmexit



At 10:22 +0000 on 05 Feb (1265365365), Jiang, Yunhong wrote:
> Keir/Tim, here is attached patch. Please have a look onit.

Yep, that looks better.  Not sure that the dprintk is useful, though.

Cheers,

Tim.

> Thanks
> Yunhong Jiang
> 
> # HG changeset patch
> # User Yunhong Jiang <yunhong.jiang@xxxxxxxxx>
> # Date 1265363638 -28800
> # Node ID 01b2ce3f2cc95dd2e9c6defe2cee8a892e867187
> # Parent  7b751b0e6f1bc7485b0718e634ed7cb9ce9ab68c
> 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>
> 
> diff -r 7b751b0e6f1b -r 01b2ce3f2cc9 xen/arch/x86/hvm/vmx/vmx.c
> --- a/xen/arch/x86/hvm/vmx/vmx.c      Thu Feb 04 19:40:19 2010 +0000
> +++ b/xen/arch/x86/hvm/vmx/vmx.c      Fri Feb 05 17:53:58 2010 +0800
> @@ -2168,7 +2168,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);
> +        /* Handled already */
>          break;
>      default:
>          printk("reason not known yet!");
> @@ -2259,6 +2259,23 @@ err:
>  err:
>      vmx_inject_hw_exception(TRAP_gp_fault, 0);
>      return -1;
> +}
> +
> +int vmx_mce_exit(int exit_reason)
> +{
> +    if ( unlikely(exit_reason & VMX_EXIT_REASONS_FAILED_VMENTRY &&
> +        (uint16_t)exit_reason == EXIT_REASON_MCE_DURING_VMENTRY) )
> +            return 1;
> +    else if (unlikely(exit_reason == EXIT_REASON_EXCEPTION_NMI))
> +    {
> +        uint32_t vector;
> +
> +        vector = __vmread(VM_EXIT_INTR_INFO) & INTR_INFO_VECTOR_MASK;
> +        if (vector == TRAP_machine_check)
> +            return 1;
> +    }
> +
> +    return 0;
>  }
>  
>  asmlinkage void vmx_vmexit_handler(struct cpu_user_regs *regs)
> @@ -2287,6 +2304,9 @@ asmlinkage void vmx_vmexit_handler(struc
>      /* Handle the interrupt we missed before allowing any more in. */
>      if ( exit_reason == EXIT_REASON_EXTERNAL_INTERRUPT )
>          vmx_do_extint(regs);
> +
> +    if ( vmx_mce_exit(exit_reason) )
> +        do_machine_check(regs);
>  
>      /* Now enable interrupts so it's safe to take locks. */
>      local_irq_enable();
> @@ -2447,8 +2467,9 @@ asmlinkage void vmx_vmexit_handler(struc
>              self_nmi(); /* Real NMI, vector 2: normal processing. */
>              break;
>          case TRAP_machine_check:
> +            dprintk(XENLOG_INFO, "VMexit for machine check\n");
>              HVMTRACE_0D(MCE);
> -            do_machine_check(regs);
> +            /* Handled already */
>              break;
>          case TRAP_invalid_op:
>              vmx_vmexit_ud_intercept(regs);
> 
> 


Content-Description: ATT00001.txt
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel


-- 
Tim Deegan <Tim.Deegan@xxxxxxxxxx>
Principal Software Engineer, Citrix Systems (R&D) Ltd.
[Company #02300071, SL9 0DZ, UK.]

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


 


Rackspace

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