Interrupt/Sleep deadlock

From: Ivan Passos (lists@cyclades.com)
Date: Thu Sep 28 2000 - 20:26:17 EST


Hello,

In order to get the configuration of a board, I have to send, from
userspace, an ioctl to the driver and wait for the board to complete its
action. The way this is implemented is as follows:
- In the ioctl, the driver sends a command to the board and then goes to
  sleep (interruptible_sleep_on(&info->config_wait));
- The board receives the command, handles it and answers back with an
  interrupt;
- The driver's interrupt handler schedules a bottom-half action.
- The bottom-half calls wake_up_interuptible(&info->config_wait).
- The ioctl returns and the userspace application has the board
  configuration.

Now, the problem: the board is so fast that it interrupts back _before_
the driver goes to sleep, i.e.:
- Driver sends command to board;
- Driver goes to sl... interrupt back from board!!
- Interrupt handler schedules bottom-half.
- Bottom-half calls wake_up.
- Ioctl continues, and _then_ goes to sleep. System locked.

I can't disable interrupts before going to sleep, because the event that
wakes me up is an interrupt. However, if I don't protect it from the
interrupts, the system locks ...

Is there any other way in Linux to implement this?!?!?!

Thanks in advance for any help.

Later,
Ivan

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Sep 30 2000 - 21:00:23 EST