public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC] Debug handling of early spurious interrupts
@ 2007-07-17 10:09 Fernando Luis Vázquez Cao
  2007-07-18 22:46 ` Andrew Morton
  0 siblings, 1 reply; 13+ messages in thread
From: Fernando Luis Vázquez Cao @ 2007-07-17 10:09 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, kexec

With the advent of kdump it is possible that device drivers receive
interrupts generated in the context of a previous kernel. Ideally
quiescing the underlying devices should suffice but not all drivers
do this, either because it is not possible or because they did not
contemplate this case. Thus drivers ought to be able to handle
interrupts coming in as soon as the interrupt handler is registered.

Signed-off-by: Fernando Luis Vazquez Cao <fernando@oss.ntt.co.jp>
---

diff -urNp linux-2.6.22-orig/kernel/irq/manage.c linux-2.6.22/kernel/irq/manage.c
--- linux-2.6.22-orig/kernel/irq/manage.c	2007-07-09 08:32:17.000000000 +0900
+++ linux-2.6.22/kernel/irq/manage.c	2007-07-17 18:37:24.000000000 +0900
@@ -537,6 +537,29 @@ int request_irq(unsigned int irq, irq_ha
 
 	select_smp_affinity(irq);
 
+#if defined(CONFIG_DEBUG_PENDING_IRQ) || defined(CONFIG_DEBUG_SHIRQ)
+#ifndef CONFIG_DEBUG_PENDING_IRQ
+	if (irqflags & IRQF_SHARED) {
+		/*
+		 * It's a shared IRQ -- the driver ought to be prepared for it
+		 * to happen immediately, so let's make sure....
+		 * We do this before actually registering it, to make sure that
+		 * a 'real' IRQ doesn't run in parallel with our fake.
+		 */
+#endif /* !CONFIG_DEBUG_PENDING_IRQ */
+		if (irqflags & IRQF_DISABLED) {
+			unsigned long flags;
+
+			local_irq_save(flags);
+			handler(irq, dev_id);
+			local_irq_restore(flags);
+		} else
+			handler(irq, dev_id);
+#ifndef CONFIG_DEBUG_PENDING_IRQ
+	}
+#endif /* !CONFIG_DEBUG_PENDING_IRQ */
+#endif /* CONFIG_DEBUG_PENDING_IRQ || CONFIG_DEBUG_SHIRQ */
+
 #ifdef CONFIG_DEBUG_SHIRQ
 	if (irqflags & IRQF_SHARED) {
 		/*
diff -urNp linux-2.6.22-orig/lib/Kconfig.debug linux-2.6.22/lib/Kconfig.debug
--- linux-2.6.22-orig/lib/Kconfig.debug	2007-07-09 08:32:17.000000000 +0900
+++ linux-2.6.22/lib/Kconfig.debug	2007-07-17 18:52:00.000000000 +0900
@@ -77,6 +77,17 @@ config DEBUG_KERNEL
 	  Say Y here if you are developing drivers or trying to debug and
 	  identify kernel problems.
 
+config DEBUG_PENDING_IRQ
+	bool "Debug handling of early spurious interrupts"
+	depends on DEBUG_KERNEL && GENERIC_HARDIRQS
+	help
+	  With the advent of kdump it is possible that device drivers receive
+	  interrupts generated in the context of a previous kernel. Ideally
+	  quiescing the underlying devices should suffice but not all drivers
+	  do this, either because it is not possible or because they did not
+	  contemplate this case. Thus drivers ought to be able to handle
+	  interrupts coming in as soon as the interrupt handler is registered.
+
 config DEBUG_SHIRQ
 	bool "Debug shared IRQ handlers"
 	depends on DEBUG_KERNEL && GENERIC_HARDIRQS



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

end of thread, other threads:[~2007-07-31  4:47 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-17 10:09 [PATCH RFC] Debug handling of early spurious interrupts Fernando Luis Vázquez Cao
2007-07-18 22:46 ` Andrew Morton
2007-07-20  1:54   ` Fernando Luis Vázquez Cao
2007-07-20  2:02     ` [PATCH 1/2] Remove Kconfig setting CONFIG_DEBUG_SHIRQ Fernando Luis Vázquez Cao
2007-07-20  2:20       ` [PATCH 2/2] Debug handling of early spurious interrupts Fernando Luis Vázquez Cao
2007-07-20 21:43         ` Andrew Morton
2007-07-30  9:58           ` Fernando Luis Vázquez Cao
2007-07-30 18:22             ` Andrew Morton
2007-07-31  2:25               ` Fernando Luis Vázquez Cao
2007-07-31  4:46                 ` Andrew Morton
2007-07-25  9:18         ` [PATCH RFC] e1000: clear ICR before requesting an IRQ line Fernando Luis Vázquez Cao
2007-07-25 15:27           ` Kok, Auke
2007-07-26  1:34             ` Fernando Luis Vázquez Cao

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