summaryrefslogtreecommitdiffstats
path: root/sys/i386/isa/ithread.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2000-09-15 00:27:57 +0000
committerjhb <jhb@FreeBSD.org>2000-09-15 00:27:57 +0000
commit43d09251f253dc8bb4b40dd88a969733cf98715b (patch)
tree67217bafe7c7dab8959242b520e92ac8a33b00ab /sys/i386/isa/ithread.c
parent9a638b9d568eed5d66f28bd4873fd23fb10ec271 (diff)
downloadFreeBSD-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
Diffstat (limited to 'sys/i386/isa/ithread.c')
-rw-r--r--sys/i386/isa/ithread.c21
1 files changed, 21 insertions, 0 deletions
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);
OpenPOWER on IntegriCloud