All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 for-4.9 01/40] xen: do not re-use pirq number cached in pci device msi msg data
@ 2017-03-17  0:48 alexander.levin
  2017-03-17  0:48 ` [PATCH v2 for-4.9 02/40] igb: Workaround for igb i210 firmware issue alexander.levin
                   ` (40 more replies)
  0 siblings, 41 replies; 81+ messages in thread
From: alexander.levin @ 2017-03-17  0:48 UTC (permalink / raw)
  To: gregkh; +Cc: stable

From: Dan Streetman <ddstreet@ieee.org>

[ Upstream commit c74fd80f2f41d05f350bb478151021f88551afe8 ]

Revert the main part of commit:
af42b8d12f8a ("xen: fix MSI setup and teardown for PV on HVM guests")

That commit introduced reading the pci device's msi message data to see
if a pirq was previously configured for the device's msi/msix, and re-use
that pirq.  At the time, that was the correct behavior.  However, a
later change to Qemu caused it to call into the Xen hypervisor to unmap
all pirqs for a pci device, when the pci device disables its MSI/MSIX
vectors; specifically the Qemu commit:
c976437c7dba9c7444fb41df45468968aaa326ad
("qemu-xen: free all the pirqs for msi/msix when driver unload")

Once Qemu added this pirq unmapping, it was no longer correct for the
kernel to re-use the pirq number cached in the pci device msi message
data.  All Qemu releases since 2.1.0 contain the patch that unmaps the
pirqs when the pci device disables its MSI/MSIX vectors.

This bug is causing failures to initialize multiple NVMe controllers
under Xen, because the NVMe driver sets up a single MSIX vector for
each controller (concurrently), and then after using that to talk to
the controller for some configuration data, it disables the single MSIX
vector and re-configures all the MSIX vectors it needs.  So the MSIX
setup code tries to re-use the cached pirq from the first vector
for each controller, but the hypervisor has already given away that
pirq to another controller, and its initialization fails.

This is discussed in more detail at:
https://lists.xen.org/archives/html/xen-devel/2017-01/msg00447.html

Fixes: af42b8d12f8a ("xen: fix MSI setup and teardown for PV on HVM guests")
Signed-off-by: Dan Streetman <dan.streetman@canonical.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
---
 arch/x86/pci/xen.c | 23 +++++++----------------
 1 file changed, 7 insertions(+), 16 deletions(-)

diff --git a/arch/x86/pci/xen.c b/arch/x86/pci/xen.c
index bedfab9..a00a6c0 100644
--- a/arch/x86/pci/xen.c
+++ b/arch/x86/pci/xen.c
@@ -234,23 +234,14 @@ static int xen_hvm_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
 		return 1;
 
 	for_each_pci_msi_entry(msidesc, dev) {
-		__pci_read_msi_msg(msidesc, &msg);
-		pirq = MSI_ADDR_EXT_DEST_ID(msg.address_hi) |
-			((msg.address_lo >> MSI_ADDR_DEST_ID_SHIFT) & 0xff);
-		if (msg.data != XEN_PIRQ_MSI_DATA ||
-		    xen_irq_from_pirq(pirq) < 0) {
-			pirq = xen_allocate_pirq_msi(dev, msidesc);
-			if (pirq < 0) {
-				irq = -ENODEV;
-				goto error;
-			}
-			xen_msi_compose_msg(dev, pirq, &msg);
-			__pci_write_msi_msg(msidesc, &msg);
-			dev_dbg(&dev->dev, "xen: msi bound to pirq=%d\n", pirq);
-		} else {
-			dev_dbg(&dev->dev,
-				"xen: msi already bound to pirq=%d\n", pirq);
+		pirq = xen_allocate_pirq_msi(dev, msidesc);
+		if (pirq < 0) {
+			irq = -ENODEV;
+			goto error;
 		}
+		xen_msi_compose_msg(dev, pirq, &msg);
+		__pci_write_msi_msg(msidesc, &msg);
+		dev_dbg(&dev->dev, "xen: msi bound to pirq=%d\n", pirq);
 		irq = xen_bind_pirq_msi_to_irq(dev, msidesc, pirq,
 					       (type == PCI_CAP_ID_MSI) ? nvec : 1,
 					       (type == PCI_CAP_ID_MSIX) ?
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 81+ messages in thread

end of thread, other threads:[~2017-03-20 10:59 UTC | newest]

Thread overview: 81+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-17  0:48 [PATCH v2 for-4.9 01/40] xen: do not re-use pirq number cached in pci device msi msg data alexander.levin
2017-03-17  0:48 ` [PATCH v2 for-4.9 02/40] igb: Workaround for igb i210 firmware issue alexander.levin
2017-03-20 10:49   ` Patch "[PATCH v2 for-4.9 02/40] igb: Workaround for igb i210 firmware issue" has been added to the 4.9-stable tree gregkh
2017-03-17  0:48 ` [PATCH v2 for-4.9 03/40] igb: add i211 to i210 PHY workaround alexander.levin
2017-03-20 10:49   ` Patch "[PATCH v2 for-4.9 03/40] igb: add i211 to i210 PHY workaround" has been added to the 4.9-stable tree gregkh
2017-03-17  0:48 ` [PATCH v2 for-4.9 04/40] scsi: ibmvscsis: Issues from Dan Carpenter/Smatch alexander.levin
2017-03-20 10:49   ` Patch "[PATCH v2 for-4.9 04/40] scsi: ibmvscsis: Issues from Dan Carpenter/Smatch" has been added to the 4.9-stable tree gregkh
2017-03-17  0:48 ` [PATCH v2 for-4.9 05/40] scsi: ibmvscsis: Return correct partition name/# to client alexander.levin
2017-03-20 10:49   ` Patch "[PATCH v2 for-4.9 05/40] scsi: ibmvscsis: Return correct partition name/# to client" has been added to the 4.9-stable tree gregkh
2017-03-17  0:48 ` [PATCH v2 for-4.9 06/40] scsi: ibmvscsis: Clean up properly if target_submit_cmd/tmr fails alexander.levin
2017-03-20 10:49   ` Patch "[PATCH v2 for-4.9 06/40] scsi: ibmvscsis: Clean up properly if target_submit_cmd/tmr fails" has been added to the 4.9-stable tree gregkh
2017-03-17  0:48 ` [PATCH v2 for-4.9 08/40] scsi: ibmvscsis: Synchronize cmds at tpg_enable_store time alexander.levin
2017-03-20 10:49   ` Patch "[PATCH v2 for-4.9 08/40] scsi: ibmvscsis: Synchronize cmds at tpg_enable_store time" has been added to the 4.9-stable tree gregkh
2017-03-17  0:48 ` [PATCH v2 for-4.9 07/40] scsi: ibmvscsis: Rearrange functions for future patches alexander.levin
2017-03-20 10:49   ` Patch "[PATCH v2 for-4.9 07/40] scsi: ibmvscsis: Rearrange functions for future patches" has been added to the 4.9-stable tree gregkh
2017-03-17  0:48 ` [PATCH v2 for-4.9 09/40] scsi: ibmvscsis: Synchronize cmds at remove time alexander.levin
2017-03-20 10:49   ` Patch "[PATCH v2 for-4.9 09/40] scsi: ibmvscsis: Synchronize cmds at remove time" has been added to the 4.9-stable tree gregkh
2017-03-17  0:48 ` [PATCH v2 for-4.9 11/40] PCI: Separate VF BAR updates from standard BAR updates alexander.levin
2017-03-20 10:49   ` Patch "[PATCH v2 for-4.9 11/40] PCI: Separate VF BAR updates from standard BAR updates" has been added to the 4.9-stable tree gregkh
2017-03-17  0:48 ` [PATCH v2 for-4.9 10/40] x86/hyperv: Handle unknown NMIs on one CPU when unknown_nmi_panic alexander.levin
2017-03-20 10:49   ` Patch "[PATCH v2 for-4.9 10/40] x86/hyperv: Handle unknown NMIs on one CPU when unknown_nmi_panic" has been added to the 4.9-stable tree gregkh
2017-03-17  0:48 ` [PATCH v2 for-4.9 14/40] PCI: Decouple IORESOURCE_ROM_ENABLE and PCI_ROM_ADDRESS_ENABLE alexander.levin
2017-03-20 10:49   ` Patch "[PATCH v2 for-4.9 14/40] PCI: Decouple IORESOURCE_ROM_ENABLE and PCI_ROM_ADDRESS_ENABLE" has been added to the 4.9-stable tree gregkh
2017-03-17  0:48 ` [PATCH v2 for-4.9 13/40] PCI: Add comments about ROM BAR updating alexander.levin
2017-03-20 10:49   ` Patch "[PATCH v2 for-4.9 13/40] PCI: Add comments about ROM BAR updating" has been added to the 4.9-stable tree gregkh
2017-03-17  0:48 ` [PATCH v2 for-4.9 12/40] PCI: Remove pci_resource_bar() and pci_iov_resource_bar() alexander.levin
2017-03-20 10:49   ` Patch "[PATCH v2 for-4.9 12/40] PCI: Remove pci_resource_bar() and pci_iov_resource_bar()" has been added to the 4.9-stable tree gregkh
2017-03-17  0:48 ` [PATCH v2 for-4.9 17/40] PCI: Ignore BAR updates on virtual functions alexander.levin
2017-03-20 10:49   ` Patch "[PATCH v2 for-4.9 17/40] PCI: Ignore BAR updates on virtual functions" has been added to the 4.9-stable tree gregkh
2017-03-17  0:48 ` [PATCH v2 for-4.9 15/40] PCI: Don't update VF BARs while VF memory space is enabled alexander.levin
2017-03-20 10:49   ` Patch "[PATCH v2 for-4.9 15/40] PCI: Don't update VF BARs while VF memory space is enabled" has been added to the 4.9-stable tree gregkh
2017-03-17  0:48 ` [PATCH v2 for-4.9 16/40] PCI: Update BARs using property bits appropriate for type alexander.levin
2017-03-20 10:49   ` Patch "[PATCH v2 for-4.9 16/40] PCI: Update BARs using property bits appropriate for type" has been added to the 4.9-stable tree gregkh
2017-03-17  0:48 ` [PATCH v2 for-4.9 18/40] PCI: Do any VF BAR updates before enabling the BARs alexander.levin
2017-03-20 10:49   ` Patch "[PATCH v2 for-4.9 18/40] PCI: Do any VF BAR updates before enabling the BARs" has been added to the 4.9-stable tree gregkh
2017-03-17  0:48 ` [PATCH v2 for-4.9 19/40] ibmveth: calculate gso_segs for large packets alexander.levin
2017-03-20 10:49   ` Patch "[PATCH v2 for-4.9 19/40] ibmveth: calculate gso_segs for large packets" has been added to the 4.9-stable tree gregkh
2017-03-17  0:48 ` [PATCH v2 for-4.9 22/40] powerpc/iommu: Pass mm_struct to init/cleanup helpers alexander.levin
2017-03-20 10:49   ` Patch "[PATCH v2 for-4.9 22/40] powerpc/iommu: Pass mm_struct to init/cleanup helpers" has been added to the 4.9-stable tree gregkh
2017-03-17  0:48 ` [PATCH v2 for-4.9 20/40] Drivers: hv: ring_buffer: count on wrap around mappings in get_next_pkt_raw() (v2) alexander.levin
2017-03-20 10:49   ` Patch "[PATCH v2 for-4.9 20/40] Drivers: hv: ring_buffer: count on wrap around mappings in get_next_pkt_raw() (v2)" has been added to the 4.9-stable tree gregkh
2017-03-17  0:48 ` [PATCH v2 for-4.9 21/40] vfio/spapr: Postpone allocation of userspace version of TCE table alexander.levin
2017-03-20 10:49   ` Patch "[PATCH v2 for-4.9 21/40] vfio/spapr: Postpone allocation of userspace version of TCE table" has been added to the 4.9-stable tree gregkh
2017-03-17  0:48 ` [PATCH v2 for-4.9 25/40] powerpc/mm/iommu, vfio/spapr: Put pages on VFIO container shutdown alexander.levin
2017-03-20 10:49   ` Patch "[PATCH v2 for-4.9 25/40] powerpc/mm/iommu, vfio/spapr: Put pages on VFIO container shutdown" has been added to the 4.9-stable tree gregkh
2017-03-17  0:48 ` [PATCH v2 for-4.9 24/40] vfio/spapr: Reference mm in tce_container alexander.levin
2017-03-20 10:49   ` Patch "[PATCH v2 for-4.9 24/40] vfio/spapr: Reference mm in tce_container" has been added to the 4.9-stable tree gregkh
2017-03-17  0:48 ` [PATCH v2 for-4.9 23/40] powerpc/iommu: Stop using @current in mm_iommu_xxx alexander.levin
2017-03-20 10:49   ` Patch "[PATCH v2 for-4.9 23/40] powerpc/iommu: Stop using @current in mm_iommu_xxx" has been added to the 4.9-stable tree gregkh
2017-03-17  0:48 ` [PATCH v2 for-4.9 26/40] vfio/spapr: Add a helper to create default DMA window alexander.levin
2017-03-20 10:49   ` Patch "[PATCH v2 for-4.9 26/40] vfio/spapr: Add a helper to create default DMA window" has been added to the 4.9-stable tree gregkh
2017-03-17  0:48 ` [PATCH v2 for-4.9 27/40] vfio/spapr: Postpone default window creation alexander.levin
2017-03-20 10:49   ` Patch "[PATCH v2 for-4.9 27/40] vfio/spapr: Postpone default window creation" has been added to the 4.9-stable tree gregkh
2017-03-17  0:48 ` [PATCH v2 for-4.9 29/40] drm/nouveau/disp/nv50-: split chid into chid.ctrl and chid.user alexander.levin
2017-03-20 10:49   ` Patch "[PATCH v2 for-4.9 29/40] drm/nouveau/disp/nv50-: split chid into chid.ctrl and chid.user" has been added to the 4.9-stable tree gregkh
2017-03-17  0:48 ` [PATCH v2 for-4.9 28/40] drm/nouveau/disp/gp102: fix cursor/overlay immediate channel indices alexander.levin
2017-03-20 10:49   ` Patch "[PATCH v2 for-4.9 28/40] drm/nouveau/disp/gp102: fix cursor/overlay immediate channel indices" has been added to the 4.9-stable tree gregkh
2017-03-17  0:48 ` [PATCH v2 for-4.9 30/40] drm/nouveau/disp/nv50-: specify ctrl/user separately when constructing classes alexander.levin
2017-03-20 10:49   ` Patch "[PATCH v2 for-4.9 30/40] drm/nouveau/disp/nv50-: specify ctrl/user separately when constructing classes" has been added to the 4.9-stable tree gregkh
2017-03-17  0:48 ` [PATCH v2 for-4.9 31/40] block: allow WRITE_SAME commands with the SG_IO ioctl alexander.levin
2017-03-20 10:49   ` Patch "[PATCH v2 for-4.9 31/40] block: allow WRITE_SAME commands with the SG_IO ioctl" has been added to the 4.9-stable tree gregkh
2017-03-17  0:48 ` [PATCH v2 for-4.9 32/40] s390/zcrypt: Introduce CEX6 toleration alexander.levin
2017-03-20 10:49   ` Patch "[PATCH v2 for-4.9 32/40] s390/zcrypt: Introduce CEX6 toleration" has been added to the 4.9-stable tree gregkh
2017-03-17  0:48 ` [PATCH v2 for-4.9 33/40] [media] uvcvideo: uvc_scan_fallback() for webcams with broken chain alexander.levin
2017-03-20 10:49   ` Patch "[PATCH v2 for-4.9 33/40] [media] uvcvideo: uvc_scan_fallback() for webcams with broken chain" has been added to the 4.9-stable tree gregkh
2017-03-17  0:48 ` [PATCH v2 for-4.9 34/40] slub: move synchronize_sched out of slab_mutex on shrink alexander.levin
2017-03-20 10:49   ` Patch "[PATCH v2 for-4.9 34/40] slub: move synchronize_sched out of slab_mutex on shrink" has been added to the 4.9-stable tree gregkh
2017-03-17  0:48 ` [PATCH v2 for-4.9 37/40] serial: 8250_pci: Detach low-level driver during PCI error recovery alexander.levin
2017-03-20 10:49   ` Patch "[PATCH v2 for-4.9 37/40] serial: 8250_pci: Detach low-level driver during PCI error recovery" has been added to the 4.9-stable tree gregkh
2017-03-17  0:48 ` [PATCH v2 for-4.9 35/40] ACPI / blacklist: add _REV quirks for Dell Precision 5520 and 3520 alexander.levin
2017-03-20 10:49   ` Patch "[PATCH v2 for-4.9 35/40] ACPI / blacklist: add _REV quirks for Dell Precision 5520 and 3520" has been added to the 4.9-stable tree gregkh
2017-03-17  0:48 ` [PATCH v2 for-4.9 36/40] ACPI / blacklist: Make Dell Latitude 3350 ethernet work alexander.levin
2017-03-20 10:49   ` Patch "[PATCH v2 for-4.9 36/40] ACPI / blacklist: Make Dell Latitude 3350 ethernet work" has been added to the 4.9-stable tree gregkh
2017-03-17  0:48 ` [PATCH v2 for-4.9 40/40] powerpc/mm: Fix build break when CMA=n && SPAPR_TCE_IOMMU=y alexander.levin
2017-03-20 10:49   ` Patch "[PATCH v2 for-4.9 40/40] powerpc/mm: Fix build break when CMA=n && SPAPR_TCE_IOMMU=y" has been added to the 4.9-stable tree gregkh
2017-03-17  0:48 ` [PATCH v2 for-4.9 38/40] net: phy: Avoid deadlock during phy_error() alexander.levin
2017-03-17  0:48 ` [PATCH v2 for-4.9 39/40] usb: gadget: udc: atmel: remove memory leak alexander.levin
2017-03-20 10:49   ` Patch "[PATCH v2 for-4.9 39/40] usb: gadget: udc: atmel: remove memory leak" has been added to the 4.9-stable tree gregkh
2017-03-17  1:14 ` [PATCH v2 for-4.9 01/40] xen: do not re-use pirq number cached in pci device msi msg data gregkh
2017-03-20 10:59   ` gregkh
2017-03-20 10:49 ` Patch "[PATCH v2 for-4.9 01/40] xen: do not re-use pirq number cached in pci device msi msg data" has been added to the 4.9-stable tree gregkh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.