From: "Jan Beulich" Subject: Re: [PATCH] Dont call msi_unmap_pirq() if did not enabled msi Date: Thu, 26 Nov 2009 09:14:54 +0000 Message-ID: <4B0E551E02000078000222BC@vpn.id2.novell.com> References: <20091116120030.GA13803@joejin-pc.cn.oracle.com> <20091116151546.GC30967@phenom.dumpdata.com> <20091117001909.GA18296@joejin-pc.cn.oracle.com> <4B0265DA02000078000200FF@vpn.id2.novell.com> <20091117101416.GA23253@joejin-pc.cn.oracle.com> <4B0295380200007800020165@vpn.id2.novell.com> <20091123022404.GA9692@joejin-pc.cn.oracle.com> <20091124020253.GA31335@joejin-pc.cn.oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <20091124020253.GA31335@joejin-pc.cn.oracle.com> 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: Yunhong Jiang , Joe Jin Cc: Xen-devel , Konrad Rzeszutek Wilk , Kurt Hackel , "greg.marsden@oracle.com" , Haitao Shan , Jerry Yuanjiang Ou , Keir Fraser List-Id: xen-devel@lists.xenproject.org Wouldn't we need the same also for MSI-X? Jan >>> Joe Jin 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 --- 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; =20 dev->irq =3D evtchn_map_pirq(-1, dev->irq); + dev->msi_enabled =3D 1; msi_dev_entry->default_irq =3D temp; =20 return ret; @@ -662,9 +663,15 @@ =20 #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 =3D msi_dev_entry->default_irq; + dev->msi_enabled =3D 0; return; } #endif @@ -673,6 +680,12 @@ if (!pos) return; =20 + if (!(dev->msi_enabled)) { + printk(KERN_INFO "PCI: %s: Device did not enabled MSI.\n", + pci_name(dev)); + return; + } +=20 pirq =3D dev->irq; /* Restore dev->irq to its default pin-assertion vector */ dev->irq =3D msi_dev_entry->default_irq;