diff options
-rw-r--r-- | sys/amd64/isa/ithread.c | 21 | ||||
-rw-r--r-- | sys/i386/isa/ithread.c | 21 |
2 files changed, 42 insertions, 0 deletions
diff --git a/sys/amd64/isa/ithread.c b/sys/amd64/isa/ithread.c index 2712353..9e6b41e 100644 --- a/sys/amd64/isa/ithread.c +++ b/sys/amd64/isa/ithread.c @@ -92,9 +92,12 @@ #endif u_long softintrcnt [NSWI]; +static u_int straycount[NHWI]; SYSINIT(start_softintr, SI_SUB_SOFTINTR, SI_ORDER_FIRST, start_softintr, NULL) +#define MAX_STRAY_LOG 5 + /* * Schedule a heavyweight interrupt process. This function is called * from the interrupt handlers Xintr<num>. @@ -115,6 +118,24 @@ sched_ithd(void *cookie) if (irq < NHWI) /* real interrupt, */ atomic_add_long(intr_countp[irq], 1); /* one more for this IRQ */ atomic_add_int(&cnt.v_intr, 1); /* one more global interrupt */ + + /* + * If we don't have an interrupt resource or an interrupt thread for + * this IRQ, log it as a stray interrupt. + */ + if (ir == NULL || ir->it_proc == NULL) { + if (irq < NHWI) { + if (straycount[irq] < MAX_STRAY_LOG) { + printf("stray irq %d\n", irq); + if (++straycount[irq] == MAX_STRAY_LOG) + printf("got %d stray irq %d's: " + "not logging anymore\n", + MAX_STRAY_LOG, irq); + } + return; + } + panic("sched_ithd: ithds[%d] == NULL", irq); + } CTR3(KTR_INTR, "sched_ithd pid %d(%s) need=%d", ir->it_proc->p_pid, ir->it_proc->p_comm, ir->it_need); diff --git a/sys/i386/isa/ithread.c b/sys/i386/isa/ithread.c index 2712353..9e6b41e 100644 --- a/sys/i386/isa/ithread.c +++ b/sys/i386/isa/ithread.c @@ -92,9 +92,12 @@ #endif u_long softintrcnt [NSWI]; +static u_int straycount[NHWI]; SYSINIT(start_softintr, SI_SUB_SOFTINTR, SI_ORDER_FIRST, start_softintr, NULL) +#define MAX_STRAY_LOG 5 + /* * Schedule a heavyweight interrupt process. This function is called * from the interrupt handlers Xintr<num>. @@ -115,6 +118,24 @@ sched_ithd(void *cookie) if (irq < NHWI) /* real interrupt, */ atomic_add_long(intr_countp[irq], 1); /* one more for this IRQ */ atomic_add_int(&cnt.v_intr, 1); /* one more global interrupt */ + + /* + * If we don't have an interrupt resource or an interrupt thread for + * this IRQ, log it as a stray interrupt. + */ + if (ir == NULL || ir->it_proc == NULL) { + if (irq < NHWI) { + if (straycount[irq] < MAX_STRAY_LOG) { + printf("stray irq %d\n", irq); + if (++straycount[irq] == MAX_STRAY_LOG) + printf("got %d stray irq %d's: " + "not logging anymore\n", + MAX_STRAY_LOG, irq); + } + return; + } + panic("sched_ithd: ithds[%d] == NULL", irq); + } CTR3(KTR_INTR, "sched_ithd pid %d(%s) need=%d", ir->it_proc->p_pid, ir->it_proc->p_comm, ir->it_need); |