diff options
author | jhb <jhb@FreeBSD.org> | 2000-09-15 00:27:57 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2000-09-15 00:27:57 +0000 |
commit | 43d09251f253dc8bb4b40dd88a969733cf98715b (patch) | |
tree | 67217bafe7c7dab8959242b520e92ac8a33b00ab | |
parent | 9a638b9d568eed5d66f28bd4873fd23fb10ec271 (diff) | |
download | FreeBSD-src-43d09251f253dc8bb4b40dd88a969733cf98715b.zip FreeBSD-src-43d09251f253dc8bb4b40dd88a969733cf98715b.tar.gz |
Check to see if we actually have an interrupt descriptor and an interrupt
thread for each interrupt that comes in. If we don't, log the event and
return immediately for a hardware interrupt. For a softinterrupt, panic
instead.
Submitted by: ben
-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); |