[3549] in linux-scsi channel archive
Re: spinlocks in SCSI code
daemon@ATHENA.MIT.EDU (Kurt Garloff)
Tue Mar 17 17:55:59 1998
Date: Tue, 17 Mar 1998 23:49:43 +0100
From: Kurt Garloff <garloff@kg1.ping.de>
To: Doug Ledford <dledford@dialnet.net>, linux-scsi@vger.rutgers.edu,
"Leonard N. Zubkoff" <lnz@dandelion.com>,
Gerard Roudier <groudier@club-internet.fr>
Mail-Followup-To: Doug Ledford <dledford@dialnet.net>,
linux-scsi@vger.rutgers.edu,
"Leonard N. Zubkoff" <lnz@dandelion.com>,
Gerard Roudier <groudier@club-internet.fr>
In-Reply-To: <19980317132950.A772@kg1.ping.de>; from Kurt Garloff on Tue, Mar 17, 1998 at 01:29:50PM +0100
On Tue, Mar 17, 1998 at 01:29:50PM +0100, Kurt Garloff wrote:
> Well, as a first test, I implemented this for the ncr53c8xx driver, as I'm
> able to test it directly. Of course it works very well, as I have a UP
> machine and the spin_lock_irqsave (); does exactly the same as save_flags();
> cli();
>
> Too bad I don't have a SMP machine to test.
Well, I can compile a SMP kernel for my UP machine.
There's one situation, I didn't think of:
The driver could try to lock the kernel twice, which will result in a
deadlock. With the save_flags(); cli(); syntax, this was not detected, but
with the spin_lock(); this will cause a hang.
There are at least two places in the ncr53c8xx driver where this occurs:
1) ncr_timeout(): requeue_waiting_list(); is called which will call
ncr_queue_command() which tries to get the spinlock.
2) ncr_complete() is called from within ncr_exception(), the interrupt
handler, which holds the lock. ncr_complete() calls
requeue_waiting_list().
As a workaround, I added two spin_unlock() [without the _irqrestore] insns
at the places where requeue_ ... is called. This is no clean solution, though.
Maybe we should move the lock from ncr_queue_command() outwards to
ncr53c8xx_queue_command() and make sure, that we have the lock set at every
place it can be called.
Comments ?
--
Kurt Garloff, Dortmund
<K.Garloff@ping.de>
PGP key on http://student.physik.uni-dortmund.de/homepages/garloff
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.rutgers.edu