Re: sbp2.c on SMP

Jens Axboe (axboe@suse.de)
Mon, 12 Nov 2001 18:34:42 +0100


On Sun, Nov 11 2001, Andrew Morton wrote:
> Guys,
>
> drivers/ieee1394/sbp2.c deadlocks immediately on SMP, because
> io_request_lock is not held over its call to scsi_old_done().
>
> I don't know why scsi_old_done() actually requires io_request_lock;
> perhaps Jens could comment on whether I've taken the lock in the
> appropriate place?

Yes it looks fine, unfortunately the mid layer locking design is crappy
like that. Imposing locking downwards is just not good style :/

I've actually had quite good luck changing this for future kernels -- it
was required to remove io_request_lock anyways.

> The games which scsi_old_done() plays with spinlocks and interrupt
> enabling are really foul. If someone calls it with interrupts disabled
> (sbp2 does this) then scsi_old_done() will enable interrupts for you.
> If, for example, you call scsi_old_done() under spin_lock_irqsave(),
> the reenabling of interrupts will expose you to deadlocks. Perhaps
> scsi_old_done() should just use spin_unlock()/spin_lock()?

Yep it's not nice either. I wouldn't change that without further
auditing though.

-- 
Jens Axboe

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