[PATCH] lpfc: replace spin_lock with spin_lock_irqsave

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi

lpfc_sli_intr_handler() takes spinlock phba->hbalock without disabling irq on
local cpu. This patch replaces normal spin_lock/unlock with irqsave/restore.

Although current code won't cause any deadlock (since this is interrupt context),
the code looks strange to me because all the other intr handlers (sp,fp and s4
handlers) use irqsave/restore. Especially where the code takes the spinlock with
spin_lock and release it with spin_unlock_irq when DEFER_ERATT bit is set.

thanks,
Tomohiro Kusumi


Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@xxxxxxxxxxxxxx>
---

diff -aNur linux-2.6.33-rc7.org/drivers/scsi/lpfc/lpfc_sli.c linux-2.6.33-rc7/drivers/scsi/lpfc/lpfc_sli.c
--- linux-2.6.33-rc7.org/drivers/scsi/lpfc/lpfc_sli.c	2010-02-07 07:17:12.000000000 +0900
+++ linux-2.6.33-rc7/drivers/scsi/lpfc/lpfc_sli.c	2010-02-07 17:58:49.831703434 +0900
@@ -8213,7 +8213,7 @@
 {
 	struct lpfc_hba  *phba;
 	irqreturn_t sp_irq_rc, fp_irq_rc;
-	unsigned long status1, status2;
+	unsigned long status1, status2, iflag;
 	uint32_t hc_copy;
 
 	/*
@@ -8229,10 +8229,10 @@
 	if (lpfc_intr_state_check(phba))
 		return IRQ_NONE;
 
-	spin_lock(&phba->hbalock);
+	spin_lock_irqsave(&phba->hbalock, iflag);
 	phba->ha_copy = readl(phba->HAregaddr);
 	if (unlikely(!phba->ha_copy)) {
-		spin_unlock(&phba->hbalock);
+		spin_unlock_irqrestore(&phba->hbalock, iflag);
 		return IRQ_NONE;
 	} else if (phba->ha_copy & HA_ERATT) {
 		if (phba->hba_flag & HBA_ERATT_HANDLED)
@@ -8247,7 +8247,7 @@
 	 * If there is deferred error attention, do not check for any interrupt.
 	 */
 	if (unlikely(phba->hba_flag & DEFER_ERATT)) {
-		spin_unlock_irq(&phba->hbalock);
+		spin_unlock_irqrestore(&phba->hbalock, iflag);
 		return IRQ_NONE;
 	}
 
@@ -8259,7 +8259,7 @@
 	writel((phba->ha_copy & ~(HA_LATT | HA_ERATT)), phba->HAregaddr);
 	writel(hc_copy, phba->HCregaddr);
 	readl(phba->HAregaddr); /* flush */
-	spin_unlock(&phba->hbalock);
+	spin_unlock_irqrestore(&phba->hbalock, iflag);
 
 	/*
 	 * Invokes slow-path host attention interrupt handling as appropriate.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux