From 4b2310a7eeffe1e62c4249a805aa43156b3ee3ee Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Mon, 22 Mar 2010 13:55:51 +0000 Subject: [PATCH] only print 1 every 1000 spurious interrupts (per interrupt). --- kernel/interrupt.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/kernel/interrupt.c b/kernel/interrupt.c index 328a404fb..123a06fe7 100644 --- a/kernel/interrupt.c +++ b/kernel/interrupt.c @@ -13,6 +13,8 @@ * disable_irq: disable hook for IRQ. */ +#include + #include "kernel.h" #include "proc.h" #include "archconst.h" @@ -117,13 +119,18 @@ PUBLIC void irq_handle(int irq) irq_hook_t * hook; /* here we need not to get this IRQ until all the handlers had a say */ + assert(irq >= 0 && irq < NR_IRQ_VECTORS); hw_intr_mask(irq); hook = irq_handlers[irq]; - /* Sanity check. */ + /* Check for spurious interrupts. */ if(hook == NULL) { - printf("%s: irq_handle:no handler registered, masking the IRQ...\n", - __FILE__); + static int nspurious[NR_IRQ_VECTORS]; + nspurious[irq]++; + if(nspurious[irq] == 1 || !(nspurious[irq] % 1000)) { + printf("irq_handle: spurious irq %d (count: %d); keeping masked\n", + irq, nspurious[irq]); + } return; } -- 2.44.0