linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] megaraid_sas: fixup MSIx interrupt setup during resume
@ 2020-01-13 13:26 Hannes Reinecke
  2020-01-21  4:55 ` Martin K. Petersen
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Hannes Reinecke @ 2020-01-13 13:26 UTC (permalink / raw)
  To: Sumit Saxena
  Cc: Martin K. Petersen, Christoph Hellwig, James Bottomley,
	linux-scsi, 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

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/scsi/megaraid/megaraid_sas_base.c | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index a4bc81479284..ec58244c680c 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -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


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

* Re: [PATCH] megaraid_sas: fixup MSIx interrupt setup during resume
  2020-01-13 13:26 [PATCH] megaraid_sas: fixup MSIx interrupt setup during resume Hannes Reinecke
@ 2020-01-21  4:55 ` Martin K. Petersen
  2020-01-24 12:37 ` Sumit Saxena
  2020-01-28  3:47 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2020-01-21  4:55 UTC (permalink / raw)
  To: Sumit Saxena
  Cc: Hannes Reinecke, Martin K. Petersen, Christoph Hellwig,
	James Bottomley, linux-scsi


Sumit,

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

-- 
Martin K. Petersen	Oracle Linux Engineering

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

* Re: [PATCH] megaraid_sas: fixup MSIx interrupt setup during resume
  2020-01-13 13:26 [PATCH] megaraid_sas: fixup MSIx interrupt setup during resume Hannes Reinecke
  2020-01-21  4:55 ` Martin K. Petersen
@ 2020-01-24 12:37 ` Sumit Saxena
  2020-01-28  3:47 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Sumit Saxena @ 2020-01-24 12:37 UTC (permalink / raw)
  To: Hannes Reinecke
  Cc: Martin K. Petersen, Christoph Hellwig, James Bottomley, Linux SCSI List

On Mon, Jan 13, 2020 at 6:56 PM Hannes Reinecke <hare@suse.de> wrote:
>
> 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
>
> Signed-off-by: Hannes Reinecke <hare@suse.de>
Looks good, thank you.
Acked-by: Sumit Saxena <sumit.saxena@broadcom.com>

> ---
>  drivers/scsi/megaraid/megaraid_sas_base.c | 20 +++++++++-----------
>  1 file changed, 9 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
> index a4bc81479284..ec58244c680c 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_base.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_base.c
> @@ -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
>

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

* Re: [PATCH] megaraid_sas: fixup MSIx interrupt setup during resume
  2020-01-13 13:26 [PATCH] megaraid_sas: fixup MSIx interrupt setup during resume Hannes Reinecke
  2020-01-21  4:55 ` Martin K. Petersen
  2020-01-24 12:37 ` Sumit Saxena
@ 2020-01-28  3:47 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2020-01-28  3:47 UTC (permalink / raw)
  To: Hannes Reinecke
  Cc: Sumit Saxena, Martin K. Petersen, Christoph Hellwig,
	James Bottomley, linux-scsi


Hannes,

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

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2020-01-28  3:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-13 13:26 [PATCH] megaraid_sas: fixup MSIx interrupt setup during resume Hannes Reinecke
2020-01-21  4:55 ` Martin K. Petersen
2020-01-24 12:37 ` Sumit Saxena
2020-01-28  3:47 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).