more stack for boot
[minix.git] / kernel / watchdog.c
blobc10b4d6d4c9313318eaef52ec7e0a95f36d2181d
1 /*
2 * This is arch independent NMI watchdog implementaion part. It is used to
3 * detect kernel lockups and help debugging. each architecture must add its own
4 * low level code that triggers periodic checks
5 */
7 #include "watchdog.h"
9 unsigned watchdog_local_timer_ticks;
10 struct arch_watchdog *watchdog;
11 int watchdog_enabled;
13 void nmi_watchdog_handler(struct nmi_frame * frame)
15 /* FIXME this should be CPU local */
16 static unsigned no_ticks;
17 static unsigned last_tick_count = (unsigned) -1;
20 * when debugging on serial console, printing takes a lot of time some
21 * times while the kernel is certainly not locked up. We don't want to
22 * report a lockup in such situation
24 if (serial_debug_active)
25 goto reset_and_continue;
27 if (last_tick_count != watchdog_local_timer_ticks) {
28 if (no_ticks == 1) {
29 printf("watchdog : kernel unlocked\n");
30 no_ticks = 0;
32 /* we are still ticking, everything seems good */
33 last_tick_count = watchdog_local_timer_ticks;
34 goto reset_and_continue;
38 * if watchdog_local_timer_ticks didn't changed since last time, give it
39 * some more time and only if it still dead, trigger the watchdog alarm
41 if (++no_ticks < 10) {
42 if (no_ticks == 1)
43 printf("WARNING watchdog : possible kernel lockup\n");
44 goto reset_and_continue;
47 arch_watchdog_lockup(frame);
49 reset_and_continue:
50 if (watchdog->reinit)
51 watchdog->reinit(cpuid);