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