All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tomohiro Kusumi <kusumi.tomohiro@jp.fujitsu.com>
To: James.Smart@emulex.com, linux-scsi@vger.kernel.org
Cc: kusumi.tomohiro@jp.fujitsu.com
Subject: [PATCH] lpfc: replace spin_lock with spin_lock_irqsave
Date: Sun, 07 Feb 2010 18:53:17 +0900	[thread overview]
Message-ID: <4B6E8D8D.60308@jp.fujitsu.com> (raw)

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.

                 reply	other threads:[~2010-02-07  9:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B6E8D8D.60308@jp.fujitsu.com \
    --to=kusumi.tomohiro@jp.fujitsu.com \
    --cc=James.Smart@emulex.com \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.