[3555] in linux-scsi channel archive

home help back first fref pref prev next nref lref last post

Re: spinlocks in SCSI code

daemon@ATHENA.MIT.EDU (Gerard Roudier)
Wed Mar 18 14:37:07 1998

Date: 	Wed, 18 Mar 1998 20:39:20 +0100 (MET)
From: Gerard Roudier <groudier@club-internet.fr>
To: Kurt Garloff <garloff@kg1.ping.de>
cc: Doug Ledford <dledford@dialnet.net>, linux-scsi@vger.rutgers.edu,
        "Leonard N. Zubkoff" <lnz@dandelion.com>
In-Reply-To: <19980317132950.A772@kg1.ping.de>


On Tue, 17 Mar 1998, Kurt Garloff wrote:

> On Tue, Mar 17, 1998 at 12:18:18PM +0100, Kurt Garloff wrote:
> > If I correctly understand the locking mechanism, it should be possible to
> > create a driver specific spinlock: spinlock_t rmscsim_lock =
> > SPIN_LOCK_UNLOCKED; and replace every save_flags(flags); cli(); within the
> > driver by spin_lock_irqsave (&tmscsim_lock, flags); and every
> > restore_flags(flags); by spin_unlock_irqrestore(&tmscsim_lock, flags);
> > [I assume, that all necessary locking is done by the driver at the moment
> > using the cli() mechanism, here.]
> > This would be somehow suboptimal, but very safe and still much better for
> > SMP machines than the current approach. 
> 
> 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.
> 
> Gerard, I append the diff. (Against 2.1.89, i.e. ncr53c8xx-2.5f)

Thanks for the patch.
Just have to say that I was aware of the SMP problem with the 2.1 
spin_lock stuff, but thanks again since I was not able to test the thing 
because I donnot have access to any SMP machine.

2 remarks:
---------
1) The right patch must use a lock per controller and not a global 
   lock for the driver (i.e.: the LOCK structure must be defined in the 
   ncb structure). The only global data that may be modified is the 
   boot command options, but this stuff is serialized at boot-up.

2) Some recursive calls may occur in the driver.



Regards,  Gerard.


-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.rutgers.edu

home help back first fref pref prev next nref lref last post