From: Tim Deegan Subject: [PATCH] VMX: avoid taking locks with irqs disabled Date: Mon, 20 Oct 2008 10:30:23 +0100 Message-ID: <20081020093023.GM3780@york.uk.xensource.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="n2Pv11Ogg/Ox8ay5" Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --n2Pv11Ogg/Ox8ay5 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline 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 --n2Pv11Ogg/Ox8ay5 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: attachment; filename=deadlock diff -r 4129f0f2f2ba xen/arch/x86/hvm/vmx/vmx.c --- a/xen/arch/x86/hvm/vmx/vmx.c Fri Oct 17 14:15:37 2008 +0100 +++ b/xen/arch/x86/hvm/vmx/vmx.c Mon Oct 20 10:20:58 2008 +0100 @@ -2056,8 +2056,12 @@ asmlinkage void vmx_vmexit_handler(struc perfc_incra(vmexits, exit_reason); - if ( exit_reason != EXIT_REASON_EXTERNAL_INTERRUPT ) - local_irq_enable(); + /* Handle the interrupt we missed before allowing any more in */ + if ( exit_reason == EXIT_REASON_EXTERNAL_INTERRUPT ) + vmx_do_extint(regs); + + /* Now enable interrupts so it's safe to take locks. */ + local_irq_enable(); if ( unlikely(exit_reason & VMX_EXIT_REASONS_FAILED_VMENTRY) ) return vmx_failed_vmentry(exit_reason, regs); @@ -2185,7 +2189,7 @@ asmlinkage void vmx_vmexit_handler(struc break; } case EXIT_REASON_EXTERNAL_INTERRUPT: - vmx_do_extint(regs); + /* Already handled above */ break; case EXIT_REASON_TRIPLE_FAULT: hvm_triple_fault(); --n2Pv11Ogg/Ox8ay5 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --n2Pv11Ogg/Ox8ay5--