[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200908161445.53147.mb@bu3sch.de>
Date: Sun, 16 Aug 2009 14:45:52 +0200
From: Michael Buesch <mb@...sch.de>
To: linux-kernel@...r.kernel.org
Cc: Thomas Gleixner <tglx@...utronix.de>
Subject: Re: Threaded interrupt handlers broken?
On Sunday 16 August 2009 12:14:36 Michael Buesch wrote:
> > 506 spin_lock_irq(&desc->lock);
> > 507 if (unlikely(desc->status & IRQ_DISABLED)) {
> > 508 /*
> > 509 * CHECKME: We might need a dedicated
> > 510 * IRQ_THREAD_PENDING flag here, which
> > 511 * retriggers the thread in check_irq_resend()
> > 512 * but AFAICT IRQ_PENDING should be fine as it
> > 513 * retriggers the interrupt itself --- tglx
> > 514 */
> > 515 desc->status |= IRQ_PENDING;
> > 516 spin_unlock_irq(&desc->lock);
> > 517 } else {
> > 518 spin_unlock_irq(&desc->lock);
> > 519
> > 520 action->thread_fn(action->irq, action->dev_id);
> > 521 }
> > 522
> > 523 wake = atomic_dec_and_test(&desc->threads_active);
>
> Is this test logic inverted? atomic_dec_and_test() means
> (threads_active - 1) == 0
> Shouldn't it be like this?
> (threads_active - 1) != 0
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)) {
/*
* 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);
if (wake && waitqueue_active(&desc->wait_for_threads))
wake_up(&desc->wait_for_threads);
--
Greetings, Michael.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists