Re: 2.2.1 lockup (SCSI related)

Tim Waugh (tim@cyberelk.demon.co.uk)
Fri, 5 Feb 1999 14:37:49 +0000 (GMT)


On 5 Feb 1999, Matthias Urlichs wrote:

> What's the problem with allowing recursive semaphores? It doesn't break
> anything which wasn't broken before. The only difference is that now your
> code can continue while before it would deadlock.

NO. scsi_error broke, when it was not broken before. Some of my code
which I'm maintaining outside of 2.2 broke when it was not broken before.

The kind of thing it breaks is this:

void irq_handler (...)
{
up (&irq_sem);
}

void do_work (...)
{
/* ... */

/* Wait for interrupt to tell us device is ready. */
for (;;) {
down (&irq_sem);
if (device_ready()) break;
}

/* ... */
}

'Recursive semaphores' are not semaphores in my opinion. They are a
completely broken idea. If they are supposed to be mutexes, fine, call
them mutexes and replace the now-missing semaphore functionality. (Andrea
Arcangeli has done some work on this.)

Are Grant, Andrea and I the only people who think that the above code
should work?

I find it nothing less than embarrassing that Linux semaphores work the
way they do now.

*/

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