linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mpt3sas: fix sync irqs
@ 2020-09-10 14:21 Tomas Henzl
  2020-09-14 13:30 ` Sreekanth Reddy
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Tomas Henzl @ 2020-09-10 14:21 UTC (permalink / raw)
  To: linux-scsi; +Cc: sreekanth.reddy, suganath-prabu.subramani, sathya.prakash

- _base_process_reply_queue called from _base_interrupt
may schedule a new irq poll, fix this by calling
synchronize_irq first
- a fix for "Unbalanced enable for IRQ..."
enable_irq should be called only when necessary

Fixes: 320e77acb327 ("scsi: mpt3sas: Irq poll to avoid CPU hard lockups")
Signed-off-by: Tomas Henzl <thenzl@redhat.com>
---
 drivers/scsi/mpt3sas/mpt3sas_base.c | 14 +++++++++-----
 drivers/scsi/scsi_scan.c            |  8 ++++++++
 2 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
index a85c9672c6ea..a67749c8f4ab 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_base.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
@@ -1808,18 +1808,22 @@ mpt3sas_base_sync_reply_irqs(struct MPT3SAS_ADAPTER *ioc)
 		/* TMs are on msix_index == 0 */
 		if (reply_q->msix_index == 0)
 			continue;
+		synchronize_irq(pci_irq_vector(ioc->pdev, reply_q->msix_index));
 		if (reply_q->irq_poll_scheduled) {
 			/* Calling irq_poll_disable will wait for any pending
 			 * callbacks to have completed.
 			 */
 			irq_poll_disable(&reply_q->irqpoll);
 			irq_poll_enable(&reply_q->irqpoll);
-			reply_q->irq_poll_scheduled = false;
-			reply_q->irq_line_enable = true;
-			enable_irq(reply_q->os_irq);
-			continue;
+			/* check how the scheduled poll has ended,
+			 * clean up only if necessary
+			 */
+			if (reply_q->irq_poll_scheduled) {
+				reply_q->irq_poll_scheduled = false;
+				reply_q->irq_line_enable = true;
+				enable_irq(reply_q->os_irq);
+			}
 		}
-		synchronize_irq(pci_irq_vector(ioc->pdev, reply_q->msix_index));
 	}
 }
 
-- 
2.25.4


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

* Re: [PATCH] mpt3sas: fix sync irqs
  2020-09-10 14:21 [PATCH] mpt3sas: fix sync irqs Tomas Henzl
@ 2020-09-14 13:30 ` Sreekanth Reddy
  2020-09-15 22:38 ` Martin K. Petersen
  2020-09-22  3:56 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Sreekanth Reddy @ 2020-09-14 13:30 UTC (permalink / raw)
  To: Tomas Henzl
  Cc: linux-scsi, Suganath Prabu Subramani, Sathya Prakash Veerichetty

On Thu, Sep 10, 2020 at 7:51 PM Tomas Henzl <thenzl@redhat.com> wrote:
>
> - _base_process_reply_queue called from _base_interrupt
> may schedule a new irq poll, fix this by calling
> synchronize_irq first
> - a fix for "Unbalanced enable for IRQ..."
> enable_irq should be called only when necessary
>
> Fixes: 320e77acb327 ("scsi: mpt3sas: Irq poll to avoid CPU hard lockups")
> Signed-off-by: Tomas Henzl <thenzl@redhat.com>
Acked-by: sreekanth reddy <sreekanth.reddy@broadcom.com>

Thanks,
Sreekanth

> ---
>  drivers/scsi/mpt3sas/mpt3sas_base.c | 14 +++++++++-----
>  drivers/scsi/scsi_scan.c            |  8 ++++++++
>  2 files changed, 17 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c
> index a85c9672c6ea..a67749c8f4ab 100644
> --- a/drivers/scsi/mpt3sas/mpt3sas_base.c
> +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c
> @@ -1808,18 +1808,22 @@ mpt3sas_base_sync_reply_irqs(struct MPT3SAS_ADAPTER *ioc)
>                 /* TMs are on msix_index == 0 */
>                 if (reply_q->msix_index == 0)
>                         continue;
> +               synchronize_irq(pci_irq_vector(ioc->pdev, reply_q->msix_index));
>                 if (reply_q->irq_poll_scheduled) {
>                         /* Calling irq_poll_disable will wait for any pending
>                          * callbacks to have completed.
>                          */
>                         irq_poll_disable(&reply_q->irqpoll);
>                         irq_poll_enable(&reply_q->irqpoll);
> -                       reply_q->irq_poll_scheduled = false;
> -                       reply_q->irq_line_enable = true;
> -                       enable_irq(reply_q->os_irq);
> -                       continue;
> +                       /* check how the scheduled poll has ended,
> +                        * clean up only if necessary
> +                        */
> +                       if (reply_q->irq_poll_scheduled) {
> +                               reply_q->irq_poll_scheduled = false;
> +                               reply_q->irq_line_enable = true;
> +                               enable_irq(reply_q->os_irq);
> +                       }
>                 }
> -               synchronize_irq(pci_irq_vector(ioc->pdev, reply_q->msix_index));
>         }
>  }
>
> --
> 2.25.4
>

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

* Re: [PATCH] mpt3sas: fix sync irqs
  2020-09-10 14:21 [PATCH] mpt3sas: fix sync irqs Tomas Henzl
  2020-09-14 13:30 ` Sreekanth Reddy
@ 2020-09-15 22:38 ` Martin K. Petersen
  2020-09-22  3:56 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2020-09-15 22:38 UTC (permalink / raw)
  To: Tomas Henzl
  Cc: linux-scsi, sreekanth.reddy, suganath-prabu.subramani, sathya.prakash


Tomas,

> - _base_process_reply_queue called from _base_interrupt may schedule a
> new irq poll, fix this by calling synchronize_irq first

Applied to 5.10/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

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

* Re: [PATCH] mpt3sas: fix sync irqs
  2020-09-10 14:21 [PATCH] mpt3sas: fix sync irqs Tomas Henzl
  2020-09-14 13:30 ` Sreekanth Reddy
  2020-09-15 22:38 ` Martin K. Petersen
@ 2020-09-22  3:56 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2020-09-22  3:56 UTC (permalink / raw)
  To: linux-scsi, Tomas Henzl
  Cc: Martin K . Petersen, sreekanth.reddy, suganath-prabu.subramani,
	sathya.prakash

On Thu, 10 Sep 2020 16:21:26 +0200, Tomas Henzl wrote:

> - _base_process_reply_queue called from _base_interrupt
> may schedule a new irq poll, fix this by calling
> synchronize_irq first
> - a fix for "Unbalanced enable for IRQ..."
> enable_irq should be called only when necessary

Applied to 5.10/scsi-queue, thanks!

[1/1] scsi: mpt3sas: Fix sync irqs
      https://git.kernel.org/mkp/scsi/c/45181eab8ba7

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2020-09-22  3:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-10 14:21 [PATCH] mpt3sas: fix sync irqs Tomas Henzl
2020-09-14 13:30 ` Sreekanth Reddy
2020-09-15 22:38 ` Martin K. Petersen
2020-09-22  3:56 ` 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).