[FOR DISCUSSION]: Improve behaviour of spurious IRQ detect

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Currently we handle spurious IRQ activity based upon seeing a lot of
invalid interrupts, and we clear things back on the base of lots of valid
interrupts.

Unfortunately in some cases you get legitimate invalid interrupts caused
by timing asynchronicity between the PCI bus and the APIC bus when
disabling interrupts and pulling other tricks. In this case although the
spurious IRQs are not a problem our unhandled counters didn't clear and
they act as a slow running timebomb. (This is effectively what the serial
port/tty problem that was fixed by clearing counters when registering a
handler showed up)

Its easy enough to add a second parameter - time. This means that if we
see a regular stream of harmless spurious interrupts which are not
harming processing we don't go off and do something stupid like disable
the IRQ after a month of running. OTOH lockups and performance killers
show up a lot more than 10/second

Signed-off-by: Alan Cox <[email protected]>

diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.22-rc4-mm2/kernel/irq/spurious.c linux-2.6.22-rc4-mm2/kernel/irq/spurious.c
--- linux.vanilla-2.6.22-rc4-mm2/kernel/irq/spurious.c	2007-06-07 14:26:01.000000000 +0100
+++ linux-2.6.22-rc4-mm2/kernel/irq/spurious.c	2007-06-07 14:38:22.000000000 +0100
@@ -172,7 +172,15 @@
 		    irqreturn_t action_ret)
 {
 	if (unlikely(action_ret != IRQ_HANDLED)) {
-		desc->irqs_unhandled++;
+		/* If we are seeing only the odd spurious IRQ caused by
+		   bus asynchronicity then don't eventually trigger an error,
+		   otherwise the couter becomes a doomsday timer for otherwise
+		   working systems */
+		if (jiffies - desc->last_unhandled > HZ/10)
+			desc->irqs_unhandled = 1;
+		else
+			desc->irqs_unhandled++;
+		desc->last_unhandled = jiffies;
 		if (unlikely(action_ret != IRQ_NONE))
 			report_bad_irq(irq, desc, action_ret);
 	}
--- linux.vanilla-2.6.22-rc4-mm2/include/linux/irq.h	2007-06-07 14:26:01.000000000 +0100
+++ linux-2.6.22-rc4-mm2/include/linux/irq.h	2007-06-07 14:38:07.000000000 +0100
@@ -161,6 +161,7 @@
 	unsigned int		wake_depth;	/* nested wake enables */
 	unsigned int		irq_count;	/* For detecting broken IRQs */
 	unsigned int		irqs_unhandled;
+	unsigned long		last_unhandled;	/* Aging timer for unhandled count */
 	spinlock_t		lock;
 #ifdef CONFIG_SMP
 	cpumask_t		affinity;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux