[PATCH v2 0/6] panic, x86/vmware: Preserve crash logs before kdump

From: Zack Rusin

Date: Mon Sep 28 2026 - 14:03:54 EST


A VMware guest may have no persistent storage or working userspace after
a crash. Preserve its newest kernel log tail in the host's vmware.log
before entering kdump, without enabling every panic notifier by default.

Following Petr's suggestion, add one generic panic_pre_kdump_list with
VMware as its first client. A set-once helper covers panic() and direct
crash-kexec entry. Fatal oopses can reach kdump without calling panic(),
so patch 2 adds that call after capturing the original registers under
the existing kexec lock. The late panic call follows sys_info() and
precedes the kmsg dumpers.

Patch 3 adds Guilherme's suggested escape hatch for debugging kdump
failures involving early callbacks. With panic_pre_kdump_postpone set,
the list runs before kdump only when crash_kexec_post_notifiers is also
set. This can omit hypervisor crash handling as well as diagnostics.
The late panic call remains eligible. This policy is a separate patch;
I can omit patch 3 if it is not wanted.

The logger preallocates an 8 KiB buffer and bounds its register-based
RPC transfer and retries. Michael suggested increasing the buffer
because 4 KiB can omit useful stack-trace context. Ordinary guests
enable logging by default; encrypted guests must opt in. Use
bool/proc_dobool for the sysctl as Joel requested. The potentially
terminating REPORTGUESTCRASH event remains a separate late dumper,
suppressed whenever a crash image is loaded. The v1 assignment to
crash_kexec_post_notifiers is dropped.

Tested on VMware Workstation and ESXi with ordinary guests, and on
ESXi with SEV-SNP and TDX guests.

v1:
https://lore.kernel.org/r/cover.1788414671.git.zack.rusin@xxxxxxxxxxxx

Zack Rusin (6):
panic: Add a notifier chain for pre-kdump callbacks
crash: Notify pre-kdump callbacks before switching kernels
panic: Allow postponing pre-kdump notifiers
x86/vmware: Add a bounded pre-kdump log sender
x86/vmware: Add the vmware_record_panic_msg sysctl
x86/vmware: Report guest crashes after kmsg dumpers

.../admin-guide/kernel-parameters.txt | 14 +
Documentation/admin-guide/sysctl/kernel.rst | 20 ++
arch/x86/include/asm/vmware.h | 2 +
arch/x86/kernel/cpu/vmware.c | 250 ++++++++++++++++++
include/linux/panic_notifier.h | 4 +
kernel/crash_core.c | 3 +
kernel/panic.c | 28 ++
7 files changed, 321 insertions(+)


base-commit: fd73f4a6659897191fa0d40695fe370925dd3780