[PATCH v2 2/6] crash: Notify pre-kdump callbacks before switching kernels

Petr Mladek pmladek at suse.com
Tue Oct 20 05:10:29 PDT 2026


On Mon 2026-09-28 13:55:36, Zack Rusin wrote:
> Fatal x86 oopses can call crash_kexec() without reaching panic(). Run the
> pre-kdump chain from __crash_kexec() as well, after finding a loaded image
> under the kexec lock and capturing the original registers.
> 
> This covers direct crash entry without moving all panic notifiers ahead
> of kdump. A missing image or failed trylock leaves callbacks uncalled;
> the shared guard skips callbacks already invoked by panic().
> 
> Link: https://lore.kernel.org/r/aquttpMVKX8e6zGB@pathway.suse.cz
> Signed-off-by: Zack Rusin <zack.rusin at broadcom.com>
> ---
> New in v2: cover direct crash-kexec entry in a separate core patch.
> 
>  kernel/crash_core.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/kernel/crash_core.c b/kernel/crash_core.c
> index 2b36aa9fade0..5d9fe9e00f39 100644
> --- a/kernel/crash_core.c
> +++ b/kernel/crash_core.c
> @@ -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>
> @@ -139,6 +140,7 @@ void __noclone __crash_kexec(struct pt_regs *regs)
>  			struct pt_regs fixed_regs;
>  
>  			crash_setup_regs(&fixed_regs, regs);
> +			panic_notify_pre_kdump(NULL);

I understand why you did this. But it makes the code really hard to
follow: 

  + This code path will be called also by the 1st __crash_kexec() in
    vpanic() when "_crash_kexec_post_notifiers == false". It is the
    default.

  + The panic_notify_pre_kdump(buf) in vpanic(), added by 1st patch,
    is called when "_crash_kexec_post_notifiers == true" or when
    __crash_kexec() returns from some reason.

None of this is obvious.

I am going to think more about it.

Best Regards,
Petr

>  			crash_save_vmcoreinfo();
>  			machine_crash_shutdown(&fixed_regs);
>  			crash_cma_clear_pending_dma();



More information about the kexec mailing list