linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <htejun@gmail.com>
To: Jon Chelton <jchelton@ffpglobal.com>
Cc: linux-ide@vger.kernel.org
Subject: Re: sata_sil24 with port multiplier
Date: Sun, 23 Sep 2007 12:25:11 +0900	[thread overview]
Message-ID: <46F5DC97.4010406@gmail.com> (raw)
In-Reply-To: <FD6311B7ED175B4480F31633F6098B4D911C4A@ffpglobal_mail.corp.ffplus.net>

[-- Attachment #1: Type: text/plain, Size: 342 bytes --]

Jon Chelton wrote:
> Thanks Tejun,  
> 
> I have applied the patch and rebuilt the module.  I do not seem to be
> getting the same error (although it only shows up during heavy disk
> activity).  But now I am getting a lot of spurious interrupts.

Yeah, those are harmless and expected.  The attached patch should fix
the problem.

-- 
tejun

[-- Attachment #2: fix-sata_sil24 --]
[-- Type: text/plain, Size: 2255 bytes --]

[PATCH] sata_sil24: fix IRQ clearing race when PCIX_IRQ_WOC is used

When PCIX_IRQ_WOC is used, sil24 has an inherent race condition
between clearing IRQ pending and reading IRQ status.  If IRQ pending
is cleared after reading IRQ status, there's possibility of lost IRQ.
If IRQ pending is cleared before reading IRQ status, spurious IRQs
will occur.

sata_sil24 till now cleared IRQ pending after reading IRQ status thus
losing IRQs on machines where PCIX_IRQ_WOC was used.  Reverse the
order and ignore spurious IRQs if PCIX_IRQ_WOC.

Signed-off-by: Tejun Heo <htejun@gmail.com>
---
This fixes a long-standing IRQ loss problem (and accompanying
timeouts) on sata_sil24.

 drivers/ata/sata_sil24.c |   16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

Index: work/drivers/ata/sata_sil24.c
===================================================================
--- work.orig/drivers/ata/sata_sil24.c
+++ work/drivers/ata/sata_sil24.c
@@ -889,6 +889,16 @@ static inline void sil24_host_intr(struc
 	u32 slot_stat, qc_active;
 	int rc;
 
+	/* If PCIX_IRQ_WOC, there's an inherent race window between
+	 * clearing IRQ pending status and reading PORT_SLOT_STAT
+	 * which may cause spurious interrupts afterwards.  This is
+	 * unavoidable and much better than losing interrupts which
+	 * happens if IRQ pending is cleared after reading
+	 * PORT_SLOT_STAT.
+	 */
+	if (ap->flags & SIL24_FLAG_PCIX_IRQ_WOC)
+		writel(PORT_IRQ_COMPLETE, port + PORT_IRQ_STAT);
+
 	slot_stat = readl(port + PORT_SLOT_STAT);
 
 	if (unlikely(slot_stat & HOST_SSTAT_ATTN)) {
@@ -896,9 +906,6 @@ static inline void sil24_host_intr(struc
 		return;
 	}
 
-	if (ap->flags & SIL24_FLAG_PCIX_IRQ_WOC)
-		writel(PORT_IRQ_COMPLETE, port + PORT_IRQ_STAT);
-
 	qc_active = slot_stat & ~HOST_SSTAT_ATTN;
 	rc = ata_qc_complete_multiple(ap, qc_active, sil24_finish_qc);
 	if (rc > 0)
@@ -911,7 +918,8 @@ static inline void sil24_host_intr(struc
 		return;
 	}
 
-	if (ata_ratelimit())
+	/* spurious interrupts are expected if PCIX_IRQ_WOC */
+	if (!(ap->flags & SIL@$_FLAG_PCIX_IRQ_WOC) && ata_ratelimit())
 		ata_port_printk(ap, KERN_INFO, "spurious interrupt "
 			"(slot_stat 0x%x active_tag %d sactive 0x%x)\n",
 			slot_stat, ap->link.active_tag, ap->link.sactive);

  reply	other threads:[~2007-09-23  3:25 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-21 17:41 sata_sil24 with port multiplier Jon Chelton
2007-09-23  3:25 ` Tejun Heo [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-09-29 19:14 Jon Chelton
2007-10-02 12:07 ` Bruce Allen
2007-09-28 18:25 Jon Chelton
2007-09-28 21:48 ` Tejun Heo
2007-09-29  4:47   ` Bruce Allen
2007-09-28 16:08 Jon Chelton
2007-09-28 16:51 ` Tejun Heo
2007-09-27 21:01 Jon Chelton
2007-09-28 10:24 ` Tejun Heo
2007-09-23  3:56 Jon Chelton
2007-09-23  3:34 Jon Chelton
2007-09-23  3:36 ` Tejun Heo
2007-09-22  0:00 Thomas Evans
     [not found] <FD6311B7ED175B4480F31633F6098B4D911C41@ffpglobal_mail.corp.ffplus.net>
2007-09-21 10:55 ` Tejun Heo

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=46F5DC97.4010406@gmail.com \
    --to=htejun@gmail.com \
    --cc=jchelton@ffpglobal.com \
    --cc=linux-ide@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 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).