On Thu, Dec 03, 1998 at 12:48:04PM +0100, Bas Vermeulen wrote:
> suspecting that. I haven't been able to find anything on the spin_lock
> thingy yet (apart from the driver code, which I don't understand yet :)

linux/Documentation/spinlocks.txt

> I am NOT getting any Timeout messages from the DC390, only Read Errors
> from my disks connected to the Initio. This does hangup other things as
> well though, since my box becomes completely unresponsive to the point
> that I have to reboot it with Alt-SysRq-b. This is NOT caused by the
> DC390, but (IMO) by the faulty locking in the initio driver.

I'm somewhat relieved that the DC390 driver does not seem to be faulty.

If you want to fix the Initio driver, you should know, that at the moment,
the SCSI subsystem uses the global io_request_lock to serialize access.
[This will change with kernel 2.3 ...]
This lock is aquired by the mid-level SCSI code most of the time, so you
don't need to worry too much. There's one really important place, where we
have to acquire the lock: When the IRQ handler is called.

Place spin_lock_irqsave(&io_request_lock, flags) there. On leaving the
IRQ, you have to spin_unlock_irqrestore(&io_request_lock, flags); 

Beware of not recursing the spinlocks, because this will deadlock your system!

Basically, the driver can be entered via the 
* routines declared in the Scsi_Host_Template struct
* IRQ handler

Most of the routines are called from mid-level code with the lock already
aquired by mid-level code: abort(), reset(), queuecommand(). Don't lock on
io_request_lock here.

So: 
* Comment out all cli()/sti().
* Place an io_request lock for the IRQ
* (Optionally) Place an io_request_lock for release(), detect(), proc_info()

and you should be done.

-- 
Kurt Garloff <[EMAIL PROTECTED]>  (Dortmund, FRG)
PGP key on http://student.physik.uni-dortmund.de/homepages/garloff

The second clause "open source code of derivative works" has been the
most controversial (and, potentially the most successful) aspect of
CopyLeft licensing.                             -- Halloween Document

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

Reply via email to