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

[Xen-devel] Deadlocks by p2m_lock and event_lock

Hi, Jan and Andres

Here we met a deadlocks issue by p2m_lock and event_lock on Xen. The issue 
appears from the series of patches "Synchronized p2m lookups, Xen 24770~", 
deadlocks may happen on a specifical case: Assign a PCIe device with MSI-x 
capability to HVM guest(in case of EPT).

I've dump the all processor registers when dom0 hang( attach the log). The 
deadlocks happen as follows:
map_domain_pirq()    Grab event_lock
p2m_change_entry_type_global()   Trying to acquire p2m_lock

hvm_hap_nested_page_fault() -> get_gfn_type_access()   Grab p2m_lock
notify_via_xen_event_channel()    Trying to acquire event_lock

The event_lock is used anywhere in Xen, I only have a patch of workaround this 
issue for proposal, but not for the final fix. Any good suggestion?

diff -r f61120046915 xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c        Wed Mar 07 11:50:31 2012 +0100
+++ b/xen/arch/x86/irq.c        Sat Mar 10 02:06:18 2012 +0800
@@ -1875,10 +1875,12 @@ int map_domain_pirq(
         if ( !cpu_has_apic )
             goto done;
+        spin_unlock(&d->event_lock);
         pdev = pci_get_pdev(msi->seg, msi->bus, msi->devfn);
         ret = pci_enable_msi(msi, &msi_desc);
         if ( ret )
             goto done;
+        spin_lock(&d->event_lock);
         spin_lock_irqsave(&desc->lock, flags);

Best Regards,
Xudong Hao

Attachment: registers_dump.log
Description: registers_dump.log

Xen-devel mailing list



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