From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH] x86/MSI: fix MSI-X case of freeing IRQ Date: Thu, 02 Oct 2014 09:03:39 +0100 Message-ID: <542D06DB.7020609@citrix.com> References: <542D1561020000780003BCB8@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============7925859896808226887==" Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XZbMU-0005rV-RQ for xen-devel@lists.xenproject.org; Thu, 02 Oct 2014 08:03:43 +0000 In-Reply-To: <542D1561020000780003BCB8@mail.emea.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich , xen-devel Cc: Keir Fraser List-Id: xen-devel@lists.xenproject.org This is a multi-part message in MIME format. --===============7925859896808226887== Content-Type: multipart/alternative; boundary="------------080305070202070302080102" This is a multi-part message in MIME format. --------------080305070202070302080102 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On 02/10/2014 08:05, Jan Beulich wrote: > Commit d1b6d0a024 ("x86: enable multi-vector MSI") went a little too > far with moving things around in msi_free_irqs() in order to streamline > the code: We shouldn't drop the MSI-X control page reference before > calling destroy_irq(), as the latter will call us back via > desc->handler->shutdown() (effectively invoking to msi_set_mask_bit()). > > Signed-off-by: Jan Beulich Reviewed-by: Andrew Cooper > > --- a/xen/arch/x86/msi.c > +++ b/xen/arch/x86/msi.c > @@ -496,15 +496,8 @@ int __setup_msi_irq(struct irq_desc *des > > int msi_free_irq(struct msi_desc *entry) > { > - unsigned int nr = entry->msi.nvec; > - > - if ( entry->msi_attrib.type == PCI_CAP_ID_MSIX ) > - { > - unsigned long start; > - start = (unsigned long)entry->mask_base & ~(PAGE_SIZE - 1); > - msix_put_fixmap(entry->dev->msix, virt_to_fix(start)); > - nr = 1; > - } > + unsigned int nr = entry->msi_attrib.type != PCI_CAP_ID_MSIX > + ? entry->msi.nvec : 1; > > while ( nr-- ) > { > @@ -515,6 +508,10 @@ int msi_free_irq(struct msi_desc *entry) > iommu_update_ire_from_msi(entry + nr, NULL); > } > > + if ( entry->msi_attrib.type == PCI_CAP_ID_MSIX ) > + msix_put_fixmap(entry->dev->msix, > + virt_to_fix((unsigned long)entry->mask_base)); > + > list_del(&entry->list); > xfree(entry); > return 0; > > > > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel --------------080305070202070302080102 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit
On 02/10/2014 08:05, Jan Beulich wrote:
Commit d1b6d0a024 ("x86: enable multi-vector MSI") went a little too
far with moving things around in msi_free_irqs() in order to streamline
the code: We shouldn't drop the MSI-X control page reference before
calling destroy_irq(), as the latter will call us back via
desc->handler->shutdown() (effectively invoking to msi_set_mask_bit()).

Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>


--- a/xen/arch/x86/msi.c
+++ b/xen/arch/x86/msi.c
@@ -496,15 +496,8 @@ int __setup_msi_irq(struct irq_desc *des
 
 int msi_free_irq(struct msi_desc *entry)
 {
-    unsigned int nr = entry->msi.nvec;
-
-    if ( entry->msi_attrib.type == PCI_CAP_ID_MSIX )
-    {
-        unsigned long start;
-        start = (unsigned long)entry->mask_base & ~(PAGE_SIZE - 1);
-        msix_put_fixmap(entry->dev->msix, virt_to_fix(start));
-        nr = 1;
-    }
+    unsigned int nr = entry->msi_attrib.type != PCI_CAP_ID_MSIX
+                      ? entry->msi.nvec : 1;
 
     while ( nr-- )
     {
@@ -515,6 +508,10 @@ int msi_free_irq(struct msi_desc *entry)
             iommu_update_ire_from_msi(entry + nr, NULL);
     }
 
+    if ( entry->msi_attrib.type == PCI_CAP_ID_MSIX )
+        msix_put_fixmap(entry->dev->msix,
+                        virt_to_fix((unsigned long)entry->mask_base));
+
     list_del(&entry->list);
     xfree(entry);
     return 0;





_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

--------------080305070202070302080102-- --===============7925859896808226887== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --===============7925859896808226887==--