Re: down_trylock doesn't preserve irqstate

From: Rajagopal Ananthanarayanan (ananth@sgi.com)
Date: Fri Feb 25 2000 - 21:38:39 EST


Alan Cox wrote:

> A down_trylock() is quite legitimate so the code shouldnt corrupt the
> irq state for that one - I agree. That assumes down_trylock is irq safe
> [ie semops are irq safe] which is another matter altogether.

By semops I assume you mean up(), down(), down_interruptible() etc..
If so, they have to irq safe. My reasoning is as follows: up()
can be called by an interrupt routine; in my mind this seems
to be a fairly common capability of up, where the interrupt
signals a waiting thread that its "event" has arrived.
So, up() has to be irq safe.

down()/down_interruptible() don't matter for irq level,
since they can't/shouldn't be called with interrupts off,
or in an interrupt handler. They are interrupt safe,
however, since up() is interrupt safe, and so
that means the sleeping down's have to be interrupt safe
to work correctly. By "interrupt safe" I mean that the
code will work correctly in the presense of interrupts.

regards,

ananth.

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



This archive was generated by hypermail 2b29 : Tue Feb 29 2000 - 21:00:14 EST