ia64/xen-unstable

changeset 18665:824892134573

vmx: avoid taking locks with irqs disabled

Shuffle the bits of the vmexit handler that run with EFLAGS.IF == 0 up
to the top. Otherwise we end up calling spin_lock() with interrupts
disabled, which can deadlock against the time-synchronization
rendezvous code.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Oct 20 15:31:54 2008 +0100 (2008-10-20)
parents c4be040bef6f
children c003e5a23a4e
files xen/arch/x86/hvm/vmx/vmx.c
line diff
     1.1 --- a/xen/arch/x86/hvm/vmx/vmx.c	Mon Oct 20 15:22:58 2008 +0100
     1.2 +++ b/xen/arch/x86/hvm/vmx/vmx.c	Mon Oct 20 15:31:54 2008 +0100
     1.3 @@ -2056,8 +2056,12 @@ asmlinkage void vmx_vmexit_handler(struc
     1.4  
     1.5      perfc_incra(vmexits, exit_reason);
     1.6  
     1.7 -    if ( exit_reason != EXIT_REASON_EXTERNAL_INTERRUPT )
     1.8 -        local_irq_enable();
     1.9 +    /* Handle the interrupt we missed before allowing any more in. */
    1.10 +    if ( exit_reason == EXIT_REASON_EXTERNAL_INTERRUPT )
    1.11 +        vmx_do_extint(regs);
    1.12 +
    1.13 +    /* Now enable interrupts so it's safe to take locks. */
    1.14 +    local_irq_enable();
    1.15  
    1.16      if ( unlikely(exit_reason & VMX_EXIT_REASONS_FAILED_VMENTRY) )
    1.17          return vmx_failed_vmentry(exit_reason, regs);
    1.18 @@ -2185,7 +2189,7 @@ asmlinkage void vmx_vmexit_handler(struc
    1.19          break;
    1.20      }
    1.21      case EXIT_REASON_EXTERNAL_INTERRUPT:
    1.22 -        vmx_do_extint(regs);
    1.23 +        /* Already handled above. */
    1.24          break;
    1.25      case EXIT_REASON_TRIPLE_FAULT:
    1.26          hvm_triple_fault();