On Sun, Feb 27, 2000 at 05:55:27PM -0800, Matthew Dharm wrote:
> Maybe I'm missing something, but if I get an interrupt while I'm working
> on a command, then doesn't the interrupt handler get invoked?

Yes.

> That is, my
> code stops executing while the interrupt is being serviced.  My code,
> which then calls scsi_done(), doesn't start executing until after the
> interrupt is serviced and I've returned to my context?

And the code being called in the IRQ handler may be yours! It might
IRQ from your SCSI controller ...

> > Anyway, I think you need to use the irq safe spinlock anyway, cause
> > otherwise you risk:
> > 
> > queue_command():    spinlock
> > IRQ -> irq handler: spinlock_irqsave() will deadlock!!
> 
> But I don't have an IRQ handler that will try to obtain the lock.  

Hmm? You should. Unless you have designed your IRQ handler to be very very
carefully only doing atomic operations on data that you might access
from your other code (i.e. queue_command()). 
Anyway, before calling scsi_done() on command completion, which you probably
do from your IRQ handler, you have to acquire the io_request_lock.

> The only thing I'm worried about is:
> 
> IRQ -> irq handler -> queuecommand()

Even if your IRQ handler does not do it, it might happen that another SCSI
command on another Controller completes and that its IRQ handler calls
scsi_done() and queue_command() is called to queue the next command to
your controller. [Maybe the mid-layer avoid this, I don't know, but I 
certainly did not want to rely on it for saving 10 CPU cycles on a
spinlock in a function that consumes 200+ anyway ...]

> If that can't happen, then I'm free and clear to use the non IRQ-safe
> spinlocks.

If your SCSI controller uses an IRQ handler, I see no way to avoid
IRQ safe spinlocks. Also think of SMP machines ...

Regards,
-- 
Kurt Garloff                   <[EMAIL PROTECTED]>         [Eindhoven, NL]
Physics: Plasma simulations <[EMAIL PROTECTED]>   [TU Eindhoven, NL] 
Linux: SCSI, Security          <[EMAIL PROTECTED]>   [SuSE Nuernberg, FRG]
 (See mail header or public key servers for PGP2 and GPG public keys.)

-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]

Reply via email to