minix/kernel
Tomas Hruby 5efa92f754 NMI watchdog is an awesome feature for debugging locked up kernels.
There is not that much use for it on a single CPU, however, deadlock
between kernel and system task can be delected. Or a runaway loop.

If a kernel gets locked up the timer interrupts don't occure (as all
interrupts are disabled in kernel mode). The only chance is to
interrupt the kernel by a non-maskable interrupt.

This patch generates NMIs using performance counters. It uses the most
widely available performace counters. As the performance counters are 
highly model-specific this patch is not guaranteed to work on every
machine.  Unfortunately this is also true for KVM :-/ On the other
hand adding this feature for other models is not extremely difficult
and the framework makes it hopefully easy enough.

Depending on the frequency of the CPU an NMI is generated at most
about every 0.5s If the cpu's speed is less then 2Ghz it is generated
at most every 1s. In general an NMI is generated much less often as
the performance counter counts down only if the cpu is not idle.
Therefore the overhead of this feature is fairly minimal even if the
load is high.

Uppon detecting that the kernel is locked up the kernel dumps the 
state of the kernel registers and panics.

Local APIC must be enabled for the watchdog to work.

The code is _always_ compiled in, however, it is only enabled if  
watchdog=<non-zero> is set in the boot monitor.

One corner case is serial console debugging. As dumping a lot of stuff
to the serial link may take a lot of time, the watchdog does not 
detect lockups during this time!!! as it would result in too many
false positives. 10 nmi have to be handled before the lockup is
detected. This means something between ~5s to 10s.

Another corner case is that the watchdog is enabled only after the
paging is enabled as it would be pure madness to try to get it right.
2010-01-16 20:53:55 +00:00
..
arch/i386 NMI watchdog is an awesome feature for debugging locked up kernels. 2010-01-16 20:53:55 +00:00
system Merge of Wu's GSOC 09 branch (src.20090525.r4372.wu) 2010-01-14 15:24:16 +00:00
clock.c NMI watchdog is an awesome feature for debugging locked up kernels. 2010-01-16 20:53:55 +00:00
clock.h Clock task split 2009-11-06 09:04:15 +00:00
config.h General cleanup: 2010-01-05 19:39:27 +00:00
const.h Initialization protocol for system services. 2010-01-08 01:20:42 +00:00
debug.c All macros defining rts flags are prefixed with RTS_ 2009-11-10 09:11:13 +00:00
debug.h Killing Minix by typing Q on serial console 2010-01-14 09:46:16 +00:00
glo.h NMI watchdog is an awesome feature for debugging locked up kernels. 2010-01-16 20:53:55 +00:00
interrupt.c Add 'getidle' CPU utilization measurement infrastructure 2009-12-02 11:52:26 +00:00
ipc.h All macros defining rts flags are prefixed with RTS_ 2009-11-10 09:11:13 +00:00
kernel.h NMI watchdog is an awesome feature for debugging locked up kernels. 2010-01-16 20:53:55 +00:00
main.c Merge of Wu's GSOC 09 branch (src.20090525.r4372.wu) 2010-01-14 15:24:16 +00:00
Makefile NMI watchdog is an awesome feature for debugging locked up kernels. 2010-01-16 20:53:55 +00:00
priv.h Initialization protocol for system services. 2010-01-08 01:20:42 +00:00
proc.c Remove obsolete m_ptr calculations in try_one() and mini_senda(). 2010-01-14 12:04:24 +00:00
proc.h Merge of Wu's GSOC 09 branch (src.20090525.r4372.wu) 2010-01-14 15:24:16 +00:00
profile.c pick_proc() called only just before returning to userspace 2009-11-09 17:48:31 +00:00
profile.h cprofile not conditional 2009-01-09 21:44:52 +00:00
proto.h Merge of Wu's GSOC 09 branch (src.20090525.r4372.wu) 2010-01-14 15:24:16 +00:00
start.c NMI watchdog is an awesome feature for debugging locked up kernels. 2010-01-16 20:53:55 +00:00
system.c Merge of Wu's GSOC 09 branch (src.20090525.r4372.wu) 2010-01-14 15:24:16 +00:00
system.h Merge of Wu's GSOC 09 branch (src.20090525.r4372.wu) 2010-01-14 15:24:16 +00:00
table.c - Introduce support for sticky bit. 2009-12-20 20:27:14 +00:00
type.h Rewrite of boot process 2009-12-11 00:08:19 +00:00
utility.c Add 'getidle' CPU utilization measurement infrastructure 2009-12-02 11:52:26 +00:00
vm.h Fixed a typing bug. 2010-01-06 08:23:14 +00:00
watchdog.c NMI watchdog is an awesome feature for debugging locked up kernels. 2010-01-16 20:53:55 +00:00
watchdog.h NMI watchdog is an awesome feature for debugging locked up kernels. 2010-01-16 20:53:55 +00:00