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-changelog

[Xen-changelog] [linux-2.6.18-xen] MSI-X: Avoid unconditional BUG() in D

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [linux-2.6.18-xen] MSI-X: Avoid unconditional BUG() in DomU
From: Xen patchbot-linux-2.6.18-xen <patchbot@xxxxxxx>
Date: Mon, 10 Oct 2011 13:55:02 +0100
Delivery-date: Mon, 10 Oct 2011 05:56:24 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Jan Beulich <jbeulich@xxxxxxxx>
# Date 1318250600 -7200
# Node ID 28740a325058c0c196ef22f59506710dc4ff4c55
# Parent  40e33b2fce948cbdcc0ec27404b58b1acc9b7fc8
MSI-X: Avoid unconditional BUG() in DomU

msi_remove_pci_irq_vectors() unconditionally (i.e. even in a DomU)
calling msi_unmap_pirq() is guaranteed to BUG() in msi_get_dev_owner().
Adjust the function to call evtchn_map_pirq() instead in a DomU (just
like pci_disable_msix() is doing).

While looking into this I also realized that the
CONFIG_XEN_PCIDEV_FRONTEND conditionals are misplaced - since on x86-64
it is possible to build with this disabled, execution would flow into
Dom0 code even on a DomU in this case. Hence adjust their placement at
once.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---


diff -r 40e33b2fce94 -r 28740a325058 drivers/pci/msi-xen.c
--- a/drivers/pci/msi-xen.c     Thu Oct 06 11:24:48 2011 +0200
+++ b/drivers/pci/msi-xen.c     Mon Oct 10 14:43:20 2011 +0200
@@ -625,9 +625,8 @@
        if (status < 0)
                return status;
 
+       if (!is_initial_xendomain()) {
 #ifdef CONFIG_XEN_PCIDEV_FRONTEND
-       if (!is_initial_xendomain())
-       {
                int ret;
 
                temp = dev->irq;
@@ -640,8 +639,10 @@
                msi_dev_entry->default_irq = temp;
 
                return ret;
+#else
+               return -EOPNOTSUPP;
+#endif
        }
-#endif
 
        temp = dev->irq;
 
@@ -679,8 +680,8 @@
        if (!dev)
                return;
 
+       if (!is_initial_xendomain()) {
 #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));
@@ -690,9 +691,9 @@
                pci_frontend_disable_msi(dev);
                dev->irq = msi_dev_entry->default_irq;
                dev->msi_enabled = 0;
+#endif
                return;
        }
-#endif
 
        pos = pci_find_capability(dev, PCI_CAP_ID_MSI);
        if (!pos)
@@ -748,8 +749,8 @@
                if (bus->bus_flags & PCI_BUS_FLAGS_NO_MSI)
                        return -EINVAL;
 
+       if (!is_initial_xendomain()) {
 #ifdef CONFIG_XEN_PCIDEV_FRONTEND
-       if (!is_initial_xendomain()) {
                struct msi_pirq_entry *pirq_entry;
                int ret, irq;
 
@@ -780,9 +781,11 @@
                        attach_pirq_entry(irq, entries[i].entry, msi_dev_entry);
                        entries[i].vector = irq;
                }
-        return 0;
+               return 0;
+#else
+               return -EOPNOTSUPP;
+#endif
        }
-#endif
 
        status = msi_init();
        if (status < 0)
@@ -843,8 +846,8 @@
                return;
        }
 
+       if (!is_initial_xendomain()) {
 #ifdef CONFIG_XEN_PCIDEV_FRONTEND
-       if (!is_initial_xendomain()) {
                struct msi_dev_list *msi_dev_entry;
                struct msi_pirq_entry *pirq_entry, *tmp;
 
@@ -860,9 +863,9 @@
 
                dev->irq = msi_dev_entry->default_irq;
                dev->msix_enabled = 0;
+#endif
                return;
        }
-#endif
 
        pos = pci_find_capability(dev, PCI_CAP_ID_MSIX);
        if (!pos)
@@ -902,7 +905,10 @@
        if (!list_empty(&msi_dev_entry->pirq_list_head))
                list_for_each_entry_safe(pirq_entry, tmp,
                                         &msi_dev_entry->pirq_list_head, list) {
-                       msi_unmap_pirq(dev, pirq_entry->pirq);
+                       if (is_initial_xendomain())
+                               msi_unmap_pirq(dev, pirq_entry->pirq);
+                       else
+                               evtchn_map_pirq(pirq_entry->pirq, 0);
                        list_del(&pirq_entry->list);
                        kfree(pirq_entry);
                }

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [linux-2.6.18-xen] MSI-X: Avoid unconditional BUG() in DomU, Xen patchbot-linux-2 . 6 . 18-xen <=