[PATCH v2] MIPS: SGI-IP27: print the NMI dump on an nbcon console

From: Imre Kaloz

Date: Thu Oct 01 2026 - 15:20:51 EST


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.

Fixes: d3539347022a ("serial: 8250: Switch to nbcon console, take 2")
Signed-off-by: Imre Kaloz <kaloz@xxxxxxxxxx>
---
v2: flush pending records before the hub reset (John Ogness)
v1: https://lore.kernel.org/all/20261001155013.1694-1-kaloz@xxxxxxxxxx/

This conflicts by context with patch 14/38 of the IP35 series,
https://lore.kernel.org/all/76f2a9c32eba23de36817f0a186def01e009e1c7.1790857966.git.kaloz@xxxxxxxxxx/
which rewrites the reset write. Whichever lands second places the
printk_trigger_flush() call above the system_is_ip35 branch.

arch/mips/sgi-ip27/ip27-nmi.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/arch/mips/sgi-ip27/ip27-nmi.c b/arch/mips/sgi-ip27/ip27-nmi.c
index fc2816398d0c..c502982621e6 100644
--- a/arch/mips/sgi-ip27/ip27-nmi.c
+++ b/arch/mips/sgi-ip27/ip27-nmi.c
@@ -1,4 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
+#include <linux/console.h>
#include <linux/kernel.h>
#include <linux/mmzone.h>
#include <linux/nodemask.h>
@@ -183,6 +184,12 @@ static void nmi_dump(void)
*/
arch_spin_lock(&nmi_lock);

+ /*
+ * 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();
+
#ifdef REAL_NMI_SIGNAL
/*
* Wait up to 15 seconds for the other cpus to respond to the NMI.
@@ -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();
LOCAL_HUB_S(NI_PORT_RESET, NPR_PORTRESET | NPR_LOCALRESET);
}
--
2.47.3