[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-smp
Subject:    disable_irq in scsi and SMP
From:       Jakub Jelinek <jj () sunsite ! ms ! mff ! cuni ! cz>
Date:       1997-11-17 12:03:04
[Download RAW message or body]

I have further questions about scsi.c's disable_irq around queuecommand
and the comment statement above that:

        /* This locking tries to prevent all sorts of races between
         * queuecommand and the interrupt code.  In effect,
         * we are only allowed to be in queuecommand once at
         * any given time, and we can only be in the interrupt
         * handler and the queuecommand function at the same time
         * when queuecommand is called while servicing the
         * interrupt.
         */

        if(!in_interrupt() && SCpnt->host->irq)
            disable_irq(SCpnt->host->irq);

        host->hostt->queuecommand (SCpnt, scsi_done);

        if(!in_interrupt() && SCpnt->host->irq)
            enable_irq(SCpnt->host->irq);

Ok, now I'm not sure if that's true for SMP boxes. Apparently, during
masking the irq on intel, sparc32 and some other platforms (not on sparc64,
but that's another issue), as it is surrounded in disable_irq by
save_and_cli/restore_flags pair, no irqs of any kind (and thus no irqs of
the desired #) are running on other CPUs, but IMHO there is no guarantee
that some IRQ of that desired # 
a) is not spinning on the global irq lock to be released by disable_irq
b) is not pending in hardware and will be issued soon afterwards (this is
probably system dependant, it might differ between Intel, Sparc; but a) may
happen on all platforms I think).

If such a situation happens, one processor will be executing queuecommand
code while some other CPU will be handling an interrupt of the same card,
which is against the statement in the comment, which says it cannot happen.

Any solutions, ideas?

Please CC me if replying to linux-smp, as I'm not on that list.

Cheers,
    Jakub
___________________________________________________________________
Jakub Jelinek | jj@sunsite.mff.cuni.cz | http://sunsite.mff.cuni.cz
Administrator of SunSITE Czech Republic, MFF, Charles University
___________________________________________________________________
Ultralinux - first 64bit OS to take full power of the UltraSparc
Linux version 2.1.63 on a sparc64 machine (333.41 BogoMips).
___________________________________________________________________

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic