summaryrefslogtreecommitdiff
path: root/sys/arch/sparc64
diff options
context:
space:
mode:
authorcheloha <cheloha@cvs.openbsd.org>2021-06-02 00:39:28 +0000
committercheloha <cheloha@cvs.openbsd.org>2021-06-02 00:39:28 +0000
commitb7e5e9091b1fd81d1070ac231975d948b3f2e604 (patch)
tree70317683c24abd7f13855d5f74e919a61c6e8aac /sys/arch/sparc64
parentbe6c7749c1ff73e40caac0dbc5a752f8d159677c (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/sparc64')
-rw-r--r--sys/arch/sparc64/include/cpu.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/arch/sparc64/include/cpu.h b/sys/arch/sparc64/include/cpu.h
index 267673a3adc..7c98e51432b 100644
--- a/sys/arch/sparc64/include/cpu.h
+++ b/sys/arch/sparc64/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.96 2020/09/14 20:28:41 deraadt Exp $ */
+/* $OpenBSD: cpu.h,v 1.97 2021/06/02 00:39:27 cheloha Exp $ */
/* $NetBSD: cpu.h,v 1.28 2001/06/14 22:56:58 thorpej Exp $ */
/*
@@ -164,6 +164,7 @@ struct cpu_info {
#ifdef GPROF
struct gmonparam *ci_gmon;
#endif
+ char ci_panicbuf[512];
};
#define CPUF_RUNNING 0x0001 /* CPU is running */