[lkml]   [2001]   [Sep]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectSynchronization Techniques in 2.2 Kernel
I am working on a custom driver for a project at work.  We are working with
Debian 2.2, the code is compiled as a module. At this time I am not able to
switch our project to the 2.4.x kernels so I require a solution using 2.2.x.

The driver has the capability to control many cards at once. It is written
such that when the read system call is invoked data available on any card is
returned, so we don't use a separate file descriptor for each card.

I believe I have a "race condition" in the drivers read method when blocking
I/O is used and there is no data in the DMA buffers. Here is some very basic
pseudo code for the driver's read method:

start_card = x;

return data;

x = next_card(x);

if(start_card == x)
/* none of the cards has any data, sleep
* on a wait queue */

After the device performs the DMA it will wake the driver via the interrupt
handler. The problem is how to handle the situation where the driver checks a
card for data, no data is available and it moves on to the next card. While
checking the rest of the cards data may arrive on the 1st card, the interrupt
handler will fire and complete before the driver goes to sleep on the wait

If I understand wait_queues correctly the process has to be sleeping before a
wake_up call will have any effect (I.E. they are not queued). Can this be
worked around with semaphores or some other method? I am open to ideas here.

Any and all help is appreciated.


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:03    [W:0.049 / U:0.340 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site