WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

RE: [Xen-devel] [PATCH] Dont call msi_unmap_pirq() if did not enabled ms

To: Jan Beulich <JBeulich@xxxxxxxxxx>, Joe Jin <joe.jin@xxxxxxxxxx>
Subject: RE: [Xen-devel] [PATCH] Dont call msi_unmap_pirq() if did not enabled msi
From: "Jiang, Yunhong" <yunhong.jiang@xxxxxxxxx>
Date: Thu, 26 Nov 2009 18:03:00 +0800
Accept-language: en-US
Acceptlanguage: en-US
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>, Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
Delivery-date: Thu, 26 Nov 2009 02:05:18 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <4B0E551E02000078000222BC@xxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <20091116120030.GA13803@xxxxxxxxxxxxxxxxxxxxxxx> <20091116151546.GC30967@xxxxxxxxxxxxxxxxxxx> <20091117001909.GA18296@xxxxxxxxxxxxxxxxxxxxxxx> <4B0265DA02000078000200FF@xxxxxxxxxxxxxxxxxx> <20091117101416.GA23253@xxxxxxxxxxxxxxxxxxxxxxx> <4B0295380200007800020165@xxxxxxxxxxxxxxxxxx> <E2263E4A5B2284449EEBD0AAB751098418E55FBD04@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> <20091123022404.GA9692@xxxxxxxxxxxxxxxxxxxxxxx> <20091124020253.GA31335@xxxxxxxxxxxxxxxxxxxxxxx> <4B0E551E02000078000222BC@xxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcpuePSWQndlKMyhSCyV9QDLTtIavAABbj0A
Thread-topic: [Xen-devel] [PATCH] Dont call msi_unmap_pirq() if did not enabled msi
I also noticed following code  have no lock protection in the 
list_for_each_entry_safe(pirq_entry, tmp, &msi_dev_entry->pirq_list_head, list) 
and needs a fix.

-- jyh

> void pci_disable_msix(struct pci_dev* dev)
> {
>     int pos;
>     u16 control;
> 
>     if (!pci_msi_enable)
>         return;
>     if (!dev)
>         return;
> 
> #ifdef CONFIG_XEN_PCIDEV_FRONTEND
>     if (!is_initial_xendomain()) {
>         struct msi_dev_list *msi_dev_entry;
>         struct msi_pirq_entry *pirq_entry, *tmp;
> 
>         pci_frontend_disable_msix(dev);
> 
>         msi_dev_entry = get_msi_dev_pirq_list(dev);
>         list_for_each_entry_safe(pirq_entry, tmp,
>                                  &msi_dev_entry->pirq_list_head,
>             list) { evtchn_map_pirq(pirq_entry->pirq, 0);
>             list_del(&pirq_entry->list);
>             kfree(pirq_entry);
>         }
> 
>         dev->irq = msi_dev_entry->default_irq;
>         return;
>     }
> #endif


Jan Beulich wrote:
> Wouldn't we need the same also for MSI-X?
> 
> Jan
> 
>>>> Joe Jin <joe.jin@xxxxxxxxxx> 24.11.09 03:02 >>>
> Sorry I lost to set @dev->msi_enabled to false in pci_disable_msi,
> here are the patch, please review and comment:
> 
> When device driver unload, it may call pci_disable_msi(), if
> msi did not
> enabled but do msi_unmap_pirq(), then later driver reload and without
> msi, then will failed in request_irq() for irq_desc[irq]->chip valie
> is no_irq_chip. So when did not enable msi during driver
> initializing, then
> unloaded driver will not try to disable it.
> 
> How to reproduce it:
>  At the server with QLogic 25xx, try to reload qla2xxx will hit it.
> 
> 
> Signed-off-by: Joe Jin <joe.jin@xxxxxxxxxx>
> ---
> msi-xen.c |   13 +++++++++++++
> 1 file changed, 13 insertions(+)
> 
> 
> diff -r c5c40e80bd7d drivers/pci/msi-xen.c
> --- a/drivers/pci/msi-xen.c   Fri Nov 13 22:01:54 2009 +0000
> +++ b/drivers/pci/msi-xen.c   Tue Nov 24 09:56:52 2009 +0800 @@ -618,6
>                       +618,7 @@ return ret;
> 
>               dev->irq = evtchn_map_pirq(-1, dev->irq);
> +             dev->msi_enabled = 1;
>               msi_dev_entry->default_irq = temp;
> 
>               return ret;
> @@ -662,9 +663,15 @@
> 
> #ifdef CONFIG_XEN_PCIDEV_FRONTEND
>       if (!is_initial_xendomain()) {
> +             if (!(dev->msi_enabled)) {
> +                     printk(KERN_INFO "PCI: %s: Device did
> not enabled MSI.\n",
> +                            pci_name(dev));
> +                     return;
> +             }
>               evtchn_map_pirq(dev->irq, 0);
>               pci_frontend_disable_msi(dev);
>               dev->irq = msi_dev_entry->default_irq;
> +             dev->msi_enabled = 0;
>               return;
>       }
> #endif
> @@ -673,6 +680,12 @@
>       if (!pos)
>               return;
> 
> +     if (!(dev->msi_enabled)) {
> +             printk(KERN_INFO "PCI: %s: Device did not
> enabled MSI.\n",
> +                    pci_name(dev));
> +             return;
> +     }
> +
>       pirq = dev->irq;
>       /* Restore dev->irq to its default pin-assertion vector */
>       dev->irq = msi_dev_entry->default_irq;
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel