Shan, Haitao
2008-Jul-29 07:21 UTC
[Xen-devel] Root cause of xen bug 1306: Dom0 hangs when destorying one guest with MSI NIC assigned
Hi, Espen,
Some recent changsets break the MSI function. Please see my comments embedded in
the following code snippet.
Another problem is the following function is invoked by pci_release_devices,
which is executed before iommu_domain_destroy. However, the following function
must be executed after unbinding all guest pirqs. The unbinding code is located
in iommu_domain_destroy.
I am not familiar with recent IOMMU code. Could you please have a look?
static void msi_free_vectors(struct pci_dev* dev)
{
struct msi_desc *entry, *tmp;
irq_desc_t *desc;
unsigned long flags;
retry:
list_for_each_entry_safe( entry, tmp, &dev->msi_list, list )
{
desc = &irq_desc[entry->vector];
local_irq_save(flags);
if ( !spin_trylock(&desc->lock) )
{
local_irq_restore(flags);
goto retry;
}
spin_lock_irqsave(&desc->lock, flags);
-----→the above line should be removed, otherwise dead lock will occur by
acquiring a lock already acquired.
if ( desc->handler == &pci_msi_type )
{
/* MSI is not shared, so should be released already */
BUG_ON(desc->status & IRQ_GUEST);
desc->handler = &no_irq_type;
}
msi_free_vector(entry->vector);
spin_unlock_irqrestore(&desc->lock, flags);
}
}
Best Regards
Shan Haitao
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
Shan, Haitao
2008-Jul-31 06:03 UTC
[Xen-devel] [PATCH] Fixfor xen bug 1306: Dom0 hangs when destoryingone guest with MSI NIC assigned
Hi, Keir,
Since I have got no response from Espen, I try to fix the bug myself. Please see
the attached patch.
Description:
This patch will fix bug 1306. The reason is explained in my former mail. This
patch also removes hard tabs in msi.c.
Signed-off-by: Shan Haitao <Haitao.shan@intel.com>
Best Regards
Shan Haitao
-----Original Message-----
From: xen-devel-bounces@lists.xensource.com
[mailto:xen-devel-bounces@lists.xensource.com] On Behalf Of Shan, Haitao
Sent: 2008年7月29日 15:22
To: Espen Skoglund; Keir Fraser
Cc: Jiang, Yunhong; xen-devel@lists.xensource.com; Li, Xin B; Li, Susie
Subject: [Xen-devel] Root cause of xen bug 1306: Dom0 hangs when destoryingone
guest with MSI NIC assigned
Hi, Espen,
Some recent changsets break the MSI function. Please see my comments embedded in
the following code snippet.
Another problem is the following function is invoked by pci_release_devices,
which is executed before iommu_domain_destroy. However, the following function
must be executed after unbinding all guest pirqs. The unbinding code is located
in iommu_domain_destroy.
I am not familiar with recent IOMMU code. Could you please have a look?
static void msi_free_vectors(struct pci_dev* dev)
{
struct msi_desc *entry, *tmp;
irq_desc_t *desc;
unsigned long flags;
retry:
list_for_each_entry_safe( entry, tmp, &dev->msi_list, list )
{
desc = &irq_desc[entry->vector];
local_irq_save(flags);
if ( !spin_trylock(&desc->lock) )
{
local_irq_restore(flags);
goto retry;
}
spin_lock_irqsave(&desc->lock, flags);
-----→the above line should be removed, otherwise dead lock will occur by
acquiring a lock already acquired.
if ( desc->handler == &pci_msi_type )
{
/* MSI is not shared, so should be released already */
BUG_ON(desc->status & IRQ_GUEST);
desc->handler = &no_irq_type;
}
msi_free_vector(entry->vector);
spin_unlock_irqrestore(&desc->lock, flags);
}
}
Best Regards
Shan Haitao
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
Espen Skoglund
2008-Aug-06 11:33 UTC
Re: [Xen-devel] [PATCH] Fixfor xen bug 1306: Dom0 hangs when destoryingone guest with MSI NIC assigned
Sorry for non-responsiveness (holidays, off-line). You''re absolutely right on these problems. Screwup on my part. \me feels reeally stupid now. eSk [Haitao Shan]> Hi, Keir, > Since I have got no response from Espen, I try to fix the bug > myself. Please see the attached patch. Description: This patch will > fix bug 1306. The reason is explained in my former mail. This patch > also removes hard tabs in msi.c.> Signed-off-by: Shan Haitao <Haitao.shan@intel.com>> Best Regards > Shan Haitao> -----Original Message----- > From: xen-devel-bounces@lists.xensource.com [mailto:xen-devel-bounces@lists.xensource.com] On Behalf Of Shan, Haitao > Sent: 2008$BG/(J7$B7n(J29$BF|(J 15:22 > To: Espen Skoglund; Keir Fraser > Cc: Jiang, Yunhong; xen-devel@lists.xensource.com; Li, Xin B; Li, Susie > Subject: [Xen-devel] Root cause of xen bug 1306: Dom0 hangs when destoryingone guest with MSI NIC assigned> Hi, Espen,> Some recent changsets break the MSI function. Please see my comments embedded in the following code snippet. > Another problem is the following function is invoked by pci_release_devices, which is executed before iommu_domain_destroy. However, the following function must be executed after unbinding all guest pirqs. The unbinding code is located in iommu_domain_destroy.> I am not familiar with recent IOMMU code. Could you please have a look?> static void msi_free_vectors(struct pci_dev* dev) > { > struct msi_desc *entry, *tmp; > irq_desc_t *desc; > unsigned long flags;> retry: > list_for_each_entry_safe( entry, tmp, &dev->msi_list, list ) > { > desc = &irq_desc[entry->vector];> local_irq_save(flags); > if ( !spin_trylock(&desc->lock) ) > { > local_irq_restore(flags); > goto retry; > }> spin_lock_irqsave(&desc->lock, flags); > -----$B"*(Jthe above line should be removed, otherwise dead lock will occur by acquiring a lock already acquired. > if ( desc->handler == &pci_msi_type ) > { > /* MSI is not shared, so should be released already */ > BUG_ON(desc->status & IRQ_GUEST);desc-> handler = &no_irq_type;> }> msi_free_vector(entry->vector); > spin_unlock_irqrestore(&desc->lock, flags); > } > }> Best Regards > Shan Haitao> _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel