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

[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@xxxxxxxxx>

Best Regards
Shan Haitao

-----Original Message-----
From: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx 
[mailto:xen-devel-bounces@xxxxxxxxxxxxxxxxxxx] On Behalf Of Shan, Haitao
Sent: 2008年7月29日 15:22
To: Espen Skoglund; Keir Fraser
Cc: Jiang, Yunhong; xen-devel@xxxxxxxxxxxxxxxxxxx; 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@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

Attachment: msi_fix_lock.patch
Description: msi_fix_lock.patch

_______________________________________________
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®.