Skip to contentSkip to conversation

mpt3sas: fix sync irqs

PATCH Applied Tomas Henzl 3 participants 4 messages Sep 10, 2020 – Sep 22, 2020

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

PATCH 1/1 mpt3sas: fix sync irqs

- _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")
---
 drivers/scsi/mpt3sas/mpt3sas_base.c | 14 +++++++++-----
 drivers/scsi/scsi_scan.c            |  8 ++++++++
 2 files changed, 17 insertions(+), 5 deletions(-)
drivers/scsi/mpt3sas/mpt3sas_base.c +9 -5
index a85c9672c6ea..a67749c8f4ab 100644
@@ -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));
 	}
 }
 
Signature · 1 line
2.25.4
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Tomas Henzl

- _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")

Thanks,
Sreekanth

Quoted 40 lines
---
 drivers/scsi/mpt3sas/mpt3sas_base.c | 14 +++++++++-----
 drivers/scsi/scsi_scan.c            |  8 ++++++++
 2 files changed, 17 insertions(+), 5 deletions(-)
drivers/scsi/mpt3sas/mpt3sas_base.c +9 -6
index a85c9672c6ea..a67749c8f4ab 100644
@@ -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

#2 lore raw
In reply to Tomas Henzl

Tomas,

Quoted 2 lines

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

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#3 lore raw
In reply to Tomas Henzl
Quoted 5 lines · Tomas Henzl

- _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
Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering