From: Michael Buesch <mb@bu3sch.de>
To: linux-kernel@vger.kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>
Subject: Re: Threaded interrupt handlers broken?
Date: Sun, 16 Aug 2009 14:45:52 +0200 [thread overview]
Message-ID: <200908161445.53147.mb@bu3sch.de> (raw)
In-Reply-To: <200908161214.37008.mb@bu3sch.de>
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.
next prev parent reply other threads:[~2009-08-16 12:45 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-16 9:53 Threaded interrupt handlers broken? Michael Buesch
2009-08-16 10:14 ` Michael Buesch
2009-08-16 12:45 ` Michael Buesch [this message]
2009-08-16 13:22 ` Thomas Gleixner
2009-08-16 13:46 ` Michael Buesch
2009-08-16 14:25 ` Thomas Gleixner
2009-08-16 17:51 ` Michael Buesch
2009-08-16 20:05 ` Thomas Gleixner
2009-08-16 21:01 ` Michael Buesch
2009-08-16 21:28 ` Thomas Gleixner
2009-08-17 10:23 ` Michael Buesch
2009-08-17 10:56 ` Thomas Gleixner
2009-08-17 11:03 ` Thomas Gleixner
2009-08-17 11:12 ` Thomas Gleixner
2009-08-17 11:37 ` Michael Buesch
2009-08-17 12:14 ` Thomas Gleixner
2009-08-17 12:30 ` Michael Buesch
2009-09-04 18:55 ` Michael Buesch
2009-09-04 19:05 ` Michael Buesch
2009-09-04 19:35 ` Michael Buesch
2009-09-04 19:37 ` Sebastian Andrzej Siewior
2009-08-16 13:19 ` Thomas Gleixner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200908161445.53147.mb@bu3sch.de \
--to=mb@bu3sch.de \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox