]> git.hungrycats.org Git - linux/commitdiff
Fix IDE "PIO WRITE wait for ready" test under extreme interrupt load.
authorLinus Torvalds <torvalds@home.osdl.org>
Sat, 3 Jan 2004 10:25:13 +0000 (02:25 -0800)
committerLinus Torvalds <torvalds@home.osdl.org>
Sat, 3 Jan 2004 10:25:13 +0000 (02:25 -0800)
From Daniel Tram Lux: under extreme irq load on an underpowered CPU,
the timeout loop may not make any progress, and decide that a timeout
occurred before it has actually tested the status register.

The minimal fix for now is to just have a final test _after_ the timeout
to remove the problem. The real fix would likely be to not have irqs
enabled between reading the status and the timeout.

drivers/ide/ide-iops.c

index 06d6292cf70f3aaa5c73d8c3780ecb908891dd49..a239bbaf5074d8a548196d1b8b78bff6820ad6f0 100644 (file)
@@ -647,6 +647,15 @@ int ide_wait_stat (ide_startstop_t *startstop, ide_drive_t *drive, u8 good, u8 b
                timeout += jiffies;
                while ((stat = hwif->INB(IDE_STATUS_REG)) & BUSY_STAT) {
                        if (time_after(jiffies, timeout)) {
+                               /*
+                                * One last read after the timeout in case
+                                * heavy interrupt load made us not make any
+                                * progress during the timeout..
+                                */
+                               stat = hwif->INB(IDE_STATUS_REG);
+                               if (!(stat & BUSY_STAT))
+                                       break;
+
                                local_irq_restore(flags);
                                *startstop = DRIVER(drive)->error(drive, "status timeout", stat);
                                return 1;