sleep_on, wake_up question

Mark Mokryn (mark@psl.technion.ac.il)
Thu, 30 Dec 1999 16:53:52 +0200 (IST)


I'm working on a module, in which my ioctl function fuction needs to
block, waiting for the hardware to do its work (in an ISR/bottom half).
Code looks like:
my_ioctl()
{
...
// prepare work for adapter, and interrupt it
interruptible_sleep_on(&wq);
...
}

adapter_isr()
{
// do some work
wake_up_interruptible(&wq);
...
}

It's possible that the PC will be interrupted (by anything) just prior to
the sleep_on call in my_ioctl, and eventually, the adapter may even
complete its work (and call wake_up) before the sleep_on function was even
reached. In a heavily loaded system, this possibility is more than
theoretical. In this case, it appears that the calling process may forever
hang in sleep_on. Help? Am I missing something here? Perhaps there should
be a signalling mechanism in wake_up, so that if necessary, sleep_on may
complete immediately? No such mechanism on kernel sources I browsed
(2.2.12).

Thanks,
-Mark

Mark Mokryn
mark@psl.technion.ac.il
Tel: 972-2-5702983

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