linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -rt] ide: fix interrupts processing issue with preempt-able hardirqs
@ 2008-06-23 23:40 Anton Vorontsov
  2008-06-23 23:51 ` Ingo Molnar
  2008-06-23 23:52 ` [PATCH -rt] ide: fix interrupts processing issue with preempt-able hardirqs Anton Vorontsov
  0 siblings, 2 replies; 24+ messages in thread
From: Anton Vorontsov @ 2008-06-23 23:40 UTC (permalink / raw)
  To: linux-ide
  Cc: Bartlomiej Zolnierkiewicz, Alan Cox, Ingo Molnar, Sergei Shtylyov,
	linux-kernel

IDE interrupt handler relies on the fact that, if necessary, hardirqs
will re-trigger on ISR exit. With fully preemtable IRQs this seems to be
not true, since if hardirq thread is currently running, and the same IRQ
raised again, then this IRQ will be simply lost.

This patch fixes following issue:

ALI15X3: IDE controller (0x10b9:0x5229 rev 0xc8) at  PCI slot 0001:03:1f.0
ALI15X3: 100% native mode on irq 18
    ide0: BM-DMA at 0x1120-0x1127, BIOS settings: hda:PIO, hdb:PIO
    ide1: BM-DMA at 0x1128-0x112f, BIOS settings: hdc:PIO, hdd:PIO
hda: Optiarc DVD RW AD-7190A, ATAPI CD/DVD-ROM drive
hda: UDMA/66 mode selected
ide0 at 0x1100-0x1107,0x110a on irq 18
ide-cd: cmd 0x5a timed out
hda: lost interrupt
hda: ATAPI 12X DVD-ROM DVD-R-RAM CD-R/RW drive, 2048kB Cache
Uniform CD-ROM driver Revision: 3.20
ide-cd: cmd 0x3 timed out
hda: lost interrupt
ide-cd: cmd 0x3 timed out
hda: lost interrupt
...

Though, some IDE devices (e.g. SONY DVD RW AW-Q170A) seem to work fine
without this patch, probably because they trigger IRQ after some delay.

This patch should be almost no-op for the !RT kernels, thus no #ifdefs.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
 drivers/ide/ide-io.c |   19 +++++++++++++++----
 1 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index 6c1b288..a52733e 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -1460,6 +1460,7 @@ static void unexpected_intr (int irq, ide_hwgroup_t *hwgroup)
  
 irqreturn_t ide_intr (int irq, void *dev_id)
 {
+	int ret = IRQ_NONE;
 	unsigned long flags;
 	ide_hwgroup_t *hwgroup = (ide_hwgroup_t *)dev_id;
 	ide_hwif_t *hwif;
@@ -1467,12 +1468,13 @@ irqreturn_t ide_intr (int irq, void *dev_id)
 	ide_handler_t *handler;
 	ide_startstop_t startstop;
 
+again:
 	spin_lock_irqsave(&ide_lock, flags);
 	hwif = hwgroup->hwif;
 
 	if (!ide_ack_intr(hwif)) {
 		spin_unlock_irqrestore(&ide_lock, flags);
-		return IRQ_NONE;
+		return ret;
 	}
 
 	if ((handler = hwgroup->handler) == NULL || hwgroup->polling) {
@@ -1510,7 +1512,7 @@ irqreturn_t ide_intr (int irq, void *dev_id)
 #endif /* CONFIG_BLK_DEV_IDEPCI */
 		}
 		spin_unlock_irqrestore(&ide_lock, flags);
-		return IRQ_NONE;
+		return ret;
 	}
 	drive = hwgroup->drive;
 	if (!drive) {
@@ -1532,7 +1534,7 @@ irqreturn_t ide_intr (int irq, void *dev_id)
 		 * enough advance overhead that the latter isn't a problem.
 		 */
 		spin_unlock_irqrestore(&ide_lock, flags);
-		return IRQ_NONE;
+		return ret;
 	}
 	if (!hwgroup->busy) {
 		hwgroup->busy = 1;	/* paranoia */
@@ -1578,7 +1580,16 @@ irqreturn_t ide_intr (int irq, void *dev_id)
 		}
 	}
 	spin_unlock_irqrestore(&ide_lock, flags);
-	return IRQ_HANDLED;
+	ret = IRQ_HANDLED;
+
+	/*
+	 * Previous handler() may have set things up for another interrupt to
+	 * occur soon... in case we've lost it (e.g. with preemtable hardirqs),
+	 * try again and then return gracefully if no irqs were pending.
+	 */
+	if (startstop != ide_stopped)
+		goto again;
+	return ret;
 }
 
 /**
-- 
1.5.5.4

^ permalink raw reply related	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2008-06-29 23:28 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-23 23:40 [PATCH -rt] ide: fix interrupts processing issue with preempt-able hardirqs Anton Vorontsov
2008-06-23 23:51 ` Ingo Molnar
2008-06-24  0:00   ` Anton Vorontsov
2008-06-25 12:34     ` Anton Vorontsov
2008-06-25 12:32       ` Alan Cox
2008-06-25 14:12         ` Anton Vorontsov
2008-06-25 13:15       ` Sergei Shtylyov
2008-06-25 14:22         ` Anton Vorontsov
2008-06-25 14:32           ` Alan Cox
2008-06-25 15:26             ` Anton Vorontsov
2008-06-25 14:59           ` Anton Vorontsov
2008-06-28  0:54       ` [PATCH v2 -rt] ide: workaround buggy hardware issues with preemptable hardirqs Anton Vorontsov
2008-06-28  1:09         ` Anton Vorontsov
2008-06-28  9:15           ` Alan Cox
2008-06-28  9:14         ` Alan Cox
2008-06-28 10:43           ` Sergei Shtylyov
2008-06-29 12:49             ` Alan Cox
2008-06-29 13:17               ` Sergei Shtylyov
2008-06-29 14:23                 ` Anton Vorontsov
2008-06-28 10:30         ` Sergei Shtylyov
2008-06-28 11:31           ` Anton Vorontsov
2008-06-28 11:52             ` Sergei Shtylyov
2008-06-29 23:26         ` Benjamin Herrenschmidt
2008-06-23 23:52 ` [PATCH -rt] ide: fix interrupts processing issue with preempt-able hardirqs Anton Vorontsov

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).