x86/vmware: Preserve panic diagnostics in vmware.log
Subsystems (6)
cover x86/vmware: Preserve panic diagnostics in vmware.log
A virtual machine may have neither guest-local persistent storage nor working userspace after a panic. The host's vmware.log remains available after the VM terminates, and a production encrypted guest is the only component able to export readable panic text. Hyper-V already provides this class of host-persistent panic reporting.
Add a panic-only VMware logger that copies the newest 4 KiB of the kernel log and sends it with bounded low-bandwidth RPC work. Ordinary guests enable text transfer by default; encrypted guests require an administrator to opt in through kernel.vmware_record_panic_msg. A separate late dumper reports the structured crash event after built-in dumpers and suppresses the event while a crash kernel is loaded, because a configured VMware host may terminate the VM before the reporting hypercall returns.
Patch 4 makes panic diagnostics run before kdump by default on VMware guests. This follows existing platform uses of crash_kexec_post_notifiers, with Hyper-V as the closest guest-reporting precedent. Unlike Hyper-V, VMware exposes no capability bit for this behavior. An explicit crash_kexec_post_notifiers=0 still wins, and patch 4 can be dropped without affecting patches 1 through 3.
This replaces patches 2 and 3 of Alexey's v2 posting:
https://lore.kernel.org/all/[email protected]/
The intended merge path is tip's x86/vmware branch. Boris please review the VMware transport and policy. Petr and John, please review the panic-only dumper use and registration ordering. Joel and Kees, please review the sysctl. Baoquan and the KEXEC/KDUMP team, please review the loaded-crash-kernel guard and the default in patch 4.
Zack Rusin (4):
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 x86/vmware: Run panic diagnostics before kdump by default
Documentation/admin-guide/sysctl/kernel.rst | 14 ++ arch/x86/include/asm/vmware.h | 2 + arch/x86/kernel/cpu/vmware.c | 245 ++++++++++++++++++++ 3 files changed, 261 insertions(+)
base-commit: cee9395acd8043be0644b25c34bfa86623f2b935
Signature · 1 line
2.53.0
PATCH 1/4 x86/vmware: Add a bounded panic log sender
A virtual machine may have no guest-local persistent storage or working userspace after a panic. Preserve the newest kernel log tail in the host vmware.log, which remains available after the VM terminates.
Allocate one page during early init and register a panic-only kmsg dumper. Copy the newest records once, prefix them with "log ", and send one explicit-length RPC message over the low-bandwidth register path. The page limit bounds panic-time work and avoids sharing guest memory with the host.
Keep the source immutable for up to three attempts. Retry only checkpoint responses, zero-fill a short final word, and close the single RPC channel on every exit after open. The panic callback allocates nothing, does not sleep, and emits no printk messages.
Free the page and leave panic logging disabled if dumper registration fails, including when CONFIG_PRINTK=n.
--- arch/x86/include/asm/vmware.h | 1 + arch/x86/kernel/cpu/vmware.c | 158 ++++++++++++++++++++++++++++++++++ 2 files changed, 159 insertions(+)
arch/x86/include/asm/vmware.h +1 -0
@@ -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 +158 -0
187 lines not on this page · raw message
Signature · 1 line
2.53.0
RE: [PATCH v1 1/4] x86/vmware: Add a bounded panic log sender
From: Zack Rusin <[email protected]> Sent: Tuesday, September 8, 2026 11:07 AM
Quoted 9 lines
A virtual machine may have no guest-local persistent storage or working userspace after a panic. Preserve the newest kernel log tail in the host vmware.log, which remains available after the VM terminates.
Allocate one page during early init and register a panic-only kmsg dumper. Copy the newest records once, prefix them with "log ", and send one explicit-length RPC message over the low-bandwidth register path. The page limit bounds panic-time work and avoids sharing guest memory with the host.
Hyper-V provides a similar capability to push the newest 4 KiB of the kmsg log to the host so it is preserved after the VM terminates. I've used this functionality on many occasions, and it is definitely valuable. The biggest problem is that 4 KiB is often not enough bytes to capture the most relevant part of the stack dump that's created by panic(). If you can expand to 8 KiB, I think you'll find that works much better. For Hyper-V, we're still stuck with the 4 KiB limit because negotiating and staging the expansion with the host hasn't gotten above that team's cut line.
Michael
Quoted 19 lines
Keep the source immutable for up to three attempts. Retry only checkpoint responses, zero-fill a short final word, and close the single RPC channel on every exit after open. The panic callback allocates nothing, does not sleep, and emits no printk messages.
Free the page and leave panic logging disabled if dumper registration fails, including when
CONFIG_PRINTK=n.Co-developed-by Bo Gan <[email protected]>Signed-off-by Bo Gan <[email protected]>Co-developed-by Alexey Makhalov <[email protected]>Signed-off-by Alexey Makhalov <[email protected]>Signed-off-by Zack Rusin <[email protected]>--- arch/x86/include/asm/vmware.h | 1 + arch/x86/kernel/cpu/vmware.c | 158 ++++++++++++++++++++++++++++++++++ 2 files changed, 159 insertions(+)
PATCH 2/4 x86/vmware: Add the vmware_record_panic_msg sysctl
In reply to Zack RusinFull panic text is useful on ordinary guests. Encrypted guests should export it only when an administrator opts in. Reporting a crash does not require transferring the log.
Enable panic recording by default for ordinary VMware guests and disable it when guest memory encryption is active. Expose the policy as the boolean kernel.vmware_record_panic_msg sysctl and document that it controls only the vmware.log transfer.
Register the sysctl only after the panic buffer and dumper are ready, and only when sysctl support is built. A registration failure leaves the internal default in force.
--- Documentation/admin-guide/sysctl/kernel.rst | 14 +++++++++++++ arch/x86/kernel/cpu/vmware.c | 23 +++++++++++++++++++++ 2 files changed, 37 insertions(+)
Documentation/admin-guide/sysctl/kernel.rst +14 -0
@@ -1690,6 +1690,20 @@ entry will default to 2 instead of 0. = ============================================================= +vmware_record_panic_msg +======================= + +Controls whether panic kmsg data is written to the host's ``vmware.log``. +This setting does not control the separate VMware guest-crash event. + += ============================================================== +0 Do not write panic kmsg data to ``vmware.log``. This is the + default for encrypted guests. +1 Write panic kmsg data to ``vmware.log``. This is the default for + ordinary guests. += ============================================================== + + warn_limit ==========
arch/x86/kernel/cpu/vmware.c +23 -0
@@ -31,6 +31,7 @@#include <linux/efi.h> #include <linux/reboot.h> #include <linux/static_call.h> +#include <linux/sysctl.h> #include <linux/wordpart.h> #include <linux/sched/cputime.h> #include <asm/div64.h>
@@ -255,6 +256,19 @@ static int vmware_log_rpc(const char *buffer, size_t length) }static struct page *vmware_panic_page; +static int 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_dointvec_minmax, + .extra1 =SYSCTL_ZERO , + .extra2 =SYSCTL_ONE , + }, +};static void vmware_panic_log_dump (struct kmsg_dumper *dumper,struct kmsg_dump_detail *detail)
@@ -263,6 +277,9 @@ static void vmware_panic_log_dump(struct kmsg_dumper *dumper,char *buffer =page_address (vmware_panic_page);size_t length =0 ; +if (!READ_ONCE (vmware_record_panic_msg)) +return ; +memcpy (buffer,VMWARE_LOG_PREFIX ,VMWARE_LOG_PREFIX_LEN );kmsg_dump_rewind (&iter); (void)kmsg_dump_get_buffer(&iter, true,
@@ -283,6 +300,9 @@ static int __init vmware_panic_log_init(void)if (!hypervisor_is_type (X86_HYPER_VMWARE ))return 0 ; + vmware_record_panic_msg = + !cc_platform_has (CC_ATTR_GUEST_MEM_ENCRYPT ); + vmware_panic_page =alloc_page (GFP_KERNEL );if (!vmware_panic_page) {pr_err ("failed to allocate panic log buffer\n" );
@@ -295,6 +315,9 @@ static int __init vmware_panic_log_init(void)__free_page (vmware_panic_page); 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 ; }
Signature · 1 line
2.53.0
Re: [PATCH v1 2/4] x86/vmware: Add the vmware_record_panic_msg sysctl
Quoted 29 lines · Zack Rusin
Full panic text is useful on ordinary guests. Encrypted guests should export it only when an administrator opts in. Reporting a crash does not require transferring the log.
Enable panic recording by default for ordinary VMware guests and disable it when guest memory encryption is active. Expose the policy as the boolean kernel.vmware_record_panic_msg sysctl and document that it controls only the vmware.log transfer.
Register the sysctl only after the panic buffer and dumper are ready, and only when sysctl support is built. A registration failure leaves the internal default in force.
Signed-off-by Zack Rusin <[email protected]>--- Documentation/admin-guide/sysctl/kernel.rst | 14 +++++++++++++ arch/x86/kernel/cpu/vmware.c | 23 +++++++++++++++++++++ 2 files changed, 37 insertions(+)Documentation/admin-guide/sysctl/kernel.rst +2
-0@@ -1690,6 +1690,20 @@ entry will default to 2 instead of 0. = ============================================================= +vmware_record_panic_msg +=======================
Documentation/admin-guide/sysctl/kernel.rst entry will default to 2 instead of 0. · line 1704
Quoted 10 lines
Documentation/admin-guide/sysctl/kernel.rst +10
-0+ +Controls whether panic kmsg data is written to the host's ``vmware.log``. +This setting does not control the separate VMware guest-crash event. + += ============================================================== +0 Do not write panic kmsg data to ``vmware.log``. This is the + default for encrypted guests. +1 Write panic kmsg data to ``vmware.log``. This is the default for + ordinary guests. += ==============================================================
This seems like it can be represented in a boolean value. Any reason why you did not use proc_dobool for your handler? Would it make sense to have vmware_record_panic_msg as a boolean?
Best
Quoted 70 lines
Documentation/admin-guide/sysctl/kernel.rst +2
-0+ + warn_limit ==========arch/x86/kernel/cpu/vmware.c +23
-0@@ -31,6 +31,7 @@#include <linux/efi.h> #include <linux/reboot.h> #include <linux/static_call.h> +#include <linux/sysctl.h> #include <linux/wordpart.h> #include <linux/sched/cputime.h> #include <asm/div64.h> @@ -255,6 +256,19 @@ static int vmware_log_rpc(const char *buffer, size_t length) }static struct page *vmware_panic_page; +static int 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_dointvec_minmax, + .extra1 =SYSCTL_ZERO , + .extra2 =SYSCTL_ONE , + }, +};static void vmware_panic_log_dump (struct kmsg_dumper *dumper,struct kmsg_dump_detail *detail)@@ -263,6 +277,9 @@ static void vmware_panic_log_dump(struct kmsg_dumper *dumper,char *buffer =page_address (vmware_panic_page);size_t length =0 ; +if (!READ_ONCE (vmware_record_panic_msg)) +return ; +memcpy (buffer,VMWARE_LOG_PREFIX ,VMWARE_LOG_PREFIX_LEN );kmsg_dump_rewind (&iter); (void)kmsg_dump_get_buffer(&iter, true,@@ -283,6 +300,9 @@ static int __init vmware_panic_log_init(void)if (!hypervisor_is_type (X86_HYPER_VMWARE ))return 0 ; + vmware_record_panic_msg = + !cc_platform_has (CC_ATTR_GUEST_MEM_ENCRYPT ); + vmware_panic_page =alloc_page (GFP_KERNEL );if (!vmware_panic_page) {pr_err ("failed to allocate panic log buffer\n" );@@ -295,6 +315,9 @@ static int __init vmware_panic_log_init(void)__free_page (vmware_panic_page); 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 ; }Signature · 1 line
2.53.0
Re: [PATCH v1 2/4] x86/vmware: Add the vmware_record_panic_msg sysctl
Quoted 29 lines · Joel Granados
Quoted 27 lines · Zack Rusin
Full panic text is useful on ordinary guests. Encrypted guests should export it only when an administrator opts in. Reporting a crash does not require transferring the log.
Enable panic recording by default for ordinary VMware guests and disable it when guest memory encryption is active. Expose the policy as the boolean kernel.vmware_record_panic_msg sysctl and document that it controls only the vmware.log transfer.
Register the sysctl only after the panic buffer and dumper are ready, and only when sysctl support is built. A registration failure leaves the internal default in force.
Signed-off-by Zack Rusin <[email protected]>--- Documentation/admin-guide/sysctl/kernel.rst | 14 +++++++++++++ arch/x86/kernel/cpu/vmware.c | 23 +++++++++++++++++++++ 2 files changed, 37 insertions(+)Documentation/admin-guide/sysctl/kernel.rst +0
-0@@ -1690,6 +1690,20 @@ entry will default to 2 instead of 0. = =============================================================
Quoted 16 lines
Documentation/admin-guide/sysctl/kernel.rst entry will default to 2 instead of 0. · line 1704
Quoted 12 lines
Documentation/admin-guide/sysctl/kernel.rst +12
-0+vmware_record_panic_msg +======================= + +Controls whether panic kmsg data is written to the host's ``vmware.log``. +This setting does not control the separate VMware guest-crash event. + += ============================================================== +0 Do not write panic kmsg data to ``vmware.log``. This is the + default for encrypted guests. +1 Write panic kmsg data to ``vmware.log``. This is the default for + ordinary guests. += ==============================================================This seems like it can be represented in a boolean value. Any reason why you did not use
proc_doboolfor your handler? Would it make sense to havevmware_record_panic_msgas a boolean?
Thank you for taking a look! This follows the existing Hyper-V implementation of hyperv_record_panic_msg, which uses an int and proc_dointvec_minmax with 0/1 bounds. I thought that consistency across the codebase was more important even though I agree that bool and proc_dobool() would be a better fit.
z
Re: [PATCH v1 2/4] x86/vmware: Add the vmware_record_panic_msg sysctl
Quoted 48 lines · Zack Rusin
Quoted 29 lines · Joel Granados
Quoted 27 lines · Zack Rusin
Full panic text is useful on ordinary guests. Encrypted guests should export it only when an administrator opts in. Reporting a crash does not require transferring the log.
Enable panic recording by default for ordinary VMware guests and disable it when guest memory encryption is active. Expose the policy as the boolean kernel.vmware_record_panic_msg sysctl and document that it controls only the vmware.log transfer.
Register the sysctl only after the panic buffer and dumper are ready, and only when sysctl support is built. A registration failure leaves the internal default in force.
Signed-off-by Zack Rusin <[email protected]>--- Documentation/admin-guide/sysctl/kernel.rst | 14 +++++++++++++ arch/x86/kernel/cpu/vmware.c | 23 +++++++++++++++++++++ 2 files changed, 37 insertions(+)Documentation/admin-guide/sysctl/kernel.rst +0
-0@@ -1690,6 +1690,20 @@ entry will default to 2 instead of 0. = =============================================================Quoted 16 lines
Documentation/admin-guide/sysctl/kernel.rst entry will default to 2 instead of 0. · line 1704
Quoted 12 lines
Documentation/admin-guide/sysctl/kernel.rst +12
-0+vmware_record_panic_msg +======================= + +Controls whether panic kmsg data is written to the host's ``vmware.log``. +This setting does not control the separate VMware guest-crash event. + += ============================================================== +0 Do not write panic kmsg data to ``vmware.log``. This is the + default for encrypted guests. +1 Write panic kmsg data to ``vmware.log``. This is the default for + ordinary guests. += ==============================================================This seems like it can be represented in a boolean value. Any reason why you did not use
proc_doboolfor your handler? Would it make sense to havevmware_record_panic_msgas a boolean?
Quoted 5 lines
Thank you for taking a look! This follows the existing Hyper-V implementation of
hyperv_record_panic_msg, which uses an int andproc_dointvec_minmaxwith 0/1 bounds. I thought that consistency across the codebase was more important even though I agree that bool andproc_dobool()would be a better fit.
I've been thinking about it and the more I look at this code the more I feel like respinning v2 and changing vmware_record_panic_msg to bool. Because kernel.hyperv.record_panic_msg is already in, I'm worried that if I'll do someone might object based on the fact that the same option for hyperv behaves differenty introducing a subtle inconsistency. Any strong opinions on that before I go ahead and make that change?
z
PATCH 3/4 x86/vmware: Report guest crashes after kmsg dumpers
In reply to Zack RusinVMware accepts a structured guest-crash event, but a host configured with backdoor.coredumpOnCrash may terminate the VM before the hypercall returns. Sending the event from a panic notifier could prevent later kmsg dumpers and a loaded crash kernel from running.
Register a second panic-only kmsg dumper with late_initcall_sync(). Kmsg dumpers run in registration order, placing the report after the early VMware logger and built-in dumpers registered by then. This leaves no report before the late initcall, but avoids losing dump output to a terminating host.
Skip the event when a crash kernel is loaded. The earlier logger can still write panic text to vmware.log before __crash_kexec(). If kdump later fails, no structured event is sent; issuing it first could prevent kdump from running at all.
Issue the event at most once. With CONFIG_PRINTK=n, install a late INT_MIN panic notifier. An unexpected dumper registration failure with printk enabled leaves reporting disabled because a notifier fallback would overtake working dumpers.
--- arch/x86/include/asm/vmware.h | 1 + arch/x86/kernel/cpu/vmware.c | 63 +++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+)
arch/x86/include/asm/vmware.h +1 -0
@@ -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 +63 -0
79 lines not on this page · raw message
Signature · 1 line
2.53.0
PATCH 4/4 x86/vmware: Run panic diagnostics before kdump by default
In reply to Zack RusinThe core panic path enters a loaded crash kernel before running kmsg dumpers, so the VMware logger cannot preserve the panic in the host log. Set crash_kexec_post_notifiers during VMware platform setup. setup_arch() runs before ordinary core parameters are parsed, so an explicit crash_kexec_post_notifiers=0 still overrides this default. The 0644 parameter also remains writable at runtime.
VMware exposes no capability bit for this behavior, so the default changes for every VMware guest. Running the logger first adds work to the panic path and can reduce kdump reliability.
A full log transfer uses 1027 low-bandwidth hypercalls; three checkpoint attempts are bounded at 3077. In vmcall tests, a maximum-size transfer took at most 7.47 ms; three complete transfers comprising 3081 calls took at most 21.58 ms.
The crash report remains suppressed while a crash kernel is loaded because the host may terminate the VM inside that call. A future report from the crash kernel or kdump userspace can restore the event after saving the vmcore.
--- arch/x86/kernel/cpu/vmware.c | 1 + 1 file changed, 1 insertion(+)
arch/x86/kernel/cpu/vmware.c +1 -0
@@ -646,6 +646,7 @@ static void __init vmware_platform_setup(void) {u32 eax, ebx, ecx;u64 lpj, tsc_khz; + crash_kexec_post_notifiers = true; eax =vmware_hypercall3 (VMWARE_CMD_GETHZ ,UINT_MAX , &ebx, &ecx);
Signature · 1 line
2.53.0
Re: [PATCH v1 4/4] x86/vmware: Run panic diagnostics before kdump by default
Adding Guilherme G. Piccoli into Cc.
Quoted 10 lines · Zack Rusin
The core panic path enters a loaded crash kernel before running kmsg dumpers, so the VMware logger cannot preserve the panic in the host log. Set
crash_kexec_post_notifiersduring VMware platform setup.setup_arch()runs before ordinary core parameters are parsed, so an explicit crash_kexec_post_notifiers=0 still overrides this default. The 0644 parameter also remains writable at runtime.VMware exposes no capability bit for this behavior, so the default changes for every VMware guest. Running the logger first adds work to the panic path and can reduce kdump reliability.
AFAIK, the quality of the notifiers is varying. Running all notifiers might reduce the kdump reliability even more.
I do not like much the hack with crash_kexec_post_notifiers. It is an all or nothing option.
Also it was introduced as a quick hack so that users could decide what is more important for them. But it is not longer a "user" decision when some platforms enforce the ordering because they depend on the notifier.
panic() is problematic and it is about compromises. And we need to balance what is important, what is safe, and what is optional. This is why I suggested to introduce more notifiers some time ago, see https://lore.kernel.org/lkml/YfPxvzSzDLjO5ldp@alley/
Guillermo implemented this, see
https://lore.kernel.org/all/[email protected]/
But it has stalled because it touched too many subsystems and it was hard to get an agreement.
Maybe, we should start with something simple, and introduce one more panic notifier as a start. It might be called either:
+ "panic_hypervisor_list" because "crash_kexec_post_notifiers = true" seems to be primary set on hypervisors.
But I would rather make it more generic and call it
+ panic_pre_crash_kexec or panic_pre_kdump because there might be more notifiers which are either 100% safe and useful or are worth the risk before calling crash dump.
We could put there x86/vmware notifiers as a start. And we could later move there other important notifiers.
How does that sound, please?
Quoted 9 lines
A full log transfer uses 1027 low-bandwidth hypercalls; three checkpoint attempts are bounded at 3077. In vmcall tests, a maximum-size transfer took at most 7.47 ms; three complete transfers comprising 3081 calls took at most 21.58 ms.
The crash report remains suppressed while a crash kernel is loaded because the host may terminate the VM inside that call. A future report from the crash kernel or kdump userspace can restore the event after saving the vmcore.
Best Regards,
Petr
Re: [PATCH v1 4/4] x86/vmware: Run panic diagnostics before kdump by default
Quoted 44 lines · Petr Mladek
Adding Guilherme G. Piccoli into Cc.
Quoted 10 lines · Zack Rusin
The core panic path enters a loaded crash kernel before running kmsg dumpers, so the VMware logger cannot preserve the panic in the host log. Set
crash_kexec_post_notifiersduring VMware platform setup.setup_arch()runs before ordinary core parameters are parsed, so an explicit crash_kexec_post_notifiers=0 still overrides this default. The 0644 parameter also remains writable at runtime.VMware exposes no capability bit for this behavior, so the default changes for every VMware guest. Running the logger first adds work to the panic path and can reduce kdump reliability.
AFAIK, the quality of the notifiers is varying. Running all notifiers might reduce the kdump reliability even more.
I do not like much the hack with
crash_kexec_post_notifiers. It is an all or nothing option.Also it was introduced as a quick hack so that users could decide what is more important for them. But it is not longer a "user" decision when some platforms enforce the ordering because they depend on the notifier.
panic()is problematic and it is about compromises. And we need to balance what is important, what is safe, and what is optional. This is why I suggested to introduce more notifiers some time ago, see https://lore.kernel.org/lkml/YfPxvzSzDLjO5ldp@alley/Guillermo implemented this, see
https://lore.kernel.org/all/[email protected]/
But it has stalled because it touched too many subsystems and it was hard to get an agreement.Maybe, we should start with something simple, and introduce one more panic notifier as a start. It might be called either:
+ "
panic_hypervisor_list" because "crash_kexec_post_notifiers= true" seems to be primary set on hypervisors.But I would rather make it more generic and call it
Quoted 8 lines
+
panic_pre_crash_kexecorpanic_pre_kdumpbecause there might be more notifiers which are either 100% safe and useful or are worth the risk before calling crash dump.We could put there x86/vmware notifiers as a start. And we could later move there other important notifiers.
How does that sound, please?
afaict that sounds good. Keeping it to one new list and one client should make it manageable to review (which is my biggest worry :) ).
As so the implementation: I'll drop VMware's crash_kexec_post_notifiers default and start with one generic panic_pre_kdump_list, with only the VMware log sender on it. The structured crash-report hypercall (REPORTGUESTCRASH) can terminate the VM, so it stays late and remains suppressed when a crash kernel is loaded. Log transfer is still controlled by kernel.vmware_record_panic_msg, with encrypted guests defaulting to off.
I think that without that default though, x86 oops_end() can enter crash_kexec(regs) before reaching panic(), for example with panic_on_oops=1. To cover that path too, I'd call the chain from __crash_kexec() after the image check and register capture, under the existing kexec lock. A second call in vpanic(), immediately before kmsg_dump_desc(), would cover the fallback path. And I think a set-once guard would prevent duplicate or recursive dispatch.
That leaves CPU-stop and ordinary notifier ordering unchanged. The logger would read the kmsg buffer directly, without invoking the other dumpers, and would need to tolerate NMI context and other CPUs still running. I'll keep the crash-core call in a separate patch for kdump review, leaving other clients for follow-ups.
Does that sound good to you?
z
Re: [PATCH v1 4/4] x86/vmware: Run panic diagnostics before kdump by default
Hi Petr, Zack - thanks for CCing me!
Some comments below:
Quoted 9 lines · Zack Rusin
Quoted 9 lines
[...]
Maybe, we should start with something simple, and introduce one more panic notifier as a start. It might be called either:+ "
panic_hypervisor_list" because "crash_kexec_post_notifiers= true" seems to be primary set on hypervisors.But I would rather make it more generic and call it
Quoted 9 lines
Quoted 8 lines
+
panic_pre_crash_kexecorpanic_pre_kdumpbecause there might be more notifiers which are either 100% safe and useful or are worth the risk before calling crash dump.We could put there x86/vmware notifiers as a start. And we could later move there other important notifiers.
How does that sound, please?
It's a good idea, IMO. We could start with this, Zach commented some implementation details below...and after it gets merged, we could move other hypervisors that currently set "crash_kexec_post_notifiers" to this list and eventually, unexport this symbol. We should avoid having code forcing this parameter, as Petr said, many notifiers are executed if that is set.
(I'm CCing Stephen Brennan here, I recall he had problems with this being auto-set, we talked about that in the panic notifiers big discussions in the past heh)
The only thing I'd like to suggest: I think we should have a parameter that disables running this list, which would be the opposite of "crash_kexec_post_notifiers".
I would implement it as something like: "postpone_pre_kexec_notifiers" or something like that. The parameter would basically "move" this list execution to the same time as the current notifiers, gating them to "crash_kexec_post_notifiers". This way, we'd allow users to debug kexec failures maybe related to the "early" notifiers. WDYT?
Quoted 9 lines
[...]
I think that without that default though, x86oops_end()can entercrash_kexec(regs)before reachingpanic(), for example with panic_on_oops=1. To cover that path too, I'd call the chain from__crash_kexec()after the image check and register capture, under the existing kexec lock. A second call invpanic(), immediately beforekmsg_dump_desc(), would cover the fallback path. And I think a set-once guard would prevent duplicate or recursive dispatch.
Regarding this, 2 things:
a) I think you could change kexec_should_crash() to "return 0" also in case the new list is set to run, the same is done currently for "crash_kexec_post_notifiers". Makes sense?
b) Well, does this whole panic diag thing you're implementing here aims only at x86 guests ? Or would it be possible to run, for example, arm64 guests? Asking this because in x86 and some other architectures (but not arm64[0]), it's possible to override machine_crash_shutdown() handler, and run things prior to a kexec. Take a look on how Hyper-V does that on arch/x86 - this could be just what you need, except if you plan to have it for all architectures heh
Finally, if possible please keep me looped in the following patches, I'm very interested on that =)
Cheers,
Guilherme
Re: [PATCH v1 4/4] x86/vmware: Run panic diagnostics before kdump by default
Quoted 3 lines · Guilherme G. Piccoli
Hi Petr, Zack - thanks for CCing me!
Some comments below:
Hi, Guilherme.
Thanks for looking at this and for adding Stephen. I'll keep you both copied.
Quoted 20 lines · Zack Rusin
Quoted 9 lines
Quoted 9 lines
[...]
Maybe, we should start with something simple, and introduce one more panic notifier as a start. It might be called either:+ "
panic_hypervisor_list" because "crash_kexec_post_notifiers= true" seems to be primary set on hypervisors.But I would rather make it more generic and call it
Quoted 9 lines
Quoted 8 lines
+
panic_pre_crash_kexecorpanic_pre_kdumpbecause there might be more notifiers which are either 100% safe and useful or are worth the risk before calling crash dump.We could put there x86/vmware notifiers as a start. And we could later move there other important notifiers.
How does that sound, please?
Quoted 6 lines
It's a good idea, IMO. We could start with this, Zach commented some implementation details below...and after it gets merged, we could move other hypervisors that currently set "
crash_kexec_post_notifiers" to this list and eventually, unexport this symbol. We should avoid having code forcing this parameter, as Petr said, many notifiers are executed if that is set.
Agreed. The v2 I'm working on drops VMware's assignment to crash_kexec_post_notifiers and leaves the existing setting unchanged.
Quoted 8 lines
(I'm CCing Stephen Brennan here, I recall he had problems with this being auto-set, we talked about that in the panic notifiers big discussions in the past heh)
The only thing I'd like to suggest: I think we should have a parameter that disables running this list, which would be the opposite of "
crash_kexec_post_notifiers".
Quoted 5 lines
I would implement it as something like: "
postpone_pre_kexec_notifiers" or something like that. The parameter would basically "move" this list execution to the same time as the current notifiers, gating them to "crash_kexec_post_notifiers". This way, we'd allow users to debug kexec failures maybe related to the "early" notifiers. WDYT?
I'm happy to add that as a separate patch if Petr agrees. With it set, the new list would follow ordinary panic-notifier ordering relative to
kdump: it would run before a successful transition only when crash_kexec_post_notifiers is also set. If panic reaches the late site, the list would remain eligible to run there. I'd keep that site after sys_info() and before the kmsg dumpers so the log includes the additional notifier and panic_print output available at that point.
I've called it panic_pre_kdump_postpone after the list, but I'm fine with whatever name you and Petr prefer.
Quoted 10 lines
Quoted 9 lines
[...]
I think that without that default though, x86oops_end()can entercrash_kexec(regs)before reachingpanic(), for example with panic_on_oops=1. To cover that path too, I'd call the chain from__crash_kexec()after the image check and register capture, under the existing kexec lock. A second call invpanic(), immediately beforekmsg_dump_desc(), would cover the fallback path. And I think a set-once guard would prevent duplicate or recursive dispatch.
Quoted 5 lines
Regarding this, 2 things:
a) I think you could change
kexec_should_crash()to "return 0" also in case the new list is set to run, the same is done currently for "crash_kexec_post_notifiers". Makes sense?
I'd prefer to leave kexec_should_crash() unchanged. The direct oops path supplies the exception registers to crash_kexec(regs), while routing it through panic() would capture later state instead. In my early v2 tests, the vmcores from the direct-oops path retain the original fault registers in the crash notes. Some crash callers, for example uv_nmi_kdump(), also bypass kexec_should_crash(). Calling the chain from __crash_kexec() after register capture covers those paths without changing their routing, and the shared once-only guard prevents duplicate or recursive dispatch.
Quoted 7 lines
b) Well, does this whole panic diag thing you're implementing here aims only at x86 guests ? Or would it be possible to run, for example, arm64 guests? Asking this because in x86 and some other architectures (but not arm64[0]), it's possible to override
machine_crash_shutdown()handler, and run things prior to a kexec. Take a look on how Hyper-V does that onarch/x86- this could be just what you need, except if you plan to have it for all architectures heh
I'd like to support arm64 guests in the near future, but I figured especially for review sake to limit our client in this series to x86. So I prefer the common chain Petr proposed: as the thread you linked shows, arm64 deliberately has no such override, and the chain gives other clients a place to migrate away from forcing crash_kexec_post_notifiers.
Would keeping the two call sites, with postponement in a separate patch, work for you and Petr?
z
Re: [PATCH v1 4/4] x86/vmware: Run panic diagnostics before kdump by default
Quoted 5 lines · Zack Rusin
[...]
Hi, Guilherme.Thanks for looking at this and for adding Stephen. I'll keep you both copied.
Hi Zach, thanks!
Quoted 9 lines
[...]
I'm happy to add that as a separate patch if Petr agrees. With it set, the new list would follow ordinary panic-notifier ordering relative to
kdump: it would run before a successful transition only whencrash_kexec_post_notifiersis also set. If panic reaches the late site, the list would remain eligible to run there. I'd keep that site aftersys_info()and before the kmsg dumpers so the log includes the additional notifier andpanic_printoutput available at that point.
Quoted 3 lines
I've called it
panic_pre_kdump_postponeafter the list, but I'm fine with whatever name you and Petr prefer.
Cool, makes sense to me and feel free to change names, I'm OK with any name heheh
Quoted 4 lines
[...]
Would keeping the two call sites, with postponement in a separate patch, work for you and Petr?
Fine for me - thanks for working on that!
Cheers,
Guilherme
Re: [PATCH v1 4/4] x86/vmware: Run panic diagnostics before kdump by default
In reply to Zack RusinQuoted 62 lines · Zack Rusin
Quoted 3 lines · Guilherme G. Piccoli
Hi Petr, Zack - thanks for CCing me!
Some comments below:Hi, Guilherme.
Thanks for looking at this and for adding Stephen. I'll keep you both copied.
Quoted 20 lines · Zack Rusin
Quoted 9 lines
Quoted 9 lines
[...]
Maybe, we should start with something simple, and introduce one more panic notifier as a start. It might be called either:+ "
panic_hypervisor_list" because "crash_kexec_post_notifiers= true" seems to be primary set on hypervisors.But I would rather make it more generic and call it
Quoted 9 lines
Quoted 8 lines
+
panic_pre_crash_kexecorpanic_pre_kdumpbecause there might be more notifiers which are either 100% safe and useful or are worth the risk before calling crash dump.We could put there x86/vmware notifiers as a start. And we could later move there other important notifiers.
How does that sound, please?
Quoted 6 lines
It's a good idea, IMO. We could start with this, Zach commented some implementation details below...and after it gets merged, we could move other hypervisors that currently set "
crash_kexec_post_notifiers" to this list and eventually, unexport this symbol. We should avoid having code forcing this parameter, as Petr said, many notifiers are executed if that is set.Agreed. The v2 I'm working on drops VMware's assignment to
crash_kexec_post_notifiersand leaves the existing setting unchanged.Quoted 8 lines
(I'm CCing Stephen Brennan here, I recall he had problems with this being auto-set, we talked about that in the panic notifiers big discussions in the past heh)
The only thing I'd like to suggest: I think we should have a parameter that disables running this list, which would be the opposite of "
crash_kexec_post_notifiers".Quoted 5 lines
I would implement it as something like: "
postpone_pre_kexec_notifiers" or something like that. The parameter would basically "move" this list execution to the same time as the current notifiers, gating them to "crash_kexec_post_notifiers". This way, we'd allow users to debug kexec failures maybe related to the "early" notifiers. WDYT?I'm happy to add that as a separate patch if Petr agrees. With it set, the new list would follow ordinary panic-notifier ordering relative to
kdump: it would run before a successful transition only whencrash_kexec_post_notifiersis also set. If panic reaches the late site, the list would remain eligible to run there. I'd keep that site aftersys_info()and before the kmsg dumpers so the log includes the additional notifier andpanic_printoutput available at that point.
Quoted 2 lines
I've called it
panic_pre_kdump_postponeafter the list, but I'm fine with whatever name you and Petr prefer.
I do not have strong opinion whether we need the new parameter. It is rather a call for kexec/crash_dump maintainers.
But if we added it, we should make it clear that it is intended for debugging of kexec/crash_dump failures. And that it might prevent correct handling of the crash on hypervisors side.
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
[...]
I think that without that default though, x86oops_end()can entercrash_kexec(regs)before reachingpanic(), for example with panic_on_oops=1. To cover that path too, I'd call the chain from__crash_kexec()after the image check and register capture, under the existing kexec lock. A second call invpanic(), immediately beforekmsg_dump_desc(), would cover the fallback path. And I think a set-once guard would prevent duplicate or recursive dispatch.
Quoted 5 lines
Quoted 5 lines
Regarding this, 2 things:
a) I think you could change
kexec_should_crash()to "return 0" also in case the new list is set to run, the same is done currently for "crash_kexec_post_notifiers". Makes sense?
Honestly, it does not make sense to me ;-) My understanding is that the new list would allow to run kexec/crash_dump a safe way under a hypervisor. So, it should be safe to do it directly in oops_end().
Quoted 9 lines
I'd prefer to leave
kexec_should_crash()unchanged. The direct oops path supplies the exception registers tocrash_kexec(regs), while routing it throughpanic()would capture later state instead. In my early v2 tests, the vmcores from the direct-oops path retain the original fault registers in the crash notes. Some crash callers, for exampleuv_nmi_kdump(), also bypasskexec_should_crash(). Calling the chain from__crash_kexec()after register capture covers those paths without changing their routing, and the shared once-only guard prevents duplicate or recursive dispatch.
Makes sense to me.
Quoted 8 lines
Quoted 7 lines
b) Well, does this whole panic diag thing you're implementing here aims only at x86 guests ? Or would it be possible to run, for example, arm64 guests? Asking this because in x86 and some other architectures (but not arm64[0]), it's possible to override
machine_crash_shutdown()handler, and run things prior to a kexec. Take a look on how Hyper-V does that onarch/x86- this could be just what you need, except if you plan to have it for all architectures heh
Quoted 6 lines
I'd like to support arm64 guests in the near future, but I figured especially for review sake to limit our client in this series to x86. So I prefer the common chain Petr proposed: as the thread you linked shows, arm64 deliberately has no such override, and the chain gives other clients a place to migrate away from forcing
crash_kexec_post_notifiers.
Sounds good to me. Let's start simple. ;-)
Best Regards,
Petr
Re: [PATCH v1 4/4] x86/vmware: Run panic diagnostics before kdump by default
In reply to Guilherme G. PiccoliQuoted 35 lines · Guilherme G. Piccoli
This Message Is From an External Sender
This message came from outside your organization.
Report SuspiciousHi Petr, Zack - thanks for CCing me!
Some comments below:Quoted 9 lines · Zack Rusin
Quoted 9 lines
[...]
Maybe, we should start with something simple, and introduce one more panic notifier as a start. It might be called either:+ "
panic_hypervisor_list" because "crash_kexec_post_notifiers= true" seems to be primary set on hypervisors.But I would rather make it more generic and call it
Quoted 9 lines
Quoted 8 lines
+
panic_pre_crash_kexecorpanic_pre_kdumpbecause there might be more notifiers which are either 100% safe and useful or are worth the risk before calling crash dump.We could put there x86/vmware notifiers as a start. And we could later move there other important notifiers.
How does that sound, please?
It's a good idea, IMO. We could start with this, Zach commented some implementation details below...and after it gets merged, we could move other hypervisors that currently set "
crash_kexec_post_notifiers" to this list and eventually, unexport this symbol. We should avoid having code forcing this parameter, as Petr said, many notifiers are executed if that is set.
Quoted 3 lines
(I'm CCing Stephen Brennan here, I recall he had problems with this being auto-set, we talked about that in the panic notifiers big discussions in the past heh)
Hi Guilherme, thanks for CCing me! You're right, I'm interested too :D Your email arrived on the first day of my vacation, so I'm sorry for the delayed response.
I like the above idea, starting simple with a second list for the notifiers which are straightforward and have an urgent need to run.
My previous complaints were with code overriding crash_kexec_post_notifiers, because that really interferes with your mental model when debugging panic/kdump issues. Having two notifier lists is a reasonable mental model, or at least more understandable than silently and unconditionally modifying crash_kexec_post_notifiers.
I like the name "panic_pre_kdump" for my own tastes, though n==1 on that.
I do think we're going to have trouble articulating exactly what are the criteria for a "pre_kdump" notifier vs a "panic" notifier? Anyone submitting a patch believes their notifier is important, so of course they believe it belongs on the pre_kdump list! How will we draw the line in the future?
- Is it safety? As in "the notifier doesn't take any locks"? I feel this should be part of the criteria. (Though I have never been successful in predicting what code would cause a kdump/panic failure)
- Is it urgency? As in "without this, the expected behavior of the system during a panic will not occur".
- Is it the fact that the notifier is communicating with the hypervisor?
From my perspective: informing the hypervisor of a panic is both safe and urgent. If the hypervisor is configured to immediately halt and do its own panic handling, great.
Providing the last 4KB of logs seems less safe and less urgent (though obviously still immensely helpful). The kernel provides a huge variety of consoles through which the hypervisor could have already received these logs. If the system is configured not to use them... it seems the tradeoff to not be debuggable has already been made :P
To me, that logic belongs in a standard panic notifier.
Plenty of people will likely disagree with me on that, but that's why it would be helpful to have clarity on what separates pre_kdump from standard panic notifiers.
Quoted 9 lines
The only thing I'd like to suggest: I think we should have a parameter that disables running this list, which would be the opposite of "
crash_kexec_post_notifiers".I would implement it as something like: "
postpone_pre_kexec_notifiers" or something like that. The parameter would basically "move" this list execution to the same time as the current notifiers, gating them to "crash_kexec_post_notifiers". This way, we'd allow users to debug kexec failures maybe related to the "early" notifiers. WDYT?
Agreed for precisely the reason I said above: it's difficult to predict which notifier is going to cause a problem. Having an escape hatch to change this behavior without rebuilding a production kernel is critical, IMO.
Thanks,
Stephen
Quoted 35 lines
Quoted 10 lines
[...]
I think that without that default though, x86oops_end()can entercrash_kexec(regs)before reachingpanic(), for example with panic_on_oops=1. To cover that path too, I'd call the chain from__crash_kexec()after the image check and register capture, under the existing kexec lock. A second call invpanic(), immediately beforekmsg_dump_desc(), would cover the fallback path. And I think a set-once guard would prevent duplicate or recursive dispatch.Regarding this, 2 things:
a) I think you could change
kexec_should_crash()to "return 0" also in case the new list is set to run, the same is done currently for "crash_kexec_post_notifiers". Makes sense?b) Well, does this whole panic diag thing you're implementing here aims only at x86 guests ? Or would it be possible to run, for example, arm64 guests? Asking this because in x86 and some other architectures (but not arm64[0]), it's possible to override
machine_crash_shutdown()handler, and run things prior to a kexec. Take a look on how Hyper-V does that onarch/x86- this could be just what you need, except if you plan to have it for all architectures hehFinally, if possible please keep me looped in the following patches, I'm very interested on that =)
Cheers,Guilherme
Re: [PATCH v1 4/4] x86/vmware: Run panic diagnostics before kdump by default
Quoted 4 lines · Stephen Brennan
[...]
Hi Guilherme, thanks for CCing me! You're right, I'm interested too :D Your email arrived on the first day of my vacation, so I'm sorry for the delayed response.
Hi Stephen! Nice talking to you =)
No worries at all, this is also conference season heh
Quoted 14 lines
[...]
I do think we're going to have trouble articulating exactly what are the criteria for a "pre_kdump" notifier vs a "panic" notifier? Anyone submitting a patch believes their notifier is important, so of course they believe it belongs on thepre_kdumplist! How will we draw the line in the future?- Is it safety? As in "the notifier doesn't take any locks"? I feel this should be part of the criteria. (Though I have never been successful in predicting what code would cause a kdump/panic failure)
- Is it urgency? As in "without this, the expected behavior of the system during a panic will not occur".
- Is it the fact that the notifier is communicating with the hypervisor?
Quoted 4 lines
From my perspective: informing the hypervisor of a panic is both safe and urgent. If the hypervisor is configured to immediately halt and do its own panic handling, great.
This is a very good point. What is the criteria? I honestly don't know...I think hypervisor-related things, that are safe (as you put) makes sense. Anything that might also make kdump work more reliably, and is safe as well...but everyone will judge their notifier important, in the end heh
Quoted 11 lines
Providing the last 4KB of logs seems less safe and less urgent (though obviously still immensely helpful). The kernel provides a huge variety of consoles through which the hypervisor could have already received these logs. If the system is configured not to use them... it seems the tradeoff to not be debuggable has already been made :P
To me, that logic belongs in a standard panic notifier.Plenty of people will likely disagree with me on that, but that's why it would be helpful to have clarity on what separates
pre_kdumpfrom standard panic notifiers.
But at the same time ... there's something else, the "self-contained" nature of hypervisor-related notifiers. This one is restricted for vmware only, so personally, I think it's not a super biggie to run it early. It is, in the end, a decision of vmware stakeholders. If that would be an arch notifier, something that all arm64 users would necessarily run, for example, I'd be way more skeptic on putting it early.
Anyway, not sure if I helped or if I contributed nothing to the criteria discussion heheh
But I hope to see this discussion happening, maybe should also gets documented as part of future Zach's patch iteration as well. Cheers,
Guilherme
Re: [PATCH v1 4/4] x86/vmware: Run panic diagnostics before kdump by default
In reply to Stephen BrennanQuoted 80 lines · Stephen Brennan
Quoted 35 lines · Guilherme G. Piccoli
This Message Is From an External Sender
This message came from outside your organization.
Report SuspiciousHi Petr, Zack - thanks for CCing me!
Some comments below:Quoted 9 lines · Zack Rusin
Quoted 9 lines
[...]
Maybe, we should start with something simple, and introduce one more panic notifier as a start. It might be called either:+ "
panic_hypervisor_list" because "crash_kexec_post_notifiers= true" seems to be primary set on hypervisors.But I would rather make it more generic and call it
Quoted 9 lines
Quoted 8 lines
+
panic_pre_crash_kexecorpanic_pre_kdumpbecause there might be more notifiers which are either 100% safe and useful or are worth the risk before calling crash dump.We could put there x86/vmware notifiers as a start. And we could later move there other important notifiers.
How does that sound, please?
It's a good idea, IMO. We could start with this, Zach commented some implementation details below...and after it gets merged, we could move other hypervisors that currently set "
crash_kexec_post_notifiers" to this list and eventually, unexport this symbol. We should avoid having code forcing this parameter, as Petr said, many notifiers are executed if that is set.Quoted 3 lines
(I'm CCing Stephen Brennan here, I recall he had problems with this being auto-set, we talked about that in the panic notifiers big discussions in the past heh)
Hi Guilherme, thanks for CCing me! You're right, I'm interested too :D Your email arrived on the first day of my vacation, so I'm sorry for the delayed response.
I like the above idea, starting simple with a second list for the notifiers which are straightforward and have an urgent need to run.
My previous complaints were with code overriding
crash_kexec_post_notifiers, because that really interferes with your mental model when debugging panic/kdump issues. Having two notifier lists is a reasonable mental model, or at least more understandable than silently and unconditionally modifyingcrash_kexec_post_notifiers.I like the name "
panic_pre_kdump" for my own tastes, though n==1 on that.I do think we're going to have trouble articulating exactly what are the criteria for a "
pre_kdump" notifier vs a "panic" notifier? Anyone submitting a patch believes their notifier is important, so of course they believe it belongs on thepre_kdumplist! How will we draw the line in the future?- Is it safety? As in "the notifier doesn't take any locks"? I feel this should be part of the criteria. (Though I have never been successful in predicting what code would cause a kdump/panic failure)
- Is it urgency? As in "without this, the expected behavior of the system during a panic will not occur".
- Is it the fact that the notifier is communicating with the hypervisor?Quoted 1 line
From my perspective: informing the hypervisor of a panic is both safe
and urgent. If the hypervisor is configured to immediately halt and do its own panic handling, great.
Providing the last 4KB of logs seems less safe and less urgent (though obviously still immensely helpful). The kernel provides a huge variety of consoles through which the hypervisor could have already received these logs. If the system is configured not to use them... it seems the tradeoff to not be debuggable has already been made :P
To me, that logic belongs in a standard panic notifier.
Quoted 3 lines
Plenty of people will likely disagree with me on that, but that's why it would be helpful to have clarity on what separates
pre_kdumpfrom standard panic notifiers.
The rule of thumb might be. If you think about setting
"crash_kexec_post_notifiers = true"
because the notifier is required for a successful boot of the crash kernel or successful reboot after the crash dump. Then put it into "panic_pre_kdump" notifier list and keep crash_kexec_post_notifiers disabled by default. Otherwise, put the notifier into the normal "panic_notifier_list".
I agree that people might still want to cheat and put their pet into the pre_kdump list even when it is not strictly needed. This is why my original proposal suggested 4 lists. But maybe 3 list might be enough:
+ panic_pre_kdump_notifier_list: for the "must-to-have" stuff. It ideally should be 100% safe.
+ panic_notifier_list_safe: for dumping extra information where the code is 100% safe (modulo bugs). It means no locks, no waiting, no blocking HW access, ...
+ panic_notifier_list_unsafe: for dumping extra information which is not 100% safe, aka using trylock, potentially dangerous HW manipulation, ...
By default, the first two "safe" lists would run before the kdump, and the unsafe one would run after the kdump.
Does it make sense?
Quoted 10 lines
Quoted 9 lines
The only thing I'd like to suggest: I think we should have a parameter that disables running this list, which would be the opposite of "
crash_kexec_post_notifiers".I would implement it as something like: "
postpone_pre_kexec_notifiers" or something like that. The parameter would basically "move" this list execution to the same time as the current notifiers, gating them to "crash_kexec_post_notifiers". This way, we'd allow users to debug kexec failures maybe related to the "early" notifiers. WDYT?
Quoted 4 lines
Agreed for precisely the reason I said above: it's difficult to predict which notifier is going to cause a problem. Having an escape hatch to change this behavior without rebuilding a production kernel is critical, IMO.
I agree. People might want to "postpone" the "safe" notifiers because they still might be risky.
But I think that they might rather want to "disable" the "must-to-have" notifiers when they cause problems.
The naming "postpone_*_notifiers" or "disable_*_notifiers" sounds reasonable to me.
BTW: I am always confused by the "crash_kexec_post_notifiers" name.
It seems that my brain focuses on the word "post" and assumes that this delays the notifiers. Aka it makes them "post-notifiers" aka call them later. But it is the other way. I wonder if it is just me ;-)
Best Regards,
Petr
PS: I am sorry for the late reply. There are too many things going on...
Quoted 36 lines · Zack Rusin
A virtual machine may have neither guest-local persistent storage nor working userspace after a panic. The host's vmware.log remains available after the VM terminates, and a production encrypted guest is the only component able to export readable panic text. Hyper-V already provides this class of host-persistent panic reporting.
Add a panic-only VMware logger that copies the newest 4 KiB of the kernel log and sends it with bounded low-bandwidth RPC work. Ordinary guests enable text transfer by default; encrypted guests require an administrator to opt in through kernel.vmware_record_panic_msg. A separate late dumper reports the structured crash event after built-in dumpers and suppresses the event while a crash kernel is loaded, because a configured VMware host may terminate the VM before the reporting hypercall returns.
Patch 4 makes panic diagnostics run before kdump by default on VMware guests. This follows existing platform uses of
crash_kexec_post_notifiers, with Hyper-V as the closest guest-reporting precedent. Unlike Hyper-V, VMware exposes no capability bit for this behavior. An explicit crash_kexec_post_notifiers=0 still wins, and patch 4 can be dropped without affecting patches 1 through 3.This replaces patches 2 and 3 of Alexey's v2 posting:
https://lore.kernel.org/all/[email protected]/The intended merge path is tip's x86/vmware branch. Boris please review the VMware transport and policy. Petr and John, please review the panic-only dumper use and registration ordering. Joel and Kees, please review the sysctl. Baoquan and the KEXEC/KDUMP team, please review the loaded-crash-kernel guard and the default in patch 4.
Zack Rusin (4):
x86/vmware: Add a bounded panic log sender x86/vmware: Add thevmware_record_panic_msgsysctl x86/vmware: Report guest crashes after kmsg dumpers x86/vmware: Run panic diagnostics before kdump by default
Quoted 7 lines
Documentation/admin-guide/sysctl/kernel.rst | 14 ++ arch/x86/include/asm/vmware.h | 2 + arch/x86/kernel/cpu/vmware.c | 245 ++++++++++++++++++++ 3 files changed, 261 insertions(+)base-commit:
cee9395acd8043be0644b25c34bfa86623f2b935
LGTM for the series
Signature · 1 line
Maaz Mombasawala <[email protected]>