Re: [PATCH v4 4/4] x86/vmware: Report guest crashes after kmsg dumpers
From: Petr Mladek
Date: Fri Nov 20 2026 - 05:27:38 EST
Hi,
this patch looks a bit messy, But maybe, I just do not know enough
about VMvare.
On Wed 2026-11-18 01:01:51, Zack Rusin wrote:
> 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?
> Register a panic-only kmsg dumper with late_initcall_sync(), after built-in
> dumpers registered by then.
Is this ordering important?
> 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.
> 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.
> --- a/arch/x86/kernel/cpu/vmware.c
> +++ b/arch/x86/kernel/cpu/vmware.c
> +static int __init vmware_crash_report_init(void)
> +{
> + int ret;
> +
> + 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.
> + }
> +
> + 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.
> +}
> +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.