* [PATCH] lpfc: replace spin_lock with spin_lock_irqsave
@ 2010-02-07 9:53 Tomohiro Kusumi
0 siblings, 0 replies; only message in thread
From: Tomohiro Kusumi @ 2010-02-07 9:53 UTC (permalink / raw)
To: James.Smart, linux-scsi; +Cc: kusumi.tomohiro
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@jp.fujitsu.com>
---
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.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2010-02-07 9:52 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-07 9:53 [PATCH] lpfc: replace spin_lock with spin_lock_irqsave Tomohiro Kusumi
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).