summaryrefslogtreecommitdiff
path: root/sys/kern/files.kern
diff options
context:
space:
mode:
authorriastradh <riastradh@NetBSD.org>2023-07-07 12:34:49 +0000
committerriastradh <riastradh@NetBSD.org>2023-07-07 12:34:49 +0000
commitde09df2fbee768e9082e19034d75860393b1d8c7 (patch)
treea400ee5f81acf1799478f682b860d75aeb65baa3 /sys/kern/files.kern
parent54c2f318891feaaffe6b1d657fbfc309137b174e (diff)
heartbeat(9): New mechanism to check progress of kernel.
This uses hard interrupts to check progress of low-priority soft interrupts, and one CPU to check progress of another CPU. If no progress has been made after a configurable number of seconds (kern.heartbeat.max_period, default 15), then the system panics -- preferably on the CPU that is stuck so we get a stack trace in dmesg of where it was stuck, but if the stuckness was detected by another CPU and the stuck CPU doesn't acknowledge the request to panic within one second, the detecting CPU panics instead. This doesn't supplant hardware watchdog timers. It is possible for hard interrupts to be stuck on all CPUs for some reason too; in that case heartbeat(9) has no opportunity to complete. Downside: heartbeat(9) relies on hardclock to run at a reasonably consistent rate, which might cause trouble for the glorious tickless future. However, it could be adapted to take a parameter for an approximate number of units that have elapsed since the last call on the current CPU, rather than treating that as a constant 1. XXX kernel revbump -- changes struct cpu_info layout
Diffstat (limited to 'sys/kern/files.kern')
-rw-r--r--sys/kern/files.kern5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/kern/files.kern b/sys/kern/files.kern
index 03eb05ec258..3ebde63dfac 100644
--- a/sys/kern/files.kern
+++ b/sys/kern/files.kern
@@ -1,13 +1,15 @@
-# $NetBSD: files.kern,v 1.57 2021/09/19 15:51:27 thorpej Exp $
+# $NetBSD: files.kern,v 1.58 2023/07/07 12:34:50 riastradh Exp $
#
# kernel sources
#
define kern: cprng_fast, machdep, uvm
+defflag opt_heartbeat.h HEARTBEAT
defflag opt_kern.h KERN
defflag opt_script.h SETUIDSCRIPTS FDSCRIPTS
defflag KASLR
defparam opt_cnmagic.h CNMAGIC
+defparam heartbeat.h HEARTBEAT_MAX_PERIOD_DEFAULT
file conf/debugsyms.c kern
file conf/param.c kern
@@ -48,6 +50,7 @@ file kern/kern_exec.c kern
file kern/kern_exit.c kern
file kern/kern_fork.c kern
file kern/kern_idle.c kern
+file kern/kern_heartbeat.c kern & heartbeat
file kern/kern_hook.c kern
file kern/kern_kthread.c kern
file kern/kern_ktrace.c ktrace