Re: [PATCH] i386 rwlock bug?

Manfred Spraul (manfreds@colorfullife.com)
Sat, 21 Aug 1999 11:26:39 +0200


Lennert Buytenhek wrote:
> >if a writer spins (interupts are enabled), then an interrupt occurs,
> >then you have a dead-lock.
>
> You're being a bit vague here, but I take this as follows: If trying
> to acquire a write lock locks out more readers and an interrupts
> tries to acquire a read lock the machine can hang.

Sorry, here the detailed (and corrected) explanation. You need 2 CPUS.

CPU1: acquires the lock "READ" from outside an interrupt. interrupts
remain enabled.

CPU2: disables the local interrupts, and tries to acquire the lock
"WRITE". Since CPU1 owns the lock, it will spin.

CPU1: an interrupt occurs, and the interrupt handler tries to acquire
the lock "READ".

This is legal if you use a "strave writer"-policy, but with your change
it is a dead-lock.

--
	Manfred

- 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/