RE: IDE + SMP Lockup (no OOPS) in 2.2.12, 2.2.10

Tom Livingston (tsl@volition.org)
Wed, 29 Sep 1999 13:36:07 -0700


Alan Cox wrote:
> Ok whats happened is this
>
> CPU0 CPU1
> take hwgroup spinlock
> take an irq
> disable_irq
> [wait for IRQ completion]
> try to take hwgroup spinlock

After I read your mail, I read spinlocks.txt and some of the ide code. Bear
in mind that I probably have very little idea of what I'm doing, but I was
trying to learn.

Anyway, I did this, which seemed to fix the problem:

*** linux/drivers/block/ide.c Mon Aug 9 12:04:39 1999
--- linux.ide-race/drivers/block/ide.c Wed Sep 29 13:14:58 1999
***************
*** 1170,1182 ****
bdev->current_request = hwgroup->rq = drive->queue;
spin_unlock_irqrestore(&io_request_lock, io_flags);

if (hwif->irq != masked_irq)
disable_irq(hwif->irq);
- spin_unlock_irqrestore(&hwgroup->spinlock, *hwgroup_flags);
start_request(drive);
- spin_lock_irqsave(&hwgroup->spinlock, *hwgroup_flags);
if (hwif->irq != masked_irq)
enable_irq(hwif->irq);
}
}

--- 1170,1182 ----
bdev->current_request = hwgroup->rq = drive->queue;
spin_unlock_irqrestore(&io_request_lock, io_flags);

+ spin_unlock_irqrestore(&hwgroup->spinlock, *hwgroup_flags);
if (hwif->irq != masked_irq)
disable_irq(hwif->irq);
start_request(drive);
if (hwif->irq != masked_irq)
enable_irq(hwif->irq);
+ spin_lock_irqsave(&hwgroup->spinlock, *hwgroup_flags);
}
}

This patch applies cleanly against 2.2.12. I believe it should apply
cleanly to any newish 2.2 or 2.3 kernel.

I did some minor stress testing on this kernel, and it doesn't crash after
20-30 minutes of constant concurrent channel acces, and it used to crash
within a second.

Like I said, I don't know the faintest thing about kernel development, so if
this is conceptually wrong somewhere, it's not surprising. However, I think
it at least narrows down the field a bit.

Thanks,

Tom

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