diff options
author | cheloha <cheloha@cvs.openbsd.org> | 2021-06-02 00:39:28 +0000 |
---|---|---|
committer | cheloha <cheloha@cvs.openbsd.org> | 2021-06-02 00:39:28 +0000 |
commit | b7e5e9091b1fd81d1070ac231975d948b3f2e604 (patch) | |
tree | 70317683c24abd7f13855d5f74e919a61c6e8aac /sys/arch/arm/include | |
parent | be6c7749c1ff73e40caac0dbc5a752f8d159677c (diff) |
kernel: introduce per-CPU panic(9) message buffers
Add a 512-byte buffer (ci_panicbuf) to each cpu_info struct on each
platform for use by panic(9). The first panic on a given CPU writes
its message to this buffer. Subsequent panics on a given CPU print
the panic message to the console but do not modify the buffer. This
aids debugging in two cases:
- If 2+ CPUs panic simultaneously there is no risk of garbled messages
in the panic buffer.
- If a CPU panics and then the operator causes a second panic while
using ddb(4), the operator can still recall the first failure on
a particular CPU.
Misc. changes to support this bigger change:
- Set panicstr atomically to identify the first CPU to reach panic().
- Tweak db_show_panic_cmd() to print all panic messages across all
CPUs. Prefix the first panic with an asterisk ('*').
- Prefer db_printf() to printf() during a panic if we have it.
Apparently it disturbs less global state.
- On amd64, tweak fault() to write the local panic buffer. This needs
more work.
Prompted by bluhm@ and deraadt@. Mostly written by deraadt@.
Discussed with bluhm@, deraadt@ and kettenis@.
Borne from a discussion on tech@ about making panic(9) more MP-safe:
https://marc.info/?l=openbsd-tech&m=162086462316143&w=2
ok kettenis@, visa@, bluhm@, deraadt@
Diffstat (limited to 'sys/arch/arm/include')
-rw-r--r-- | sys/arch/arm/include/cpu.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/arch/arm/include/cpu.h b/sys/arch/arm/include/cpu.h index 118381e7fc7..28f1c9186ee 100644 --- a/sys/arch/arm/include/cpu.h +++ b/sys/arch/arm/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.59 2020/05/31 06:23:57 dlg Exp $ */ +/* $OpenBSD: cpu.h,v 1.60 2021/06/02 00:39:26 cheloha Exp $ */ /* $NetBSD: cpu.h,v 1.34 2003/06/23 11:01:08 martin Exp $ */ /* @@ -198,6 +198,8 @@ struct cpu_info { #ifdef GPROF struct gmonparam *ci_gmon; #endif + + char ci_panicbuf[512]; }; #define CPUF_PRIMARY (1<<0) |