On Sat, Jan 22, 2000 at 02:14:44PM -0500, Eric Youngdale wrote:
> One of the things that has been sticking in my craw for a while is the
> way that all of the low-level drivers currently use the io_request_lock in
> order to provide SMP safety. There isn't anything wrong with making the
> thing SMP safe, of course, the problem is that io_request_lock is
> technically designed to protect the queue proper and not provide generic
> protection for low-level drivers. Severe misuse of the thing can lead to
> severe system performance problems. Before the queueing rewrite,
> io_request_lock was already held by the mid-level when calling into the
> low-level, and the low-level drivers were along for the ride.
If my memory serves, too many low-level drivers were unfixed until 2.1.8x,
so the global io_request_lock was introduced in the mid-level code. The
low-level drivers then just had to lock in the IRQ handler (and maybe detect
()). I never liked this, but that was probably the only option not to delay
2.2 even more.
> ...
>
> I am proposing a means by which we can get all of the low-level drivers
> to pry their grubby little fingers off the io_request_lock. I am thinking
> of adding a "smp_safe" flag to the host template. If this flag is not set,
> it indicates that the low-level driver is expecting the current behavior (in
> other words, it assumes that io_request_lock is held when each of it't
> entrypoints is called). Defining it this way means that with no changes to
> the low-level drivers it is possible for things to work correctly.
Go ahead. I think this approach allows a smooth transition. If you want, you
can even make it dependent on some CONFIG_SCSI_SMPLOCK option, so that one
can easily revert to the old behaviour, if one meets problems. That would
allow the driver's authors to test for this option and do their locking just
when this MACRO is set. It will be ugly code (lots of ifdefs), but you'll
have that anyway for drivers which have a unique codebase for 2.2 and 2.4
(what many driver authors like, and so do I).
define something which we can test on in hosts.h:
if (SCSI_SMP_SAFE) spinlock_irqsave (&my_lock, &flags);
> The changes to the mid-layer to support this are probably < 10Kbyte
> worth of diffs.
Even less, I think.
> Comments?
Please go ahead!
Finally, having more than one SCSI adapter would then really speed up
I/O on SMP machines ...
Regards,
--
Kurt Garloff <[EMAIL PROTECTED]> Eindhoven, NL
GPG key: See mail header, key servers Linux kernel development
SuSE GmbH, Nuernberg, FRG SCSI, Security
PGP signature