lkml.org 
[lkml]   [2009]   [Aug]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Threaded interrupt handlers broken?
On Sun, 16 Aug 2009, Michael Buesch wrote:
> On Sunday 16 August 2009 12:14:36 Michael Buesch wrote:
> I need the following patch for threaded IRQs to work.
> The first hunk obviously is incorrect. But without it the thread_fn is
> never called.
>
> Index: wireless-testing/kernel/irq/manage.c
> ===================================================================
> --- wireless-testing.orig/kernel/irq/manage.c 2009-08-15 22:22:07.000000000 +0200
> +++ wireless-testing/kernel/irq/manage.c 2009-08-16 14:05:23.000000000 +0200
> @@ -504,7 +504,7 @@ static int irq_thread(void *data)
> atomic_inc(&desc->threads_active);
>
> spin_lock_irq(&desc->lock);
> - if (unlikely(desc->status & IRQ_DISABLED)) {
> + if (0&&unlikely(desc->status & IRQ_DISABLED)) {

So the interrupt is marked disabled. How do you setup the handler ?
And what does the primary handler do ? Can you post your driver code please?
> /*
> * CHECKME: We might need a dedicated
> * IRQ_THREAD_PENDING flag here, which
> @@ -520,7 +520,7 @@ static int irq_thread(void *data)
> action->thread_fn(action->irq, action->dev_id);
> }
>
> - wake = atomic_dec_and_test(&desc->threads_active);
> + wake = !atomic_dec_and_test(&desc->threads_active);

So you wake when the thread counter is != 0 after the decrement.

#define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0)

Thanks,

tglx


\
 
 \ /
  Last update: 2009-08-16 15:25    [W:0.069 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site