m68k/atari - ide: do not register interrupt if host->get_lock is set
cover m68k/atari - ide: do not register interrupt if host->get_lock is set
Geert,
as hinted in my earlier patch series, this one bit me while debugging the SCSI/IDE deadlock on my Falcon.
On Falcon, registering the IDE interrupt handler is taken care of by registering stdma_int() in the arch setup code, then passing the relevant IDE interrupt handler as argument to stdma_lock(). This ensures that the IDE inthandler is only called if IDE has acquired the ST-DMA lock, and avoids the IDE handler stepping on the SCSI handlers' toes if the ST-DMA is locked by SCSI.
At some point in the past, the IDE interrupt was registered unconditionally even on m68k, resulting in both stdma_int() and ide_interrupt() being registered, again opening up the potential of IDE taking interrupts meant to be handled by SCSI (or floppy). This might result in deadlocking the SCSI driver if IDE releases the ST-DMA lock in error.
The next patch changes the IDE core to only register the IDE handler if host->get_lock is not set - AFAIK m68k is the sole user of host->get_lock so we can rely on IDE interrupts being handled through the multiplexer whenever host->get_lock happens to be set.
Cheers,
Michael
PATCH 1/1 m68k/atari - ide: do not register interrupt if host->get_lock is set
On m68k, host->get_lock may be used to both lock and register the interrupt that the IDE host shares with other device drivers. Registering the IDE interrupt handler in ide-probe.c results in duplicating the interrupt registered, and may result in IDE accepting interrupts even when another driver has locked the interrupt hardware.
--- drivers/ide/ide-probe.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/ide/ide-probe.c +3 -2
@@ -853,8 +853,9 @@ static int init_irq (ide_hwif_t *hwif)if (irq_handler ==NULL ) irq_handler = ide_intr; -if (request_irq (hwif->irq, irq_handler, sa, hwif->name, hwif)) - goto out_up; +if (!host->get_lock) +if (request_irq (hwif->irq, irq_handler, sa, hwif->name, hwif)) + goto out_up;#if !defined(__mc68000__) printk(KERN_INFO "%s at 0x%03lx-0x%03lx,0x%03lx on irq %d", hwif->name,
Signature · 1 line
1.7.0.4
drivers/ide/ide-probe.c static int init_irq (ide_hwif_t *hwif) · line 858
Quoted 11 lines · Michael Schmitz
drivers/ide/ide-probe.c +3
-2@@ -853,8 +853,9 @@ static int init_irq (ide_hwif_t *hwif)if (irq_handler ==NULL ) irq_handler = ide_intr; -if (request_irq (hwif->irq, irq_handler, sa, hwif->name, hwif)) - goto out_up; +if (!host->get_lock) +if (request_irq (hwif->irq, irq_handler, sa, hwif->name, hwif)) + goto out_up;
Don't you need a similar check for free_irq()?
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Geert,
Quoted 7 lines · Geert Uytterhoeven
Quoted 6 lines · Michael Schmitz
drivers/ide/ide-probe.c +0
-0@@ -853,8 +853,9 @@ static int init_irq (ide_hwif_t *hwif)if (irq_handler ==NULL ) irq_handler = ide_intr;
Quoted 7 lines
drivers/ide/ide-probe.c static int init_irq (ide_hwif_t *hwif) · line 858
Quoted 5 lines
drivers/ide/ide-probe.c +3
-2-if (request_irq (hwif->irq, irq_handler, sa, hwif->name, hwif)) - goto out_up; +if (!host->get_lock) +if (request_irq (hwif->irq, irq_handler, sa, hwif->name, hwif)) + goto out_up;Don't you need a similar check for
free_irq()?
Absolutely. Thanks for spotting this. I'll send the fixed version to linux-ide.
Cheers,
Michael