lkml.org 
[lkml]   [2000]   [Sep]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectInterrupt/Sleep deadlock

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/

\
 
 \ /
  Last update: 2005-03-22 12:38    [W:0.107 / U:11.436 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site