Sleep inside close function

Linux Lists (
Thu, 26 Feb 1998 10:08:17 -0800

Hi there,

To prevent data loss when a close happens to the driver, it sleeps
until it receives an ack from the board saying that its _internal_
(non-kernel) buffers (such as FIFOs and on-board memory buffers) are
empty. I am using the functions interruptible_sleep_on and
wake_up_interruptible to do this job.

For one of the boards, which has a 12-byte FIFO per port only, this
is working just fine. For the other, which has a 64-byte wide FIFO
plus 8K/2K reception/transmission buffers per port (those are _really_
large buffers !!), as soon as I close the port, I receive the
following message from the kernel:

Kernel panic: task[0] trying to sleep
In swapper task - not syncing

Some issues:

- The first board (which works fine) uses interrupts, while the second
works in polling mode (no interrupts, just polling cycles). In both
cases, the wake_up_interruptible is called from inside the
"interrupt" handler (interrupt handler for the first board, polling
routine for the second board). Is this a problem ??
- The sleep is called from inside the driver's close routine. Is this
a problem ?? Are there any constraints regarding where I could put
a sleep in there (before or after some action) ?? I'm asking that
because the kernel panic msg is complaining about a kinda "intrusive"
sleep ...

I hope you guys can help me on that. If you could _at least_ point
me to some place where I can find documentation about the kernel
functions, I would appreciate it.

Thanks in advance.


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to