Re: [PATCH] QStor SATA/RAID driver for 2.6.9-rc3

From: Jeff Garzik
Date: Tue Oct 12 2004 - 12:47:27 EST


Mark Lord wrote:
It's been there since day one. The interrupt handling sometimes requires
more functionality than is available at interrupt time, so it uses
schedule_work to have a bottom half re-run itself from thread context.
This is needed in the error-processing and hot plug paths.


ewwww :) If you find yourself calling your irq path from non-irq-context code, back up, you're going down the wrong path.

The usual way to do what you want is either

1) wrap all code that _might_ be called from inside interrupt handler inside spin_lock_irqsave() [except when you are in the interrupt handler, of course, which is merely spin_lock()

Any code that checks "if (in_interrupt())" should be shot on sight :)


2) have both interrupt and non-interrupt contexts fire a tasklet using tasklet_schedule(). Your tasklet function then does the real work.

Jeff


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/