[PATCH v2 1/6] panic: Add a notifier chain for pre-kdump callbacks
Zack Rusin
zack.rusin at broadcom.com
Tue Oct 20 12:23:15 PDT 2026
Hi, Petr.
First of all I really appreciate you going over this. Thanks!
On Tue, Oct 20, 2026 at 12:37 PM Petr Mladek <pmladek at suse.com> wrote:
> Approach B: Three lists: platform, smp_safe, and smp_unsafe()
> =============================================================
>
> It is similar to approach A. We would just add an extra:
>
> + panic_notifiers_platform_list
> + disable_panic_notifiers_platform_list
>
> This list would be used for smp-safe notifiers which are
> required be some platform. It would be the notifiers which
> are crucial. Which are currently the reason to set
> "_crash_kexec_post_notifiers".
>
> It might be called also when __crash_kexec() is called
> outside panic().
[...]
> This patchset, adding vmware_log_notifier, might implement just
> the panic_notifiers_platform_list. The rest might be
> added by another volunteer.
>
> How does this sounds, please?
That sounds good to me. For v3 I'd do just the platform list:
- One call in vpanic(), right after kgdb_panic() and before the first
__crash_kexec(), whatever crash_kexec_post_notifiers is set to. The
list runs before kdump and before the other CPUs are stopped.
- One call in __crash_kexec(), after it has taken the kexec lock,
found a crash image and saved the registers, for paths that enter
kdump without panic(), like oops_end() or Hyper-V's hv_crash_handle().
Once the early panic call has run the list, the guard makes this one a
no-op. That removes the dependence on crash_kexec_post_notifiers you
pointed out before.
- A once-only guard shared by both, so the list also runs only once
when a callback panics.
- disable_panic_notifiers_platform_list as a boot and runtime switch,
checked in the same helper, replacing panic_pre_kdump_postpone.
- Kernel-doc with your definition: smp-safe callbacks a platform
needs, which would otherwise be a reason to set
crash_kexec_post_notifiers.
Roughly:
kgdb_panic(buf);
panic_notify_platform();
if (!_crash_kexec_post_notifiers)
__crash_kexec(NULL);
and in __crash_kexec():
crash_setup_regs(&fixed_regs, regs);
/* Direct entry outside panic() */
panic_notify_platform();
crash_save_vmcoreinfo();
I'd keep the second call in __crash_kexec() rather than crash_kexec(),
because afaict crash_kexec() can return without a crash image, e.g.
from the BPF kfunc, or from oops_end() before it panics. Calling the
list there would use up the guard even when no kdump follows.
crash_kexec_post_notifiers, the existing list and the kmsg dumpers
stay as they are, and moving other platforms over can come later.
The VMware log copy would be the only user, and it's still best-effort
diagnostics: kdump and the reboot don't depend on it. It copies the
log tail into an 8 KiB buffer. On panic() that happens after the panic
message and any local backtrace; on direct entry from an oops, after
the exception output. With the list enabled throughout, the copy
precedes the later panic notifiers, sys_info() and the all-CPU
backtrace step. The guest-crash report stays a late kmsg dumper that's
skipped while a crash kernel is loaded, because the host can power off
the VM inside that call.
If that matches what you had in mind, I'll do it that way in v3.
Guilherme, Stephen, Baoquan, does that work for you too?
z
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5414 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.infradead.org/pipermail/kexec/attachments/20261020/b370b477/attachment.p7s>
More information about the kexec
mailing list