Re: [PATCH 1/2] Introduce mutex_lock_timeout

From: Matthew Wilcox
Date: Sat Nov 25 2006 - 11:33:04 EST


On Sat, Nov 25, 2006 at 05:00:27PM +0100, Ingo Oeser wrote:
> Ok, I will comment it. But I'll NOT comment on the implementation.
> I'll prove you instead, that timout based locking is non-sense.

Your proof misses a case and is thus invalid.

> What should the timout mutex_timeout() prevent? Usually the answer is
> "if sombody hangs on a mutex forever ...?" and people tell you "ok, that is
> a deadlock -> fix your code not to deadlock instead."
> Then they tell you "Ok, but if somebody takes a mutex too long?"
> and people will answer "ok, then this is a livelock -> fix your code not to
> livelock."
>
> Another answer is "I like to block until sth. happens wihin a specific time frame"
> -> fine, this is accomplished by wait_event_timout (which blocks only you and
> not every other user of the mutex).

In the qla case, the mutex can be acquired by a thread which then waits
for the hardware to do something. If the hardware locks up, it is
preferable that the system not hang.

> I know why ACPI needs it (API requirement) and I think the qla???-driver
> just needs to be fixed to work without it and nobody did it yet.

Since Christoph is the one who has his name on it:
/* XXX(hch): crude hack to emulate a down_timeout() */

I assumed that he'd spent enough time thinking about it that fixing it
really wasn't feasible.

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