Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/kern_clock.c
Show First 20 Lines • Show All 68 Lines • ▼ Show 20 Lines | |||||
#include <vm/pmap.h> | #include <vm/pmap.h> | ||||
#include <vm/vm_map.h> | #include <vm/vm_map.h> | ||||
#include <sys/sysctl.h> | #include <sys/sysctl.h> | ||||
#include <sys/bus.h> | #include <sys/bus.h> | ||||
#include <sys/interrupt.h> | #include <sys/interrupt.h> | ||||
#include <sys/limits.h> | #include <sys/limits.h> | ||||
#include <sys/timetc.h> | #include <sys/timetc.h> | ||||
#include <machine/intr.h> | |||||
#ifdef GPROF | #ifdef GPROF | ||||
#include <sys/gmon.h> | #include <sys/gmon.h> | ||||
#endif | #endif | ||||
#ifdef HWPMC_HOOKS | #ifdef HWPMC_HOOKS | ||||
#include <sys/pmckern.h> | #include <sys/pmckern.h> | ||||
PMC_SOFT_DEFINE( , , clock, hard); | PMC_SOFT_DEFINE( , , clock, hard); | ||||
PMC_SOFT_DEFINE( , , clock, stat); | PMC_SOFT_DEFINE( , , clock, stat); | ||||
▲ Show 20 Lines • Show All 745 Lines • ▼ Show 20 Lines | |||||
/* | /* | ||||
* Handle a watchdog timeout by dumping interrupt information and | * Handle a watchdog timeout by dumping interrupt information and | ||||
* then either dropping to DDB or panicking. | * then either dropping to DDB or panicking. | ||||
*/ | */ | ||||
static void | static void | ||||
watchdog_fire(void) | watchdog_fire(void) | ||||
{ | { | ||||
int nintr; | uint64_t inttotal = 0; | ||||
uint64_t inttotal; | u_int curintr; | ||||
u_long *curintr; | const struct intr_event *ie; | ||||
char *curname; | |||||
curintr = intrcnt; | |||||
curname = intrnames; | |||||
inttotal = 0; | |||||
nintr = sintrcnt / sizeof(u_long); | |||||
printf("interrupt total\n"); | printf("interrupt total\n"); | ||||
while (--nintr >= 0) { | INTR_FOREACH(curintr) { | ||||
if (*curintr) | ie = intr2event(intr_lookup(curintr)); | ||||
printf("%-12s %20lu\n", curname, *curintr); | printf("%-12s %20lu\n", ie->ie_fullname, ie->ie_intrcnt); | ||||
curname += strlen(curname) + 1; | inttotal += ie->ie_intrcnt; | ||||
ehem_freebsd_m5p.com: `curname = intrnames;` to initialize, then `curname += strlen(curname) + 1;` to increment each… | |||||
inttotal += *curintr++; | |||||
} | } | ||||
printf("Total %20ju\n", (uintmax_t)inttotal); | printf("Total %20ju\n", (uintmax_t)inttotal); | ||||
Done Inline ActionsThis is the last remaining concern. INTR_FOREACH() was created in D36609, but I'm unsure of the idea. Issue is there isn't good global access to this data. If this isn't very high value, I would be tempted to not publish this data in this situation. Otherwise a function could be added to sys/kern/kern_intr.c to report this (suggestions for function name? declare in which header?). ehem_freebsd_m5p.com: This is the last remaining concern. INTR_FOREACH() was created in D36609, but I'm unsure of… | |||||
Done Inline ActionsGiven how this hasn't been working correctly for a long time, potentially producing garbled output. I'm wondering whether this output is actually worthwhile at all. ehem_freebsd_m5p.com: Given how this hasn't been working correctly for a //long// time, potentially producing garbled… | |||||
#if defined(KDB) && !defined(KDB_UNATTENDED) | #if defined(KDB) && !defined(KDB_UNATTENDED) | ||||
kdb_backtrace(); | kdb_backtrace(); | ||||
kdb_enter(KDB_WHY_WATCHDOG, "watchdog timeout"); | kdb_enter(KDB_WHY_WATCHDOG, "watchdog timeout"); | ||||
#else | #else | ||||
panic("watchdog timeout"); | panic("watchdog timeout"); | ||||
#endif | #endif | ||||
} | } |
curname = intrnames; to initialize, then curname += strlen(curname) + 1; to increment each time through the loop. This is clearly interpreting "intrnames" as a packed series of strings separated by null-terminators.