Re: interrupts and synchronization

Andi Kleen (ak@muc.de)
08 Mar 1999 20:59:38 +0100


olafm@seas.upenn.edu (Olaf Meyer) writes:

> Is there any way to use synchroniztion methods (e.g. semaphores) in
> interrupts? It seems to me that this is not possible, since you are not
> allowed to invoke the scheduler from interrupts.
>
> I have the following problem: In my protocol handler routine
> for a network device driver I have to check a condition variable.
> If this is not set properly, I have to wait until it changes
> before I proceed with the processing of the package.

IP uses a crude hack to solve a similar problem (socket locking when
user context may possibly sleep with socket locked). When the
socket is locked on an incomming packet the packet is put onto a backlog
queue in the socket, on release_sock() time the backlog queue is checked
and the protocol handler is recalled with a special backlog_rcv method.
This is done in a {start,end}_bh_atomic lock to not violate any netbh
atomicity assumptions.

It is not pretty, but it works.

-Andi

-- 
This is like TV. I don't like TV.

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