]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
minidump: Parameterize minidumpsys()
authorMitchell Horne <mhorne@FreeBSD.org>
Wed, 17 Nov 2021 15:26:59 +0000 (11:26 -0400)
committerMitchell Horne <mhorne@FreeBSD.org>
Fri, 19 Nov 2021 19:05:52 +0000 (15:05 -0400)
commit1adebe3cd6b1eb0973969e2c4c5d41f174caa304
tree938969db9576b5b2140e874a95c677bac2e3eced
parent840d72371bdc48be58152c839160c492bef7f1b7
minidump: Parameterize minidumpsys()

The minidump code is written assuming that certain global state will not
change, and rightly so, since it executes from a kernel debugger
context. In order to support taking minidumps of a live system, we
should allow copies of relevant global state that is likely to change to
be passed as parameters to the minidumpsys() function.

This patch does the work of parameterizing this function, by adding a
struct minidumpstate argument. For now, this struct allows for copies of
the kernel message buffer, and the bitset that tracks which pages should
be dumped (vm_page_dump). Follow-up changes will actually make use of
these arguments.

Notably, dump_avail[] does not need a snapshot, since it is not expected
to change after system initialization.

The existing minidumpsys() definitions are renamed, and a thin MI
wrapper is added to kern_dump.c, which handles the construction of
the state struct. Thus, calling minidumpsys() remains as simple as
before.

Reviewed by: kib, markj, jhb
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D31989
17 files changed:
sys/amd64/amd64/minidump_machdep.c
sys/arm/arm/minidump_machdep.c
sys/arm/include/md_var.h
sys/arm64/arm64/minidump_machdep.c
sys/arm64/include/md_var.h
sys/i386/i386/minidump_machdep.c
sys/i386/i386/minidump_machdep_base.c
sys/i386/include/md_var.h
sys/kern/kern_dump.c
sys/mips/include/md_var.h
sys/mips/mips/minidump_machdep.c
sys/powerpc/include/md_var.h
sys/powerpc/powerpc/minidump_machdep.c
sys/riscv/include/md_var.h
sys/riscv/riscv/minidump_machdep.c
sys/sys/kerneldump.h
sys/x86/include/x86_var.h