lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri,  5 Mar 2010 16:18:11 +0100
From:	Uwe Kleine-König 
	<u.kleine-koenig@...gutronix.de>
To:	linux-kernel@...r.kernel.org
Cc:	Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...e.hu>
Subject: [PATCH v2] genirq: spurious irq detection for threaded irqs

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@...gutronix.de>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: Ingo Molnar <mingo@...e.hu>
---
Hello,

changed since v1:

 - use note_interrupt for the threaded handler's return value, getting rid of
   note_threaded_interrupt.  The only downside is that a threaded handler
   returning IRQ_WAKE_THREAD remains uncatched now.

Best regards
Uwe

 kernel/irq/handle.c   |    6 ------
 kernel/irq/manage.c   |    8 +++++++-
 kernel/irq/spurious.c |    7 +++++++
 3 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c
index 76d5a67..a466dc6 100644
--- a/kernel/irq/handle.c
+++ b/kernel/irq/handle.c
@@ -381,12 +381,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..9e1ff55 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -557,12 +557,18 @@ 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_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..fc5c6e6 100644
--- a/kernel/irq/spurious.c
+++ b/kernel/irq/spurious.c
@@ -216,6 +216,13 @@ try_misrouted_irq(unsigned int irq, struct irq_desc *desc,
 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;
+
 	if (unlikely(action_ret != IRQ_HANDLED)) {
 		/*
 		 * If we are seeing only the odd spurious IRQ caused by
-- 
1.7.0

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

Powered by Openwall GNU/*/Linux Powered by OpenVZ