Kexec Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "John Ogness" <john.ogness@linutronix.de>,
	"Petr Mladek" <pmladek@suse.com>
Cc: "Sergey Senozhatsky" <senozhatsky@chromium.org>,
	"Steven Rostedt" <rostedt@goodmis.org>,
	"Ryan Roberts" <ryan.roberts@arm.com>,
	"Breno Leitao" <leitao@debian.org>,
	printk@lists.linux.dev,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Baoquan He" <baoquan.he@linux.dev>,
	"Mike Rapoport" <rppt@kernel.org>,
	"Pasha Tatashin" <pasha.tatashin@soleen.com>,
	"Pratyush Yadav" <pratyush@kernel.org>,
	"Dave Young" <ruirui.yang@linux.dev>,
	kexec@lists.infradead.org
Subject: Re: [PATCH printk v2 5/6] printk: Add panic+kexec flush point
Date: Thu, 12 Nov 2026 18:20:10 +0000	[thread overview]
Message-ID: <sashiko-outbox-211696@kernel.org> (raw)
In-Reply-To: <20261111181942.593695-6-john.ogness@linutronix.de>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] crash: printk_trigger_flush() in __crash_kexec() called with
  wrong panic_cpu
--

commit fef7b57cf45508b52c2322cc5354dee7d0cedbc1
Author: John Ogness <john.ogness@linutronix.de>

printk: Add panic+kexec flush point

This commit adds a call to printk_trigger_flush() in __crash_kexec() to
allow consoles with the panic flush policy to flush before booting into
the crash kernel.

> diff --git a/kernel/crash_core.c b/kernel/crash_core.c
> index d0bd2d0cf8990..064b0af903c38 100644
> --- a/kernel/crash_core.c
> +++ b/kernel/crash_core.c
> @@ -140,6 +140,7 @@ void __noclone __crash_kexec(struct pt_regs *regs)
>  
>  			crash_setup_regs(&fixed_regs, regs);
>  			crash_save_vmcoreinfo();
> +			printk_trigger_flush(PR_FLUSH_RESTART);

[Severity: Medium]
Can printk_trigger_flush() be called here on CPU0 while panic_cpu still
holds a non-zero CPU number or its invalid initial value?

On Hyper-V root partitions, crash_nmi_callback() parks all non-zero CPUs
when a panic occurs on another CPU (or when the hypervisor itself crashes
with panic_cpu unset), while CPU0 disables the hypervisor and calls
hv_crash_handle() -> __crash_kexec() without updating panic_cpu:

arch/x86/hyperv/hv_crash.c:hv_crash_handle() {
    ...
	/* we are now fully in devirtualized normal kernel mode */
	__crash_kexec(NULL);
}

Because panic_on_this_cpu() is false on CPU0, nbcon_get_default_prio()
returns normal priority instead of panic priority.  printk_trigger_flush()
then skips atomic panic flushing and takes the offload path via
defer_console_output() -> irq_work_queue().  When the local tick is
stopped, raising the self-interrupt calls hv_send_ipi_self(), which
invokes a hypercall after the hypervisor has already been disabled,
faulting and aborting machine_kexec().

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261111181942.593695-1-john.ogness@linutronix.de?part=5


      reply	other threads:[~2026-11-12 18:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-11 18:19 [PATCH printk v2 0/6] Introduce policies for unsafe flushing John Ogness
2026-11-11 18:19 ` [PATCH printk v2 5/6] printk: Add panic+kexec flush point John Ogness
2026-11-12 18:20   ` sashiko-bot [this message]

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=sashiko-outbox-211696@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=baoquan.he@linux.dev \
    --cc=john.ogness@linutronix.de \
    --cc=kexec@lists.infradead.org \
    --cc=leitao@debian.org \
    --cc=pasha.tatashin@soleen.com \
    --cc=pmladek@suse.com \
    --cc=pratyush@kernel.org \
    --cc=printk@lists.linux.dev \
    --cc=rostedt@goodmis.org \
    --cc=rppt@kernel.org \
    --cc=ruirui.yang@linux.dev \
    --cc=ryan.roberts@arm.com \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=senozhatsky@chromium.org \
    /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