lkml.org 
[lkml]   [1999]   [Jan]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: down_interruptible and timers
On Mon, 25 Jan 1999, Andrea Arcangeli wrote:

> Here the fix for your latest code (that I merged last night).

Thanks.

> Please Tim tell me if you can reproduce the weirness also with this patch
> applyed.

I can still reproduce it.

The reason it happens is that semaphores are now recursive. Here is the
loop:

request_irq (..., func_that_ups_semaphore);

tell_hardware_to_generate_irq_when_ready ();

false_alarm:

set_a_1s_timer;

down_interruptible (semaphore);

if (!hardware_ready ())
goto false_alarm;

As soon as a false alarm occurs, we already own the semaphore, and so we
spin forever. Before semaphores went recursive, this wasn't the case.

I'm using semaphores rather than (say) waitqueues because I don't want to
lose any interrupts through things like this:

void irq_handler (...)
{
if (!waitqueue_active(...))
/* Missed an interrupt. */
return;

wake_up (...);
}

If there's another atomic primitive I should be using, please let me know,
but I kind of thought that this is what semaphores were for.

By the way, there really should be a "if (need_resched) schedule();" in
that loop, so that a confused parallel port that keeps sending interrupts
for no reason doesn't bring the system to a halt. But that's another
story.

Tim.
*/


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

\
 
 \ /
  Last update: 2005-03-22 13:50    [from the cache]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and my Meterkast|Read the blog