Re: down_interruptible and timers

Tim Waugh (tim@cyberelk.demon.co.uk)
Tue, 26 Jan 1999 09:41:38 +0000 (GMT)


On Tue, 26 Jan 1999, Andrea Arcangeli wrote:

> There' s a dirty way to workaround the sem-recursion in the parport case.
> You are using a single threaded down() and you can have an up() at any
> time and your only care is to not miss it. The dirty way knows how i386
> (and hopefully other) sempahores works in pre9.
> [...]
> again:
> sem->owner_depth = 0; /* invalidate myself */
> /* down just care to order instructions before start for real */
> down_interruptible(&sem);

Yes. This works.

> perfectly atomic). Probably it's possible to write a safe down (and
> recalling the current down() to down_recursive()) (that works on the same
> semaphore) with the _only_ difference that the new down() set
> owner_depth to 0 as opposed to down_recursive() that instead of increase
> it of 1 before start for real in the asm (lock; decl .count ...).

I'm not quite sure why the semaphores went recursive in the first place --
presumably to avoid some deadlock condition -- but either they should be
changed back, or something like you suggest should happen (IMHO). Even
down_nonrecursive would do.

Tim.
*/

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