mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] genirq: spurious irq detection for threaded irqs
@ 2010-03-04 10:30 Uwe Kleine-König
  2010-03-04 22:26 ` Thomas Gleixner
  0 siblings, 1 reply; 6+ messages in thread
From: Uwe Kleine-König @ 2010-03-04 10:30 UTC (permalink / raw)
  To: linux-kernel; +Cc: Thomas Gleixner, Ingo Molnar

For threaded irqs the top half returns IRQ_WAKE_THREAD.  Don't treat
that value like IRQ_HANDLED for the spurious check.  Instead check the
return value of the threaded handler to be able to detect stuck irqs
that only have threaded handlers and no top half that can detect the
problem.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>
---
 include/linux/irq.h   |    2 ++
 kernel/irq/handle.c   |    6 ------
 kernel/irq/manage.c   |    7 ++++++-
 kernel/irq/spurious.c |   17 +++++++++++++++--
 4 files changed, 23 insertions(+), 9 deletions(-)

diff --git a/include/linux/irq.h b/include/linux/irq.h
index 451481c..f261765 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -323,6 +323,8 @@ static inline void generic_handle_irq(unsigned int irq)
 }
 
 /* Handling of unhandled and spurious interrupts: */
+extern void note_threaded_interrupt(unsigned int irq, struct irq_desc *desc,
+			   irqreturn_t action_ret);
 extern void note_interrupt(unsigned int irq, struct irq_desc *desc,
 			   irqreturn_t action_ret);
 
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c
index 814940e..3f63947 100644
--- a/kernel/irq/handle.c
+++ b/kernel/irq/handle.c
@@ -383,12 +383,6 @@ irqreturn_t handle_IRQ_event(unsigned int irq, struct irqaction *action)
 		switch (ret) {
 		case IRQ_WAKE_THREAD:
 			/*
-			 * Set result to handled so the spurious check
-			 * does not trigger.
-			 */
-			ret = IRQ_HANDLED;
-
-			/*
 			 * Catch drivers which return WAKE_THREAD but
 			 * did not set up a thread function
 			 */
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index eb6078c..81fdc45 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -557,12 +557,17 @@ static int irq_thread(void *data)
 			desc->status |= IRQ_PENDING;
 			raw_spin_unlock_irq(&desc->lock);
 		} else {
+			irqreturn_t action_ret;
+
 			raw_spin_unlock_irq(&desc->lock);
 
-			action->thread_fn(action->irq, action->dev_id);
+			action_ret = action->thread_fn(action->irq, action->dev_id);
 
 			if (oneshot)
 				irq_finalize_oneshot(action->irq, desc);
+
+			if (!noirqdebug)
+				note_threaded_interrupt(action->irq, desc, action_ret);
 		}
 
 		wake = atomic_dec_and_test(&desc->threads_active);
diff --git a/kernel/irq/spurious.c b/kernel/irq/spurious.c
index 89fb90a..56395fd 100644
--- a/kernel/irq/spurious.c
+++ b/kernel/irq/spurious.c
@@ -213,8 +213,8 @@ try_misrouted_irq(unsigned int irq, struct irq_desc *desc,
 	return action && (action->flags & IRQF_IRQPOLL);
 }
 
-void note_interrupt(unsigned int irq, struct irq_desc *desc,
-		    irqreturn_t action_ret)
+void note_threaded_interrupt(unsigned int irq, struct irq_desc *desc,
+		irqreturn_t action_ret)
 {
 	if (unlikely(action_ret != IRQ_HANDLED)) {
 		/*
@@ -262,6 +262,19 @@ void note_interrupt(unsigned int irq, struct irq_desc *desc,
 	desc->irqs_unhandled = 0;
 }
 
+void note_interrupt(unsigned int irq, struct irq_desc *desc,
+		irqreturn_t action_ret)
+{
+	if (action_ret == IRQ_WAKE_THREAD)
+		/* handled in irq_thread() when the threaded handler returns */
+		return;
+
+	/* don't report IRQ_WAKE_THREAD | IRQ_HANDLED as bogus return value */
+	action_ret &= ~IRQ_WAKE_THREAD;
+
+	note_threaded_interrupt(irq, desc, action_ret);
+}
+
 int noirqdebug __read_mostly;
 
 int noirqdebug_setup(char *str)
-- 
1.7.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-03-08  9:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-04 10:30 [PATCH] genirq: spurious irq detection for threaded irqs Uwe Kleine-König
2010-03-04 22:26 ` Thomas Gleixner
2010-03-05  7:58   ` Uwe Kleine-König
2010-03-05 15:18   ` [PATCH v2] " Uwe Kleine-König
2010-03-05 20:16     ` Thomas Gleixner
2010-03-08  9:01       ` Uwe Kleine-König

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®