| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: kern_heartbeat.c,v 1.11 2024/02/28 04:12:59 riastradh Exp $ */ | | 1 | /* $NetBSD: kern_heartbeat.c,v 1.12 2024/02/28 04:14:47 riastradh Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2023 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2023 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -72,27 +72,27 @@ | | | @@ -72,27 +72,27 @@ |
72 | * sysctl -w debug.crashme.spl_spinout=5 # IPL_VM | | 72 | * sysctl -w debug.crashme.spl_spinout=5 # IPL_VM |
73 | * # verify system panics after 15sec, with a stack trace through | | 73 | * # verify system panics after 15sec, with a stack trace through |
74 | * # crashme_spl_spinout | | 74 | * # crashme_spl_spinout |
75 | * | | 75 | * |
76 | * # Not this -- IPL_SCHED and IPL_HIGH spinout on a single CPU | | 76 | * # Not this -- IPL_SCHED and IPL_HIGH spinout on a single CPU |
77 | * # require a hardware watchdog timer. | | 77 | * # require a hardware watchdog timer. |
78 | * #cpuctl offline 0 | | 78 | * #cpuctl offline 0 |
79 | * #sysctl -w debug.crashme_enable | | 79 | * #sysctl -w debug.crashme_enable |
80 | * #sysctl -w debug.crashme.spl_spinout=6 # IPL_SCHED | | 80 | * #sysctl -w debug.crashme.spl_spinout=6 # IPL_SCHED |
81 | * # hope watchdog timer kicks in | | 81 | * # hope watchdog timer kicks in |
82 | */ | | 82 | */ |
83 | | | 83 | |
84 | #include <sys/cdefs.h> | | 84 | #include <sys/cdefs.h> |
85 | __KERNEL_RCSID(0, "$NetBSD: kern_heartbeat.c,v 1.11 2024/02/28 04:12:59 riastradh Exp $"); | | 85 | __KERNEL_RCSID(0, "$NetBSD: kern_heartbeat.c,v 1.12 2024/02/28 04:14:47 riastradh Exp $"); |
86 | | | 86 | |
87 | #ifdef _KERNEL_OPT | | 87 | #ifdef _KERNEL_OPT |
88 | #include "opt_ddb.h" | | 88 | #include "opt_ddb.h" |
89 | #include "opt_heartbeat.h" | | 89 | #include "opt_heartbeat.h" |
90 | #endif | | 90 | #endif |
91 | | | 91 | |
92 | #include "heartbeat.h" | | 92 | #include "heartbeat.h" |
93 | | | 93 | |
94 | #include <sys/param.h> | | 94 | #include <sys/param.h> |
95 | #include <sys/types.h> | | 95 | #include <sys/types.h> |
96 | | | 96 | |
97 | #include <sys/atomic.h> | | 97 | #include <sys/atomic.h> |
98 | #include <sys/cpu.h> | | 98 | #include <sys/cpu.h> |
| @@ -122,28 +122,28 @@ __KERNEL_RCSID(0, "$NetBSD: kern_heartbe | | | @@ -122,28 +122,28 @@ __KERNEL_RCSID(0, "$NetBSD: kern_heartbe |
122 | kmutex_t heartbeat_lock __cacheline_aligned; | | 122 | kmutex_t heartbeat_lock __cacheline_aligned; |
123 | unsigned heartbeat_max_period_secs __read_mostly; | | 123 | unsigned heartbeat_max_period_secs __read_mostly; |
124 | unsigned heartbeat_max_period_ticks __read_mostly; | | 124 | unsigned heartbeat_max_period_ticks __read_mostly; |
125 | | | 125 | |
126 | void *heartbeat_sih __read_mostly; | | 126 | void *heartbeat_sih __read_mostly; |
127 | | | 127 | |
128 | /* | | 128 | /* |
129 | * heartbeat_suspend() | | 129 | * heartbeat_suspend() |
130 | * | | 130 | * |
131 | * Suspend heartbeat monitoring of the current CPU. | | 131 | * Suspend heartbeat monitoring of the current CPU. |
132 | * | | 132 | * |
133 | * Called after the current CPU has been marked offline but before | | 133 | * Called after the current CPU has been marked offline but before |
134 | * it has stopped running, or after IPL has been raised for | | 134 | * it has stopped running, or after IPL has been raised for |
135 | * polling-mode console input. Nestable. Reversed by | | 135 | * polling-mode console input. Nestable (but only 2^32 times, so |
136 | * heartbeat_resume. | | 136 | * don't do this in a loop). Reversed by heartbeat_resume. |
137 | * | | 137 | * |
138 | * Caller must be bound to the CPU, i.e., curcpu_stable() must be | | 138 | * Caller must be bound to the CPU, i.e., curcpu_stable() must be |
139 | * true. This function does not assert curcpu_stable() since it | | 139 | * true. This function does not assert curcpu_stable() since it |
140 | * is used in the ddb entry path, where any assertions risk | | 140 | * is used in the ddb entry path, where any assertions risk |
141 | * infinite regress into undebuggable chaos, so callers must be | | 141 | * infinite regress into undebuggable chaos, so callers must be |
142 | * careful. | | 142 | * careful. |
143 | */ | | 143 | */ |
144 | void | | 144 | void |
145 | heartbeat_suspend(void) | | 145 | heartbeat_suspend(void) |
146 | { | | 146 | { |
147 | unsigned *p; | | 147 | unsigned *p; |
148 | | | 148 | |
149 | p = &curcpu()->ci_heartbeat_suspend; | | 149 | p = &curcpu()->ci_heartbeat_suspend; |