Skip to contentSkip to conversation

megaraid_sas: fixup MSIx interrupt setup during resume

PATCH Applied Hannes Reinecke 3 participants 4 messages Jan 13, 2020 – Jan 28, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 megaraid_sas: fixup MSIx interrupt setup during resume

Streamline resume workflow by using the same functions for enabling MSIx interrupts as used during initialisation.
Without it the driver might crash during resume with:

WARNING: CPU: 2 PID: 4306 at ../drivers/pci/msi.c:1303 pci_irq_get_affinity+0x3b/0x90
---
 drivers/scsi/megaraid/megaraid_sas_base.c | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)
drivers/scsi/megaraid/megaraid_sas_base.c +9 -11
index a4bc81479284..ec58244c680c 100644
@@ -7592,7 +7592,6 @@ megasas_resume(struct pci_dev *pdev)
 	int rval;
 	struct Scsi_Host *host;
 	struct megasas_instance *instance;
-	int irq_flags = PCI_IRQ_LEGACY;
 
 	instance = pci_get_drvdata(pdev);
 
@@ -7634,16 +7633,15 @@ megasas_resume(struct pci_dev *pdev)
 	atomic_set(&instance->ldio_outstanding, 0);
 
 	/* Now re-enable MSI-X */
-	if (instance->msix_vectors) {
-		irq_flags = PCI_IRQ_MSIX;
-		if (instance->smp_affinity_enable)
-			irq_flags |= PCI_IRQ_AFFINITY;
-	}
-	rval = pci_alloc_irq_vectors(instance->pdev, 1,
-				     instance->msix_vectors ?
-				     instance->msix_vectors : 1, irq_flags);
-	if (rval < 0)
-		goto fail_reenable_msix;
+	if (instance->msix_vectors)
+		megasas_alloc_irq_vectors(instance);
+
+	if (!instance->msix_vectors) {
+		rval = pci_alloc_irq_vectors(instance->pdev, 1, 1,
+					     PCI_IRQ_LEGACY);
+		if (rval < 0)
+			goto fail_reenable_msix;
+	}
 
 	megasas_setup_reply_map(instance);
 
Signature · 1 line
2.16.4
#1 lore raw

Sumit,

Quoted 5 lines

Streamline resume workflow by using the same functions for enabling MSIx interrupts as used during initialisation.
Without it the driver might crash during resume with:

WARNING: CPU: 2 PID: 4306 at ../drivers/pci/msi.c:1303 pci_irq_get_affinity+0x3b/0x90

Please review!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
maintainer Acked-by on v1 1/1
#2 lore raw
In reply to Hannes Reinecke
Quoted 8 lines · Hannes Reinecke

Streamline resume workflow by using the same functions for enabling MSIx interrupts as used during initialisation.
Without it the driver might crash during resume with:

WARNING: CPU: 2 PID: 4306 at ../drivers/pci/msi.c:1303 pci_irq_get_affinity+0x3b/0x90

Looks good, thank you.

Quoted 45 lines
---
 drivers/scsi/megaraid/megaraid_sas_base.c | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)
drivers/scsi/megaraid/megaraid_sas_base.c +9 -12
index a4bc81479284..ec58244c680c 100644
@@ -7592,7 +7592,6 @@ megasas_resume(struct pci_dev *pdev)
        int rval;
        struct Scsi_Host *host;
        struct megasas_instance *instance;
-       int irq_flags = PCI_IRQ_LEGACY;
 
        instance = pci_get_drvdata(pdev);
 
@@ -7634,16 +7633,15 @@ megasas_resume(struct pci_dev *pdev)
        atomic_set(&instance->ldio_outstanding, 0);
 
        /* Now re-enable MSI-X */
-       if (instance->msix_vectors) {
-               irq_flags = PCI_IRQ_MSIX;
-               if (instance->smp_affinity_enable)
-                       irq_flags |= PCI_IRQ_AFFINITY;
-       }
-       rval = pci_alloc_irq_vectors(instance->pdev, 1,
-                                    instance->msix_vectors ?
-                                    instance->msix_vectors : 1, irq_flags);
-       if (rval < 0)
-               goto fail_reenable_msix;
+       if (instance->msix_vectors)
+               megasas_alloc_irq_vectors(instance);
+
+       if (!instance->msix_vectors) {
+               rval = pci_alloc_irq_vectors(instance->pdev, 1, 1,
+                                            PCI_IRQ_LEGACY);
+               if (rval < 0)
+                       goto fail_reenable_msix;
+       }
 
        megasas_setup_reply_map(instance);
 
--

2.16.4

#3 lore raw
In reply to Hannes Reinecke

Hannes,

Quoted 6 lines

Streamline resume workflow by using the same functions for enabling MSIx interrupts as used during initialisation. Without it the driver might crash during resume with:

WARNING: CPU: 2 PID: 4306 at ../drivers/pci/msi.c:1303
pci_irq_get_affinity+0x3b/0x90

Applied to 5.6/scsi-fixes. Thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering