Add some debugging code to log intrstat history so I can track down stray

interrupts.
This commit is contained in:
mycroft 2003-10-01 00:07:48 +00:00
parent 3e10887300
commit 5f4d907d3f

View File

@ -1,4 +1,4 @@
/* $NetBSD: isr.c,v 1.18 2003/07/15 02:59:33 lukem Exp $ */
/* $NetBSD: isr.c,v 1.19 2003/10/01 00:07:48 mycroft Exp $ */
/*
* This file was taken from mvme68k/mvme68k/isr.c
@ -48,7 +48,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.18 2003/07/15 02:59:33 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.19 2003/10/01 00:07:48 mycroft Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -275,6 +275,14 @@ isrdispatch_autovec(frame)
int handled, ipl;
void *arg;
static int straycount, unexpected;
#ifdef INTRLOG
static int logptr = 0;
static struct {
int ipl;
u_long intrstat, intrmask;
int handled;
} log[256];
#endif
ipl = (frame->vec >> 2) - ISRAUTOVEC;
@ -286,6 +294,11 @@ isrdispatch_autovec(frame)
intrcnt[ipl]++; /* XXXSCW: Will go away soon */
next68k_irq_evcnt[ipl].ev_count++;
uvmexp.intrs++;
#ifdef INTRLOG
log[logptr].ipl = ipl;
log[logptr].intrstat = *intrstat;
log[logptr].intrmask = *intrmask;
#endif
list = &isr_autovec[ipl];
if (list->lh_first == NULL) {
@ -306,6 +319,21 @@ isrdispatch_autovec(frame)
}
}
#ifdef INTRLOG
log[logptr].handled = handled;
logptr = (logptr + 1) & 255;
if (!handled && ++straycount >= 10) {
int n, m;
printf("%d stray interrupts, level %d\n", straycount, ipl);
for (n = 20; n; n--) {
m = (logptr - n) & 255;
printf("%02d: %d %08lx %08lx %d\n", n, log[m].ipl,
log[m].intrstat, log[m].intrmask, log[m].handled);
}
Debugger();
straycount = 0;
}
#else
if (handled)
straycount = 0;
else if (++straycount > 50)
@ -323,6 +351,7 @@ isrdispatch_autovec(frame)
NEXT_INTR_BITS, sbuf, sizeof(sbuf));
printf(" *intrmask = 0x%s\n", sbuf);
}
#endif
}
/*