From: Petr Mladek <pmladek@suse.com>
To: Zack Rusin <zack.rusin@broadcom.com>
Cc: Baoquan He <baoquan.he@linux.dev>,
"Guilherme G. Piccoli" <gpiccoli@igalia.com>,
Borislav Petkov <bp@alien8.de>,
Andrew Morton <akpm@linux-foundation.org>,
Mike Rapoport <rppt@kernel.org>,
Ajay Kaher <ajay.kaher@broadcom.com>,
Alexey Makhalov <alexey.makhalov@broadcom.com>,
Pasha Tatashin <pasha.tatashin@soleen.com>,
x86@kernel.org, Joel Granados <joel.granados@kernel.org>,
Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
Dave Hansen <dave.hansen@linux.intel.com>,
"H. Peter Anvin" <hpa@zytor.com>,
virtualization@lists.linux.dev,
Dave Young <ruirui.yang@linux.dev>,
bcm-kernel-feedback-list@broadcom.com,
linux-kernel@vger.kernel.org,
John Ogness <john.ogness@linutronix.de>,
Steven Rostedt <rostedt@goodmis.org>,
Sergey Senozhatsky <senozhatsky@chromium.org>,
Pratyush Yadav <pratyush@kernel.org>, Kees Cook <kees@kernel.org>,
Jonathan Corbet <corbet@lwn.net>, Bo Gan <bo.gan@broadcom.com>,
Brennan Lamoreaux <brennan.lamoreaux@broadcom.com>,
kexec@lists.infradead.org, linux-doc@vger.kernel.org,
Maaz Mombasawala <maaz.mombasawala@broadcom.com>,
Shuah Khan <skhan@linuxfoundation.org>,
Randy Dunlap <rdunlap@infradead.org>,
Stephen Brennan <stephen.s.brennan@oracle.com>,
Michael Kelley <mhklinux@outlook.com>,
Ian Forbes <ian.forbes@broadcom.com>
Subject: Re: [PATCH v2 1/6] panic: Add a notifier chain for pre-kdump callbacks
Date: Wed, 21 Oct 2026 11:19:46 +0200 [thread overview]
Message-ID: <atiDsmnUM7v2UJkY@pathway.suse.cz> (raw)
In-Reply-To: <CABQX2QO6fwvKZwG34uOYDU_ae4M4_n2SMsYmqoLgOPnWkao02w@mail.gmail.com>
On Wed 2026-10-21 01:10:25, Zack Rusin wrote:
> On Tue, Oct 20, 2026 at 10:04 PM Baoquan He <baoquan.he@linux.dev> wrote:
> >
> > On 10/20/26 at 03:23pm, Zack Rusin wrote:
> > > 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@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.
Just to be sure. I think that a simple static bool or int should be
enough. The caller is responsible for the synchronization. I believe
that it should be done by the "panic_cpu".
> > > - 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?
> >
> > Hi Zack,
> >
> > Sorry I didn't check this series before, just trying to catch up.
> >
> > I like the Approach B direction: one panic_notifiers_platform_list for
> > platform callbacks that must run before kdump. While I have one concern
> > about the long term.
> >
> > Today the list has only the VMware log sender. Later, more handlers may join
> > (for example pvpanic, Hyper-V, Xen, gsmi, SNP). When the list grows, someone
> > will want to run only their handler, or to skip some handlers. The easy
> > answer is "add a new list for my handler". I think this will be a problem too
> > in the future. Every new list adds a new global ordering rule and a new disable
> > switch. Petr already said we should keep the number of lists small.
My hope is most of the potential users won't be registered at the same
time or will be a NOP in the real life. Because each particular system
will actively used only some technology.
But maybe I am naive and there will be selection and ordering problems.
> > Currently, atomic_notifier_call_chain() runs all registered callbacks. There
> > is no per-handler enable/disable and no filter. NOTIFY_STOP_MASK can stop the
> > chain, but we must not use it here, because one handler could hide all the
> > later handlers. The list-level disable_panic_notifiers_platform_list can
> > only disable the whole list.
> >
> > I have some rough though, just for reference:
> >
> > 1. Keep one panic_notifiers_platform_list.
> >
> > 2. Give each handler a small wrapper with a name and an enabled flag:
> >
> > struct panic_pre_kdump_notifier {
> > struct notifier_block nb;
> > const char *name;
> > bool enabled;
> > };
This looks good to me.
> > 3. In the dispatch, skip a handler when enabled is false. Print the name
> > before calling it. This also helps when a handler hangs and we want to
> > know which one it was.
> >
> > 4. Add a boot parameter to disable handlers by name, for example:
> >
> > panic_pre_kdump.disable=vmware_log,hyperv_crash
I like this. I think that we just would want to do s/_pre_dump/_notifiers_platform/.
> > Parse it early. At panic time we only read the flag. We do not parse
> > strings in the panic path.
> >
> > 5. Keep the list-level disable_panic_notifiers_platform_list. It is still
> > useful to disable the whole list for debugging.
> >
> > 6. If the list is still too broad later, we can add a reason/class argument
> > (for example PANIC, OOPS_DIRECT). A handler can then decide if it cares.
> > This is better than adding a new list.
>
> Thanks for looking at it. I agree we shouldn't add a separate list for
> each handler, and named handlers with their own switch on the one list
> sound like the right way to grow it.
>
> For v3 I'd like to keep the series to the list itself. With VMware as
> the only callback, the list-wide boot switch already lets us disable
> platform logging. The sender also has its own sysctl,
> kernel.vmware_record_panic_msg. We can add per-handler selection with
> the next user, when there's an actual choice between handlers. I'm
> happy to help with that when it comes up.
Sound good to me. I would like to start simple. We could add the selection
later when it is needed in the real life.
> Two of your points do fit in v3 as documentation. I'll change the
> panic_notify_platform() kernel-doc to also say that:
> - callbacks must return NOTIFY_DONE, because NOTIFY_STOP would skip
> the callbacks after them
> - the notifier value is 0.
Great catch!
> The VMware callback ignores that value, which leaves room to add
> reason information later.
>
> Petr, does keeping v3 to that sound right to you?
Sounds good to me. But you might want to wait few more days for
more potential feedback.
Best Regards,
Petr
next prev parent reply other threads:[~2026-10-21 9:19 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-28 17:55 [PATCH v2 0/6] panic, x86/vmware: Preserve crash logs before kdump Zack Rusin
2026-09-28 17:55 ` [PATCH v2 1/6] panic: Add a notifier chain for pre-kdump callbacks Zack Rusin
2026-09-28 18:04 ` sashiko-bot
2026-10-19 22:05 ` Guilherme G. Piccoli
2026-10-20 12:01 ` Petr Mladek
2026-10-20 13:20 ` Petr Mladek
2026-10-20 14:30 ` Petr Mladek
2026-10-20 16:37 ` Petr Mladek
2026-10-20 19:23 ` Zack Rusin
2026-10-21 2:04 ` Baoquan He
2026-10-21 5:10 ` Zack Rusin
2026-10-21 9:19 ` Petr Mladek [this message]
2026-10-21 9:41 ` Baoquan He
2026-09-28 17:55 ` [PATCH v2 2/6] crash: Notify pre-kdump callbacks before switching kernels Zack Rusin
2026-09-28 18:08 ` sashiko-bot
2026-09-28 18:40 ` Zack Rusin
2026-10-19 10:47 ` John Ogness
2026-10-20 12:10 ` Petr Mladek
2026-09-28 17:55 ` [PATCH v2 3/6] panic: Allow postponing pre-kdump notifiers Zack Rusin
2026-09-28 18:04 ` sashiko-bot
2026-10-19 22:07 ` Guilherme G. Piccoli
2026-10-20 12:28 ` Petr Mladek
2026-09-28 17:55 ` [PATCH v2 4/6] x86/vmware: Add a bounded pre-kdump log sender Zack Rusin
2026-09-28 18:07 ` sashiko-bot
2026-09-28 17:55 ` [PATCH v2 5/6] x86/vmware: Add the vmware_record_panic_msg sysctl Zack Rusin
2026-09-28 18:06 ` sashiko-bot
2026-09-28 17:55 ` [PATCH v2 6/6] x86/vmware: Report guest crashes after kmsg dumpers Zack Rusin
2026-09-28 18:03 ` sashiko-bot
2026-09-28 20:39 ` [PATCH v2 0/6] panic, x86/vmware: Preserve crash logs before kdump Bradley Morgan
2026-10-14 17:07 ` Zack Rusin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=atiDsmnUM7v2UJkY@pathway.suse.cz \
--to=pmladek@suse.com \
--cc=ajay.kaher@broadcom.com \
--cc=akpm@linux-foundation.org \
--cc=alexey.makhalov@broadcom.com \
--cc=baoquan.he@linux.dev \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=bo.gan@broadcom.com \
--cc=bp@alien8.de \
--cc=brennan.lamoreaux@broadcom.com \
--cc=corbet@lwn.net \
--cc=dave.hansen@linux.intel.com \
--cc=gpiccoli@igalia.com \
--cc=hpa@zytor.com \
--cc=ian.forbes@broadcom.com \
--cc=joel.granados@kernel.org \
--cc=john.ogness@linutronix.de \
--cc=kees@kernel.org \
--cc=kexec@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maaz.mombasawala@broadcom.com \
--cc=mhklinux@outlook.com \
--cc=mingo@redhat.com \
--cc=pasha.tatashin@soleen.com \
--cc=pratyush@kernel.org \
--cc=rdunlap@infradead.org \
--cc=rostedt@goodmis.org \
--cc=rppt@kernel.org \
--cc=ruirui.yang@linux.dev \
--cc=senozhatsky@chromium.org \
--cc=skhan@linuxfoundation.org \
--cc=stephen.s.brennan@oracle.com \
--cc=tglx@kernel.org \
--cc=virtualization@lists.linux.dev \
--cc=x86@kernel.org \
--cc=zack.rusin@broadcom.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox