Skip to contentSkip to conversation

panic, x86/vmware: Preserve crash logs before kdump

PATCH In review Zack Rusin 9 participants 22 messages Nov 18 – Nov 20

Subsystems (7)
lore
Share & tools
lore

Zack Rusin

author
#0 lore raw

v4 cover panic, x86/vmware: Preserve crash logs before kdump

This series lets VMware guests copy the end of their kernel log to the host's vmware.log when they crash, before entering kdump. This preserves diagnostic information even if the guest cannot save its own logs or the crash dump fails.

Using the existing panic notifier list for this would require crash_kexec_post_notifiers=1, which also runs unrelated callbacks before kdump. Following Petr's suggestion, v3 instead adds a separate platform panic notifier list for callbacks that need to run early. It runs before kdump and before stopping the other CPUs. It also covers fatal oopses that enter kdump without going through panic(). The callbacks run at most once, and the list can be disabled for debugging with disable_panic_notifiers_platform_list. crash_kexec_post_notifiers, the existing panic notifiers and the kmsg dumpers are unchanged.

The VMware log sender is the first user. It uses a preallocated 8 KiB buffer and limits both the transfer size and the number of retries. Logging is enabled by default in ordinary guests; encrypted guests must opt in through kernel.vmware_record_panic_msg. The copy is best-effort: kdump and reboot do not depend on it succeeding.

The separate VMware guest-crash notification, which can cause the host to terminate the VM, is a kmsg dumper registered late in boot, so it runs after the built-in log dumpers. It is suppressed while a crash kernel is loaded.

Changes since v3:
- Call the platform list before taking the kexec lock in __crash_kexec(), so a callback that panics on a direct crash_kexec() can still enter kdump (reported by Sashiko).
- Rebase onto v7.4-rc3.

Changes since v2:
- Replace the pre-kdump list and postponement parameter with the platform list and a debugging switch to disable it.
- Run the list in vpanic() before the other CPUs are stopped, instead of just before the kmsg dumpers.
- Correct the sysctl documentation heading.
- Rebase onto v7.4-rc1.

Tested on x86-64 guests on VMware Workstation, ESXi (ordinary, SEV-SNP and TDX) and QEMU/KVM.

Platform list proposal:
https://lore.kernel.org/r/[email protected]

v3:
https://lore.kernel.org/r/[email protected]
v2:
https://lore.kernel.org/r/[email protected]
v1:
https://lore.kernel.org/r/[email protected]

Zack Rusin (4):
panic: Add a platform panic notifier list x86/vmware: Add a bounded panic log sender x86/vmware: Add the vmware_record_panic_msg sysctl x86/vmware: Report guest crashes after kmsg dumpers

 .../admin-guide/kernel-parameters.txt         |  12 +
 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                |   3 +
 kernel/crash_core.c                           |   8 +
 kernel/panic.c                                |  51 ++++
 7 files changed, 346 insertions(+)

base-commit: aebb7274476403040d582c61478df8f4a7bf9cd3

author
#4 lore raw

PATCH v4 2/4 x86/vmware: Add a bounded panic log sender

A VMware guest may be unable to save its own logs after a crash. Copy the newest kernel log records to the host's vmware.log before kdump, so they remain available if the capture kernel fails.

Register the sender on the platform panic notifier list and send the log through the low-bandwidth register interface. Allocate a fixed 8 KiB buffer during early init; 4 KiB can lose useful stack-trace context. The callback allocates no memory and emits no printk messages. Limit the transfer to the buffer size and make at most three attempts, retrying only if a VM checkpoint interrupts the transfer.

Enable logging by default only in guests without memory encryption; encrypted guests should send their log to the host only when an administrator opts in. The copy is best-effort diagnostics; kdump does not depend on it succeeding.

---
v4: No change.

v3: Register on the platform list instead of the pre-kdump list. The VMware code is otherwise unchanged from v2.

 arch/x86/include/asm/vmware.h |   1 +
 arch/x86/kernel/cpu/vmware.c  | 173 ++++++++++++++++++++++++++++++++++
 2 files changed, 174 insertions(+)
arch/x86/include/asm/vmware.h +1 -0
index fb011cef01e7..dc3cf8123914 100644
@@ -57,6 +57,7 @@
 #define VMWARE_HYPERVISOR_MAGIC		0x564d5868U
 
 #define VMWARE_CMD_GETVERSION		10
+#define VMWARE_CMD_MESSAGE		30
 #define VMWARE_CMD_GETHZ		45
 #define VMWARE_CMD_GETVCPU_INFO		68
 #define VMWARE_CMD_STEALCLOCK		91
arch/x86/kernel/cpu/vmware.c +173 -0

202 lines not on this page · raw message

author
#18 lore raw

PATCH v4 4/4 x86/vmware: Report guest crashes after kmsg dumpers

In reply to Zack Rusin

VMware accepts a structured guest-crash event, but a host configured with backdoor.coredumpOnCrash may terminate the VM before the hypercall returns. Keep this event separate from the log sender, which runs earlier in panic.

Register a panic-only kmsg dumper with late_initcall_sync(), after built-in dumpers registered by then. Skip the event while a crash kernel is loaded so the host cannot terminate the guest before kdump saves its vmcore.

Issue the event at most once. With CONFIG_PRINTK=n, use a late INT_MIN panic notifier. An unexpected dumper registration failure with printk enabled leaves reporting disabled rather than overtaking working dumpers.

---
v4: No change.

v3: Rebase. No code change from v2.

 arch/x86/include/asm/vmware.h |  1 +
 arch/x86/kernel/cpu/vmware.c  | 62 +++++++++++++++++++++++++++++++++++
 2 files changed, 63 insertions(+)
arch/x86/include/asm/vmware.h +1 -0
index dc3cf8123914..6d3c9922c92b 100644
@@ -61,6 +61,7 @@
 #define VMWARE_CMD_GETHZ		45
 #define VMWARE_CMD_GETVCPU_INFO		68
 #define VMWARE_CMD_STEALCLOCK		91
+#define VMWARE_CMD_REPORTGUESTCRASH	102
 /*
  * Hypercall command mask:
  *   bits [6:0] command, range [0, 127]
arch/x86/kernel/cpu/vmware.c +62 -0

77 lines not on this page · raw message

author
#7 lore raw

PATCH v4 3/4 x86/vmware: Add the vmware_record_panic_msg sysctl

In reply to Zack Rusin

Allow administrators to disable host log transfer on ordinary guests or opt in on encrypted guests. Expose the boolean recording policy through kernel.vmware_record_panic_msg using proc_dobool(), as Joel suggested. Zero disables recording, nonzero integers enable it, and reads return 0 or 1.

Register the sysctl only after the logger is ready. A registration failure leaves the internal default in force. Document that the log is sent before kdump, and that disable_panic_notifiers_platform_list also skips it.

---
v4: No change.

v3: Document the platform list ordering and the disable switch, and fix the short section-title underline reported by Sashiko. No code change from v2.

 Documentation/admin-guide/sysctl/kernel.rst | 20 ++++++++++++++++++++
 arch/x86/kernel/cpu/vmware.c                | 15 +++++++++++++++
 2 files changed, 35 insertions(+)
Documentation/admin-guide/sysctl/kernel.rst +20 -0
index 608055d7ccc4..be2d5aa52362 100644
@@ -1680,6 +1680,26 @@ entry will default to 2 instead of 0.
 = =============================================================
 
 
+vmware_record_panic_msg
+=======================
+
+Controls whether kmsg data is written to the host's ``vmware.log`` on
+panic. This setting does not control the separate VMware guest-crash
+event. Writing zero disables recording; writing a nonzero integer
+enables it. Reads return 0 or 1.
+
+= ==============================================================
+0 Do not write kmsg data to ``vmware.log``. This is the default
+  for encrypted guests.
+1 Write kmsg data to ``vmware.log``. This is the default for
+  ordinary guests.
+= ==============================================================
+
+The data is written by a platform panic notifier: early in panic,
+before kdump, and also when a fatal oops enters kdump without a panic.
+Setting ``disable_panic_notifiers_platform_list`` skips it as well.
+
+
 warn_limit
 ==========
 
arch/x86/kernel/cpu/vmware.c +15 -0
index 0c6f7248a665..8c8b6dd7c3e8 100644
@@ -33,6 +33,7 @@
 #include <linux/reboot.h>
 #include <linux/sizes.h>
 #include <linux/static_call.h>
+#include <linux/sysctl.h>
 #include <linux/wordpart.h>
 #include <linux/sched/cputime.h>
 #include <asm/div64.h>
@@ -260,6 +261,16 @@ static int vmware_log_rpc(const char *buffer, size_t length)
 static struct page *vmware_panic_page;
 static bool vmware_record_panic_msg;
 
+static const struct ctl_table vmware_panic_sysctls[] = {
+	{
+		.procname	= "vmware_record_panic_msg",
+		.data		= &vmware_record_panic_msg,
+		.maxlen		= sizeof(vmware_record_panic_msg),
+		.mode		= 0644,
+		.proc_handler	= proc_dobool,
+	},
+};
+
 static int vmware_panic_log_notify(struct notifier_block *nb,
 				   unsigned long action, void *data)
 {
@@ -311,6 +322,10 @@ static int __init vmware_panic_log_init(void)
 		vmware_panic_page = NULL;
 	}
 
+	if (vmware_panic_page && IS_ENABLED(CONFIG_SYSCTL) &&
+	    !register_sysctl("kernel", vmware_panic_sysctls))
+		pr_err("failed to register panic log sysctl\n");
+
 	return 0;
 }
 early_initcall(vmware_panic_log_init);
author
#1 lore raw

PATCH v4 1/4 panic: Add a platform panic notifier list

In reply to Zack Rusin

Some platforms set crash_kexec_post_notifiers so their crash handlers run before kdump. That also runs every other panic notifier and kmsg dumper before the crash kernel.

Add panic_notifiers_platform_list for platform callbacks that need to run early and are safe while other CPUs are still running. Call it from vpanic() before kdump and before stopping the other CPUs, independently of crash_kexec_post_notifiers.

Also call it from __crash_kexec() if a crash kernel is loaded, since a fatal oops can enter kdump without panic(). Call it before taking the kexec lock, so a callback that panics can still enter kdump. Run the list at most once, including when a callback panics.

Add disable_panic_notifiers_platform_list to skip these callbacks when debugging panic or kdump failures.

---
v4: Call the list before kexec_trylock() in __crash_kexec(), and only when a crash kernel is loaded, so a callback that panics on a direct crash_kexec() can still enter kdump (reported by Sashiko).

v3: New. Replaces v2 patches 1-3 (pre-kdump list, crash-core call and panic_pre_kdump_postpone) with the platform list Petr suggested: one early call in vpanic(), one in __crash_kexec(), a shared guard and a disable switch. The guard is a plain bool, because calls are serialized, normally by panic_cpu.

 .../admin-guide/kernel-parameters.txt         | 12 +++++
 include/linux/panic_notifier.h                |  3 ++
 kernel/crash_core.c                           |  8 +++
 kernel/panic.c                                | 51 +++++++++++++++++++
 4 files changed, 74 insertions(+)
Documentation/admin-guide/kernel-parameters.txt +12 -0
index 0b3c140babd9..85ddcad397bf 100644
@@ -1308,6 +1308,18 @@ Kernel parameters
 			MTRR settings.  This parameter disables that behavior,
 			possibly causing your machine to run very slowly.
 
+	disable_panic_notifiers_platform_list=
+			[KNL] Skip the platform panic notifiers. They
+			normally run early in panic(), before kdump, and on
+			crash paths that enter kdump without panic().
+			Intended for debugging panic and kdump failures.
+			Skipping them may lose platform crash handling,
+			such as a copy of the kernel log on the hypervisor.
+			Format: <bool>
+			Default: 0
+			Writable at runtime via
+			/sys/module/kernel/parameters/disable_panic_notifiers_platform_list.
+
 	disable_timer_pin_1 [X86,EARLY]
 			Disable PIN 1 of APIC timer
 			Can be useful to work around chipset bugs.
include/linux/panic_notifier.h +3 -0
index 41e32483d7a7..1eaf1ffba0bc 100644
@@ -6,6 +6,9 @@
 #include <linux/types.h>
 
 extern struct atomic_notifier_head panic_notifier_list;
+extern struct atomic_notifier_head panic_notifiers_platform_list;
+
+void panic_notify_platform(void);
 
 extern bool crash_kexec_post_notifiers;
 
kernel/crash_core.c +8 -0
index d0bd2d0cf899..704a39875ea5 100644
@@ -23,6 +23,7 @@
 #include <linux/objtool.h>
 #include <linux/delay.h>
 #include <linux/panic.h>
+#include <linux/panic_notifier.h>
 
 #include <asm/page.h>
 #include <asm/sections.h>
@@ -126,6 +127,13 @@ static void crash_cma_clear_pending_dma(void)
  */
 void __noclone __crash_kexec(struct pt_regs *regs)
 {
+	/*
+	 * For crash paths that bypass panic(). Run before taking the kexec
+	 * lock, so a callback that panics can still enter kdump.
+	 */
+	if (kexec_crash_loaded())
+		panic_notify_platform();
+
 	/* Take the kexec_lock here to prevent sys_kexec_load
 	 * running on one cpu from replacing the crash kernel
 	 * we are using after a panic on a different cpu.
kernel/panic.c +51 -0

81 lines not on this page · raw message

#19 lore raw

Re: [PATCH v4 4/4] x86/vmware: Report guest crashes after kmsg dumpers

In reply to Zack Rusin
Sashiko has reviewed this patch and found no issues.
Quoted 13 lines

VMware accepts a structured guest-crash event, but a host configured with backdoor.coredumpOnCrash may terminate the VM before the hypercall returns. Keep this event separate from the log sender, which runs earlier in panic.

Register a panic-only kmsg dumper with late_initcall_sync(), after built-in dumpers registered by then. Skip the event while a crash kernel is loaded so the host cannot terminate the guest before kdump saves its vmcore.

Issue the event at most once. With CONFIG_PRINTK=n, use a late INT_MIN panic notifier. An unexpected dumper registration failure with printk enabled leaves reporting disabled rather than overtaking working dumpers.

Quoted 6 lines

Sashiko has reviewed this patch and found no issues.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4
#8 lore raw

Re: [PATCH v4 3/4] x86/vmware: Add the vmware_record_panic_msg sysctl

In reply to Zack Rusin
Sashiko has reviewed this patch and found no issues.
Quoted 6 lines

Allow administrators to disable host log transfer on ordinary guests or opt in on encrypted guests. Expose the boolean recording policy through kernel.vmware_record_panic_msg using proc_dobool(), as Joel suggested. Zero disables recording, nonzero integers enable it, and reads return 0 or 1.

Quoted 7 lines

Register the sysctl only after the logger is ready. A registration failure leaves the internal default in force. Document that the log is sent before kdump, and that disable_panic_notifiers_platform_list also skips it.

Sashiko has reviewed this patch and found no issues.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
#2 lore raw

Re: [PATCH v4 1/4] panic: Add a platform panic notifier list

In reply to Zack Rusin
Sashiko has reviewed this patch and found no issues.
Quoted 14 lines

Some platforms set crash_kexec_post_notifiers so their crash handlers run before kdump. That also runs every other panic notifier and kmsg dumper before the crash kernel.

Add panic_notifiers_platform_list for platform callbacks that need to run early and are safe while other CPUs are still running. Call it from vpanic() before kdump and before stopping the other CPUs, independently of crash_kexec_post_notifiers.

Also call it from __crash_kexec() if a crash kernel is loaded, since a fatal oops can enter kdump without panic(). Call it before taking the kexec lock, so a callback that panics can still enter kdump. Run the list at most once, including when a callback panics.

Quoted 6 lines

Add disable_panic_notifiers_platform_list to skip these callbacks when debugging panic or kdump failures.

Sashiko has reviewed this patch and found no issues.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#5 lore raw

Re: [PATCH v4 2/4] x86/vmware: Add a bounded panic log sender

In reply to Zack Rusin
Sashiko has reviewed this patch and found no issues.
Quoted 16 lines

A VMware guest may be unable to save its own logs after a crash. Copy the newest kernel log records to the host's vmware.log before kdump, so they remain available if the capture kernel fails.

Register the sender on the platform panic notifier list and send the log through the low-bandwidth register interface. Allocate a fixed 8 KiB buffer during early init; 4 KiB can lose useful stack-trace context. The callback allocates no memory and emits no printk messages. Limit the transfer to the buffer size and make at most three attempts, retrying only if a VM checkpoint interrupts the transfer.

Enable logging by default only in guests without memory encryption; encrypted guests should send their log to the host only when an administrator opts in. The copy is best-effort diagnostics; kdump does not depend on it succeeding.

Quoted 8 lines

Sashiko has reviewed this patch and found no issues.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
maintainer
#9 lore raw

Re: [PATCH v4 3/4] x86/vmware: Add the vmware_record_panic_msg sysctl

In reply to [email protected]
Quoted 11 lines · On 11/18/26 at 06:14am, [email protected] wrote:
Quoted 11 lines

Allow administrators to disable host log transfer on ordinary guests or opt in on encrypted guests. Expose the boolean recording policy through kernel.vmware_record_panic_msg using proc_dobool(), as Joel suggested. Zero disables recording, nonzero integers enable it, and reads return 0 or 1.

Register the sysctl only after the logger is ready. A registration failure leaves the internal default in force. Document that the log is sent before kdump, and that disable_panic_notifiers_platform_list also skips it.

Quoted 4 lines
Quoted 2 lines

Sashiko has reviewed this patch and found no issues.

It might be better to turn off this message if not issues found, just like what LKP bot has been doing.

maintainer
#10 lore raw

Re: [PATCH v4 3/4] x86/vmware: Add the vmware_record_panic_msg sysctl

Quoted 12 lines · On Wed, 18 Nov 2026 14:42:00 +0800 Baoquan He <[email protected]> wrote:
Quoted 11 lines · On 11/18/26 at 06:14am, [email protected] wrote:
Quoted 11 lines

Allow administrators to disable host log transfer on ordinary guests or opt in on encrypted guests. Expose the boolean recording policy through kernel.vmware_record_panic_msg using proc_dobool(), as Joel suggested. Zero disables recording, nonzero integers enable it, and reads return 0 or 1.

Register the sysctl only after the logger is ready. A registration failure leaves the internal default in force. Document that the log is sent before kdump, and that disable_panic_notifiers_platform_list also skips it.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Sashiko has reviewed this patch and found no issues.

It might be better to turn off this message if not issues found, just like what LKP bot has been doing.

([email protected])

Yes please.

These emails do have a little bit of value: they tell you that Sashiko was able to apply the patch and to review it. I guess. Or something.

Me:

:0 D:
* ^From:[ ]*sashiko-bot@kernel\.org[ ]*$
* B ?? ^Sashiko has reviewed this patch and found no issues\.$ /home/akpm/.nsmail-zip/Trash

hp2:/home/akpm> grep "From:.*sashiko-bot" .nsmail-zip/Trash | wc -l 1140
hp2:/home/akpm>

maintainer
#11 lore raw

Re: [PATCH v4 3/4] x86/vmware: Add the vmware_record_panic_msg sysctl

Quoted 22 lines · Andrew Morton
Quoted 12 lines · On Wed, 18 Nov 2026 14:42:00 +0800 Baoquan He <[email protected]> wrote:
Quoted 11 lines · On 11/18/26 at 06:14am, [email protected] wrote:
Quoted 11 lines

Allow administrators to disable host log transfer on ordinary guests or opt in on encrypted guests. Expose the boolean recording policy through kernel.vmware_record_panic_msg using proc_dobool(), as Joel suggested. Zero disables recording, nonzero integers enable it, and reads return 0 or 1.

Register the sysctl only after the logger is ready. A registration failure leaves the internal default in force. Document that the log is sent before kdump, and that disable_panic_notifiers_platform_list also skips it.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Sashiko has reviewed this patch and found no issues.

It might be better to turn off this message if not issues found, just like what LKP bot has been doing.

Quoted 6 lines

([email protected])

Yes please.

These emails do have a little bit of value: they tell you that Sashiko was able to apply the patch and to review it. I guess. Or something.

In that case a message saying Sashiko can't apply the entire patchset is better.

Quoted 12 lines

Me:

:0 D:
* ^From:[ ]*sashiko-bot@kernel\.org[ ]*$
* B ?? ^Sashiko has reviewed this patch and found no issues\.$ /home/akpm/.nsmail-zip/Trash

hp2:/home/akpm> grep "From:.*sashiko-bot" .nsmail-zip/Trash | wc -l 1140
hp2:/home/akpm>

#12 lore raw

Re: [PATCH v4 3/4] x86/vmware: Add the vmware_record_panic_msg sysctl

Quoted 34 lines · Baoquan He
Quoted 1 line · Andrew Morton

On Wed, 18 Nov 2026 14:42:00 +0800 Baoquan He <[email protected]>

Quoted 3 lines · wrote:
Quoted 3 lines · On 11/18/26 at 06:14am, [email protected] wrote:
Quoted 1 line
Quoted 1 line

Allow administrators to disable host log transfer on ordinary

guests or

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

opt in on encrypted guests. Expose the boolean recording policy

through

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

kernel.vmware_record_panic_msg using proc_dobool(), as Joel

suggested.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

Zero disables recording, nonzero integers enable it, and reads

return

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

0 or 1.

Register the sysctl only after the logger is ready. A registration

failure

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

leaves the internal default in force. Document that the log is

sent

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

before kdump, and that disable_panic_notifiers_platform_list also

skips

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

it.

Link:

https://lore.kernel.org/r/4e73yd2ofpdzl6rptzvd74no3hnyfblknoq7wzxlw7f3zjbz7c@srfabx6lsusj

Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Sashiko has reviewed this patch and found no issues.

It might be better to turn off this message if not issues found, just like what LKP bot has been doing.

([email protected])

Quoted 7 lines
Quoted 4 lines

Yes please.

These emails do have a little bit of value: they tell you that Sashiko was able to apply the patch and to review it. I guess. Or something.

In that case a message saying Sashiko can't apply the entire patchset is better.

yes my sashiko emails go to spam automatically (not cuz I set it, but cuz I get so much "no issues!" Emails, that it clogs up my inbox.

What even is the need to have the no issues emails? If one was THAT interested in sashiko, they could search for it?

Quoted 9 lines
Quoted 9 lines

Me:

:0 D:
* ^From:[ ]*sashiko-bot@kernel\.org[ ]*$
* B ?? ^Sashiko has reviewed this patch and found no issues\.$ /home/akpm/.nsmail-zip/Trash

Quoted 4 lines
Quoted 4 lines

hp2:/home/akpm> grep "From:.*sashiko-bot" .nsmail-zip/Trash | wc -l 1140
hp2:/home/akpm>

--- Thanks!

maintainer
#13 lore raw

Re: [PATCH v4 3/4] x86/vmware: Add the vmware_record_panic_msg sysctl

Quoted 40 lines · Bradley Morgan
Quoted 39 lines · Baoquan He
Quoted 1 line · Andrew Morton

On Wed, 18 Nov 2026 14:42:00 +0800 Baoquan He <[email protected]>

Quoted 3 lines · wrote:
Quoted 3 lines · On 11/18/26 at 06:14am, [email protected] wrote:
Quoted 1 line
Quoted 1 line

Allow administrators to disable host log transfer on ordinary

guests or

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

opt in on encrypted guests. Expose the boolean recording policy

through

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

kernel.vmware_record_panic_msg using proc_dobool(), as Joel

suggested.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

Zero disables recording, nonzero integers enable it, and reads

return

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

0 or 1.

Register the sysctl only after the logger is ready. A registration

failure

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

leaves the internal default in force. Document that the log is

sent

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

before kdump, and that disable_panic_notifiers_platform_list also

skips

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

it.

Link:

https://lore.kernel.org/r/4e73yd2ofpdzl6rptzvd74no3hnyfblknoq7wzxlw7f3zjbz7c@srfabx6lsusj

Quoted 13 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Sashiko has reviewed this patch and found no issues.

It might be better to turn off this message if not issues found, just like what LKP bot has been doing.

([email protected])

Yes please.

These emails do have a little bit of value: they tell you that Sashiko was able to apply the patch and to review it. I guess. Or something.

Quoted 8 lines
Quoted 2 lines

In that case a message saying Sashiko can't apply the entire patchset is better.

yes my sashiko emails go to spam automatically (not cuz I set it, but cuz I get so much "no issues!" Emails, that it clogs up my inbox.

What even is the need to have the no issues emails? If one was THAT interested in sashiko, they could search for it?

Yeah, searching for it is one good way. Not sure if it's convenient for people like Andrew and Mike who need pick patch. They may need check patchset one by one if Sashiko can't apply patch while keep silent. And some patch authors could be new, they could mistake sashiko being silent as no issue. I did that before until Andrew told me in a private message.

If there's a document telling people where and how to search, that's also good.

Quoted 16 lines
Quoted 10 lines
Quoted 10 lines

Me:

:0 D:
* ^From:[ ]*sashiko-bot@kernel\.org[ ]*$
* B ?? ^Sashiko has reviewed this patch and found no issues\.$ /home/akpm/.nsmail-zip/Trash

Quoted 4 lines
Quoted 4 lines

hp2:/home/akpm> grep "From:.*sashiko-bot" .nsmail-zip/Trash | wc -l 1140
hp2:/home/akpm>

--- Thanks!

#16 lore raw

Re: [PATCH v4 3/4] x86/vmware: Add the vmware_record_panic_msg sysctl

In reply to Baoquan He
Quoted 12 lines · On Wed, 18 Nov 2026 14:42:00 +0800 Baoquan He <[email protected]> wrote:
Quoted 11 lines · On 11/18/26 at 06:14am, [email protected] wrote:
Quoted 11 lines

Allow administrators to disable host log transfer on ordinary guests or opt in on encrypted guests. Expose the boolean recording policy through kernel.vmware_record_panic_msg using proc_dobool(), as Joel suggested. Zero disables recording, nonzero integers enable it, and reads return 0 or 1.

Register the sysctl only after the logger is ready. A registration failure leaves the internal default in force. Document that the log is sent before kdump, and that disable_panic_notifiers_platform_list also skips it.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Sashiko has reviewed this patch and found no issues.

It might be better to turn off this message if not issues found, just like what LKP bot has been doing.

I believe that's an option per mailing list. I personally like it because to me it does add value. It tells me it was able to apply it and it didn't find anything wrong with it. This way I know sashiko didn't ignore it.

But I understand others may not find that useful.

-- Steve

maintainer
#14 lore raw

Re: [PATCH v4 3/4] x86/vmware: Add the vmware_record_panic_msg sysctl

In reply to Baoquan He
Quoted 25 lines · Baoquan He
Quoted 24 lines · Andrew Morton
Quoted 12 lines · On Wed, 18 Nov 2026 14:42:00 +0800 Baoquan He <[email protected]> wrote:
Quoted 11 lines · On 11/18/26 at 06:14am, [email protected] wrote:
Quoted 11 lines

Allow administrators to disable host log transfer on ordinary guests or opt in on encrypted guests. Expose the boolean recording policy through kernel.vmware_record_panic_msg using proc_dobool(), as Joel suggested. Zero disables recording, nonzero integers enable it, and reads return 0 or 1.

Register the sysctl only after the logger is ready. A registration failure leaves the internal default in force. Document that the log is sent before kdump, and that disable_panic_notifiers_platform_list also skips it.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Sashiko has reviewed this patch and found no issues.

It might be better to turn off this message if not issues found, just like what LKP bot has been doing.

([email protected])

Quoted 7 lines
Quoted 4 lines

Yes please.

These emails do have a little bit of value: they tell you that Sashiko was able to apply the patch and to review it. I guess. Or something.

In that case a message saying Sashiko can't apply the entire patchset is better.

Yeah, sounds better.

Or, perhaps Sashiko can reply to the cover with a list of patches it found no issues with. That should reduce the spam on big series at least, while still keeping the signal of "Sashiko looked at this".

[...]

Signature · 2 lines
Regards,
Pratyush Yadav
#15 lore raw

Re: [PATCH v4 3/4] x86/vmware: Add the vmware_record_panic_msg sysctl

In reply to Andrew Morton
Quoted 22 lines · Andrew Morton
Quoted 12 lines · On Wed, 18 Nov 2026 14:42:00 +0800 Baoquan He <[email protected]> wrote:
Quoted 11 lines · On 11/18/26 at 06:14am, [email protected] wrote:
Quoted 11 lines

Allow administrators to disable host log transfer on ordinary guests or opt in on encrypted guests. Expose the boolean recording policy through kernel.vmware_record_panic_msg using proc_dobool(), as Joel suggested. Zero disables recording, nonzero integers enable it, and reads return 0 or 1.

Register the sysctl only after the logger is ready. A registration failure leaves the internal default in force. Document that the log is sent before kdump, and that disable_panic_notifiers_platform_list also skips it.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

Sashiko has reviewed this patch and found no issues.

It might be better to turn off this message if not issues found, just like what LKP bot has been doing.

Quoted 6 lines

([email protected])

Yes please.

These emails do have a little bit of value: they tell you that Sashiko was able to apply the patch and to review it. I guess. Or something.

They are opt-in and some maintainers asked for them, so Idk if globally disabling them is a good idea. Johannes suggested to send one email per patchset, which I like as an idea, will implement a bit later.

I like the idea (from the thread) to send an email if a patch(set) hasn't been reviewed, e.g. not applied correctly. Will implement as opt-in feature too.

Thanks

Reviewed-by on v4 1/4
#3 lore raw

Re: [PATCH v4 1/4] panic: Add a platform panic notifier list

In reply to Zack Rusin
Quoted 14 lines · Zack Rusin

Some platforms set crash_kexec_post_notifiers so their crash handlers run before kdump. That also runs every other panic notifier and kmsg dumper before the crash kernel.

Add panic_notifiers_platform_list for platform callbacks that need to run early and are safe while other CPUs are still running. Call it from vpanic() before kdump and before stopping the other CPUs, independently of crash_kexec_post_notifiers.

Also call it from __crash_kexec() if a crash kernel is loaded, since a fatal oops can enter kdump without panic(). Call it before taking the kexec lock, so a callback that panics can still enter kdump. Run the list at most once, including when a callback panics.

Quoted 6 lines

Add disable_panic_notifiers_platform_list to skip these callbacks when debugging panic or kdump failures.

JFYI, it looks reasonable from my POV:

Best Regards,
Petr

Reviewed-by on v4 2/4
#6 lore raw

Re: [PATCH v4 2/4] x86/vmware: Add a bounded panic log sender

In reply to Zack Rusin
Quoted 16 lines · Zack Rusin

A VMware guest may be unable to save its own logs after a crash. Copy the newest kernel log records to the host's vmware.log before kdump, so they remain available if the capture kernel fails.

Register the sender on the platform panic notifier list and send the log through the low-bandwidth register interface. Allocate a fixed 8 KiB buffer during early init; 4 KiB can lose useful stack-trace context. The callback allocates no memory and emits no printk messages. Limit the transfer to the buffer size and make at most three attempts, retrying only if a VM checkpoint interrupts the transfer.

Enable logging by default only in guests without memory encryption; encrypted guests should send their log to the host only when an administrator opts in. The copy is best-effort diagnostics; kdump does not depend on it succeeding.

Quoted 8 lines

I made just a quick review of the string manipulation and kmsg_dump_get_buffer() API use. And it looks good to me:

Note that I am not familiar with the vmware hypercalls so that I did not check this part.

Some nits below.

Quoted 7 lines
arch/x86/kernel/cpu/vmware.c +4 -0
@@ -52,6 +57,23 @@
+#define VMWARE_LOG_BUF_SIZE		SZ_8K
+#define VMWARE_LOG_ATTEMPTS		3
+#define VMWARE_LOG_PREFIX		"log "
+#define VMWARE_LOG_PREFIX_LEN		(sizeof(VMWARE_LOG_PREFIX) - 1)

[...]

Quoted 29 lines
arch/x86/kernel/cpu/vmware.c +29 -0
+static int vmware_log_send_once(const struct vmware_rpc_channel *channel,
+				const char *buffer, size_t length)
+{
+	u32 info;
+
+	vmware_hypercall5(VMWARE_CMD_MESSAGE | VMWARE_MSG_SENDSIZE, length,
+			  (u32)channel->id << 16, channel->cookie_high,
+			  channel->cookie_low, &info);
+	if (!(info & VMWARE_MSG_STATUS_SUCCESS))
+		return info & VMWARE_MSG_STATUS_CPT ? -EAGAIN : -EIO;
+
+	while (length) {
+		size_t bytes = min_t(size_t, length, sizeof(u32));
+		u32 word = 0;
+
+		memcpy(&word, buffer, bytes);
+		vmware_hypercall5(VMWARE_CMD_MESSAGE | VMWARE_MSG_SENDPAYLOAD,
+				  word, (u32)channel->id << 16,
+				  channel->cookie_high, channel->cookie_low,
+				  &info);
+		if (!(info & VMWARE_MSG_STATUS_SUCCESS))
+			return info & VMWARE_MSG_STATUS_CPT ? -EAGAIN : -EIO;
+
+		buffer += bytes;
+		length -= bytes;
+	}
+
+	return 0;
+}

[...]

arch/x86/kernel/cpu/vmware.c static unsigned long vmware_get_tsc_khz(void) · line 268

Quoted 6 lines
arch/x86/kernel/cpu/vmware.c +6 -0
+static int vmware_panic_log_notify(struct notifier_block *nb,
+				   unsigned long action, void *data)
+{
+	struct kmsg_dump_iter iter;
+	char *buffer = page_address(vmware_panic_page);
+	size_t length = 0;

I would add:

	BUILD_BUG_ON(VMWARE_LOG_PREFIX_LEN > VMWARE_LOG_BUF_SIZE);

just to be on the safe side.

arch/x86/kernel/cpu/vmware.c static unsigned long vmware_get_tsc_khz(void) · line 273

Quoted 5 lines
arch/x86/kernel/cpu/vmware.c +5 -0
+
+	if (!READ_ONCE(vmware_record_panic_msg))
+		return NOTIFY_DONE;
+
+	memcpy(buffer, VMWARE_LOG_PREFIX, VMWARE_LOG_PREFIX_LEN);

I would feel more comfortable when the trailing '\0' gets copied as well, e.g.

	strscpy(buffer, VMWARE_LOG_PREFIX);

It is not strictly needed because the length is counted explicitly, strlen() is not used. Also vmware_log_rpc() does not send the trailing '\0'.

So, it is a rather a defensive programming. The buffer might be handled another way in the future, e.g. printed by some debug code, tracing, ...

arch/x86/kernel/cpu/vmware.c static unsigned long vmware_get_tsc_khz(void) · line 282

Quoted 9 lines
arch/x86/kernel/cpu/vmware.c +9 -0
+	kmsg_dump_rewind(&iter);
+	(void)kmsg_dump_get_buffer(&iter, true,
+				   buffer + VMWARE_LOG_PREFIX_LEN,
+				   VMWARE_LOG_BUF_SIZE - VMWARE_LOG_PREFIX_LEN,
+				   &length);
+	(void)vmware_log_rpc(buffer, length + VMWARE_LOG_PREFIX_LEN);
+
+	return NOTIFY_DONE;
+}

Best Regards,
Petr

Reviewed-by on v4 3/4
#17 lore raw

Re: [PATCH v4 3/4] x86/vmware: Add the vmware_record_panic_msg sysctl

In reply to Zack Rusin
Quoted 6 lines · Zack Rusin

Allow administrators to disable host log transfer on ordinary guests or opt in on encrypted guests. Expose the boolean recording policy through kernel.vmware_record_panic_msg using proc_dobool(), as Joel suggested. Zero disables recording, nonzero integers enable it, and reads return 0 or 1.

Quoted 7 lines

Register the sysctl only after the logger is ready. A registration failure leaves the internal default in force. Document that the log is sent before kdump, and that disable_panic_notifiers_platform_list also skips it.

LGTM:

Best Regards,
Petr

#20 lore raw

Re: [PATCH v4 4/4] x86/vmware: Report guest crashes after kmsg dumpers

In reply to Zack Rusin

Hi,

this patch looks a bit messy, But maybe, I just do not know enough about VMvare.

Quoted 4 lines · Zack Rusin

VMware accepts a structured guest-crash event, but a host configured with backdoor.coredumpOnCrash may terminate the VM before the hypercall returns. Keep this event separate from the log sender, which runs earlier in panic.

I am a bit lost here ;-)

What exactly means the "structured guest-crash event"? Which hypercall are we talking about?

Is this primary about synchronization of vmware_panic_log_notify() against termination of the crashing guest by the host? Or is this about something else?

What exactly does vmware_hypercall1(VMWARE_CMD_REPORTGUESTCRASH, 0)? Does it _block_ or _trigger_ backdoor.coredumpOnCrash?

Quoted 2 lines

Register a panic-only kmsg dumper with late_initcall_sync(), after built-in dumpers registered by then.

Is this ordering important?

Quoted 2 lines

Skip the event while a crash kernel is loaded
so the host cannot terminate the guest before kdump saves its vmcore.

This suggests that vmware_hypercall1(VMWARE_CMD_REPORTGUESTCRASH, 0) actually triggers the external crash dump procedure made by the host.

Quoted 3 lines

Issue the event at most once. With CONFIG_PRINTK=n, use a late INT_MIN panic notifier. An unexpected dumper registration failure with printk enabled leaves reporting disabled rather than overtaking working dumpers.

This is another mystery. What do you want to achieve when CONFIG_PRINTK is not defined, please?

Note that printk() is a NOP when CONFIG_PRINTK is not defined. There is nothing to dump in this case.

Honestly, I would not complicate the code by this. I doubt that anyone is using kernel without CONFIG_PRINTK.

Quoted 5 lines
arch/x86/kernel/cpu/vmware.c +3 -0
+static int __init vmware_crash_report_init(void)
+{
+	int ret;

arch/x86/kernel/cpu/vmware.c static int __init vmware_panic_log_init(void) · line 383

Quoted 10 lines
arch/x86/kernel/cpu/vmware.c +10 -0
+
+	if (!hypervisor_is_type(X86_HYPER_VMWARE))
+		return 0;
+
+	ret = kmsg_dump_register(&vmware_crash_report_dumper);
+	if (!ret)
+		return 0;
+	if (IS_ENABLED(CONFIG_PRINTK)) {
+		pr_err("failed to register crash report dumper: %d\n", ret);
+		return 0;

This is weird. As I said, printk() is a NOP when CONFIG_PRINTK is not defined. So, you would achieve the same with:

	ret = kmsg_dump_register(&vmware_crash_report_dumper);
	if (ret)
		pr_err("failed to register crash report dumper: %d\n", ret);
	return 0;

But wait, this means that the code below is never reached.

Ah, I see, you wanted to run the code below when CONFIG_PRINTK was disabled. It was far from obvious. And I do not understand the motivation much.

Anyway, it won't work because kmsg_dump_register() returns -EINVAL when CONFIG_PRINTK is not defined. err != 0 ...

Let's take a step back.

Why do you want to use kmsg_dump infrastructure for notifying host about the crash, please?

The kmsg_dump API should be used to dump the printk messages. But this just notifies the host about the crash. It looks like an API misuse.

arch/x86/kernel/cpu/vmware.c static int __init vmware_panic_log_init(void) · line 391

Quoted 8 lines
arch/x86/kernel/cpu/vmware.c +8 -0
+	}
+
+	ret = atomic_notifier_chain_register(&panic_notifier_list,
+					     &vmware_crash_report_nb);
+	if (ret)
+		pr_err("failed to register crash report notifier: %d\n", ret);
+
+	return 0;

IMHO, you either want to use the panic_notifier list.

Or you might even use the new panic_notifiers_platform_list if you make sure that this is called as the last event and you really want to stop the guest at this point.

My assumption is that the "host" will stop the "crashing guest" when it gets notified about the crash.

arch/x86/kernel/cpu/vmware.c static int __init vmware_panic_log_init(void) · line 397

Quoted 6 lines
arch/x86/kernel/cpu/vmware.c +3 -0
+}
+late_initcall_sync(vmware_crash_report_init);
+
 #ifdef CONFIG_PARAVIRT
 static struct cyc2ns_data vmware_cyc2ns __ro_after_init;
 static bool vmw_sched_clock __initdata = true;

Best Regards,
Petr

PS: It looks to me like Sashiko AI completely failed here. It did not
mind if the commit message made sense. It did not see the big picture. And it even missed that the code did not work with CONFIG_PRINTK undefined.

author
#21 lore raw

Re: [PATCH v4 4/4] x86/vmware: Report guest crashes after kmsg dumpers

Quoted 5 lines · Petr Mladek

Hi,

this patch looks a bit messy, But maybe, I just do not know enough about VMvare.

It's my fault for not explaining it better. I'm trying to find a balance between being overly verbose and explaining only what's necessary for review, while omitting details irrelevant outside of VMware, and I'm failing.

Quoted 10 lines · Zack Rusin
Quoted 4 lines

VMware accepts a structured guest-crash event, but a host configured with backdoor.coredumpOnCrash may terminate the VM before the hypercall returns. Keep this event separate from the log sender, which runs earlier in panic.

I am a bit lost here ;-)

What exactly means the "structured guest-crash event"? Which hypercall are we talking about?

VMWARE_CMD_REPORTGUESTCRASH, the vmware_hypercall1() in vmware_report_guest_crash(). It takes no arguments and carries no data. It tells the host that the guest OS has crashed. The host records that, and vSphere can raise a "Guest OS crashed" event for the VM that management tools and alarms act on.

"Structured" was a poor way of saying "a crash state the host understands". Patch 2, by contrast, only copies log text into the VM's log file on the host. I can drop the word "structured".

Quoted 3 lines

Is this primary about synchronization of vmware_panic_log_notify() against termination of the crashing guest by the host? Or is this about something else?

It's about ordering rather than synchronization. Patch 2 sends the log from the platform list, before kdump, so it is done before the report can happen. Patch 4 is about the other side: it skips the report when a crash kernel is loaded, and otherwise tries to give the guest's own log dumpers (pstore etc.) a chance to finish first.

Quoted 2 lines

What exactly does vmware_hypercall1(VMWARE_CMD_REPORTGUESTCRASH, 0)? Does it _block_ or _trigger_ backdoor.coredumpOnCrash?

It triggers it. Normally the call records the guest OS crash and returns, and Linux continues its panic path. backdoor.coredumpOnCrash is a debugging option in the VM's configuration, off by default. With it enabled, the host attempts a dump of the guest and stops the VM during the call, so the hypercall never returns.

So with that option set, anything panic() still has to do after the report never happens. That always includes the kmsg dumpers that come after the report, and, without the crash-kernel check, kdump too when crash_kexec_post_notifiers is set. That is also why the report can't share the platform list with the log sender.

Quoted 4 lines
Quoted 2 lines

Register a panic-only kmsg dumper with late_initcall_sync(), after built-in dumpers registered by then.

Is this ordering important?

Yes. kmsg_dump_desc() calls the dumpers in registration order, since kmsg_dump_register() appends with list_add_tail_rcu(). Registering from late_initcall_sync() puts the report after the panic dumpers that are already registered at that point, giving them a chance to save their records before a coredumpOnCrash host stops the VM. Dumpers registered later, by modules or late-probing drivers, end up behind it. It only makes a difference with that option set.

Quoted 5 lines
Quoted 2 lines

Skip the event while a crash kernel is loaded
so the host cannot terminate the guest before kdump saves its vmcore.

This suggests that vmware_hypercall1(VMWARE_CMD_REPORTGUESTCRASH, 0) actually triggers the external crash dump procedure made by the host.

Yes, when the option is set. With crash_kexec_post_notifiers, kdump runs after kmsg_dump_desc(), so the report would stop the VM before the capture kernel started. A guest with a crash kernel loaded therefore leaves the crash to kdump and does not report it.

Quoted 37 lines
Quoted 3 lines

Issue the event at most once. With CONFIG_PRINTK=n, use a late INT_MIN panic notifier. An unexpected dumper registration failure with printk enabled leaves reporting disabled rather than overtaking working dumpers.

This is another mystery. What do you want to achieve when CONFIG_PRINTK is not defined, please?

Note that printk() is a NOP when CONFIG_PRINTK is not defined. There is nothing to dump in this case.

Honestly, I would not complicate the code by this. I doubt that anyone is using kernel without CONFIG_PRINTK.

Quoted 5 lines
arch/x86/kernel/cpu/vmware.c +3 -0
+static int __init vmware_crash_report_init(void)
+{
+     int ret;

arch/x86/kernel/cpu/vmware.c static int __init vmware_panic_log_init(void) · line 383

Quoted 10 lines
arch/x86/kernel/cpu/vmware.c +10 -0
+
+     if (!hypervisor_is_type(X86_HYPER_VMWARE))
+             return 0;
+
+     ret = kmsg_dump_register(&vmware_crash_report_dumper);
+     if (!ret)
+             return 0;
+     if (IS_ENABLED(CONFIG_PRINTK)) {
+             pr_err("failed to register crash report dumper: %d\n", ret);
+             return 0;

This is weird. As I said, printk() is a NOP when CONFIG_PRINTK is not defined. So, you would achieve the same with:

        ret = kmsg_dump_register(&vmware_crash_report_dumper);
        if (ret)
                pr_err("failed to register crash report dumper: %d\n", ret);
        return 0;
Quoted 8 lines

But wait, this means that the code below is never reached.

Ah, I see, you wanted to run the code below when CONFIG_PRINTK was disabled. It was far from obvious. And I do not understand the motivation much.

Anyway, it won't work because kmsg_dump_register() returns -EINVAL when CONFIG_PRINTK is not defined. err != 0 ...

That -EINVAL is what the fallback relies on. With CONFIG_PRINTK=n the stub returns -EINVAL and IS_ENABLED(CONFIG_PRINTK) is false, so init falls through and registers the INT_MIN panic notifier instead. The pr_err() branch is only for a real registration failure with printk enabled.

The motivation was that the report doesn't need the log, so a kernel without printk could still report its crash. Now having said that, is CONFIG_PRINTK=n actively used inside vmware? Not to my knowledge, I did it for completness more than a very specific need so if you really don't want it in, I can remove all the CONFIG_PRINTK=n handling, at least until I have a specific need for it.

Quoted 8 lines

Let's take a step back.

Why do you want to use kmsg_dump infrastructure for notifying host about the crash, please?

The kmsg_dump API should be used to dump the printk messages. But this just notifies the host about the crash. It looks like an API misuse.

The only reason is ordering. In vpanic() the platform list runs before kdump, and panic_notifier_list, even at INT_MIN, runs before kmsg_dump_desc(). Registering a late dumper is the only way to run after the dumpers registered before it. I agree that a dumper which never reads the log is a bit hacky :)

Quoted 11 lines

arch/x86/kernel/cpu/vmware.c static int __init vmware_panic_log_init(void) · line 391

Quoted 8 lines
arch/x86/kernel/cpu/vmware.c +8 -0
+     }
+
+     ret = atomic_notifier_chain_register(&panic_notifier_list,
+                                          &vmware_crash_report_nb);
+     if (ret)
+             pr_err("failed to register crash report notifier: %d\n", ret);
+
+     return 0;

IMHO, you either want to use the panic_notifier list.

Quoted 3 lines

Or you might even use the new panic_notifiers_platform_list if you make sure that this is called as the last event and you really want to stop the guest at this point.

I don't think that the platform can be last: by design it runs before kdump, and it already holds the log sender from patch 2.

panic_notifier_list at INT_MIN would work, and it would cover CONFIG_PRINTK=n without a special case. The cost applies only when coredumpOnCrash is set and no crash kernel is loaded: the VM would stop before panic_print's sys_info() output and before all of the kmsg dumpers, pstore included. The host's dump would win over pstore. On a default host the dumpers still run; the host just hears about the crash a little earlier.

I'm fine with either. If you don't like this approach for v5 I can switch to a panic_notifier_list entry at INT_MIN (still skipped while a crash kernel is loaded), or keep the dumper and add a comment explaining why it ignores the log. Which would you prefer?

Quoted 2 lines

My assumption is that the "host" will stop the "crashing guest" when it gets notified about the crash.

Not by default. Normally the host records the crash and the call returns, so the guest continues its panic path. It's stopped during the call only when backdoor.coredumpOnCrash is enabled.

Quoted 4 lines

PS: It looks to me like Sashiko AI completely failed here. It did not
mind if the commit message made sense. It did not see the big picture. And it even missed that the code did not work with CONFIG_PRINTK undefined.

I don't know if sashiko reads commit messages, that one is on me. I'm trying to get better at finding the right balance between oversharing and not sharing enough and it's not easy.

The CONFIG_PRINTK=n case isn't a miss, though. As above, init falls back to the panic notifier when kmsg_dump_register() returns -EINVAL, so that path works. It's just a question of whether it's worth having:
for me it was easy enough to handle it but I wouldn't object to dropping it if you find it too complex.

Thanks for the careful review!

z