Re: smp dead lock of io_request_lock/queue_lock patch

From: Doug Ledford
Date: Sat Jan 17 2004 - 15:43:59 EST


On Sat, 2004-01-17 at 14:29, Christoph Hellwig wrote:
> On Sat, Jan 17, 2004 at 02:21:43PM -0500, Doug Ledford wrote:
> > I should pay more attention to what goes on in 2.6. That was a crap
> > decision. There are drivers out there that use global data and need one
> > lock across all controllers. Putting a lock in the scsi host struct for
> > per controller locks is a waste of space. Let the driver decide if it
> > needs a global driver lock, a per controller lock (in which case it
> > should be part of the driver private host struct), or just the global
> > io_request_lock. It really is up to the driver and putting it into the
> > scsi host struct doesn't make sense.
>
> I tend to disagree. Giving the driver control over the lock used by the
> midlayer is just wrong. If it has global state (which a good driver better
> shouldn't) it's up to the driver to protect it. That we still have a way
> to override that lock is the big bug rather, and in fact only three drivers
> are doing that, and they all override it with a lock that's per-HBA anyway.

/me calls Christoph various unrepeatable names :-P

I'm exactly the opposite. In my opinion, the mid layer should be using
the device locks for its internal operations and calling into the low
level drivers with no locks held. The fact that the mid layer still
tries to lock drivers for the drivers is a bug IMO. Every time I see a
driver do spin_unlock_irq(host->host_lock); do driver work;
spin_lock_irq(host->host_lock); return; it really points out that the
mid layer has no business locking down drivers for them.


--
Doug Ledford <dledford@xxxxxxxxxx> 919-754-3700 x44233
Red Hat, Inc.
1801 Varsity Dr.
Raleigh, NC 27606


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/