From: sashiko-bot@kernel.org
To: "Imre Kaloz" <kaloz@kernel.org>
Cc: linux-serial@vger.kernel.org
Subject: Re: [PATCH v2] MIPS: SGI-IP27: print the NMI dump on an nbcon console
Date: Fri, 02 Oct 2026 09:13:15 +0000 [thread overview]
Message-ID: <20261002091315.675631F00898@smtp.kernel.org> (raw)
In-Reply-To: <20261001191938.3256-1-kaloz@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] printk: NMI dump output lost due to nbcon timeout if console is in unsafe state
--
commit f9358977a85eff3b02febdb716b027b3e2f5107f
Author: Imre Kaloz <kaloz@kernel.org>
MIPS: SGI-IP27: print the NMI dump on an nbcon console
Since the 8250 console became nbcon, printk() in nmi_dump() only queues
records for a printer thread that never runs, as no CPU leaves the NMI
handler. Print from an emergency section and flush pending records
before the hub reset.
> diff --git a/arch/mips/sgi-ip27/ip27-nmi.c b/arch/mips/sgi-ip27/ip27-nmi.c
> index fc2816398d0cf..c502982621e6b 100644
> --- a/arch/mips/sgi-ip27/ip27-nmi.c
> +++ b/arch/mips/sgi-ip27/ip27-nmi.c
> @@ -183,6 +184,12 @@ static void nmi_dump(void)
> */
> arch_spin_lock(&nmi_lock);
[Severity: High]
If another CPU was interrupted while holding an nbcon console in an unsafe
state, will it be trapped here spinning indefinitely on nmi_lock?
If so, it would never be able to release the console.
>
> + /*
> + * No CPU leaves the NMI handler before the hub reset below, so an
> + * nbcon console's printer thread would never print the dump.
> + */
> + nbcon_cpu_emergency_enter();
[Severity: High]
Does entering EMERGENCY priority here instead of PANIC prevent a hostile
takeover of the console?
Hostile unsafe takeovers require panic_on_this_cpu() to be true via
nbcon_allow_unsafe_takeover().
Since panic() is not called during this NMI dump sequence, it appears this
would fall short of allowing a takeover if the console is locked.
> +
> #ifdef REAL_NMI_SIGNAL
> /*
[ ... ]
> @@ -227,5 +234,6 @@ static void nmi_dump(void)
> * Save the nmi cpu registers for all cpu in the eframe format.
> */
> nmi_eframes_save();
> + printk_trigger_flush();
[Severity: High]
Will this flush completely suppress the dump output if the console was held
by one of the trapped CPUs?
If the system attempts a handover here, it will wait 2000us and time out
because the other CPU is trapped on nmi_lock.
Following the timeout, nbcon_context_try_acquire_hostile() will fail with
-EPERM because PANIC priority was not established.
Could this cause the flush to fail entirely, silently triggering a hardware
reset via LOCAL_HUB_S() without outputting any diagnostic information?
> LOCAL_HUB_S(NI_PORT_RESET, NPR_PORTRESET | NPR_LOCALRESET);
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261001191938.3256-1-kaloz@kernel.org?part=1
prev parent reply other threads:[~2026-10-02 9:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-01 19:19 [PATCH v2] MIPS: SGI-IP27: print the NMI dump on an nbcon console Imre Kaloz
2026-10-01 19:55 ` John Ogness
2026-10-02 7:27 ` Petr Mladek
2026-10-02 9:30 ` Greg Kroah-Hartman
2026-10-02 9:13 ` 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=20261002091315.675631F00898@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=kaloz@kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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