Re: [PATCH tty v11 1/2] serial: 8250: Switch to nbcon console, take 2

John Ogness <[email protected]>
Newsgroups org.kernel.vger.linux-tegra,org.kernel.vger.linux-kernel,org.kernel.vger.linux-serial
Message-ID <[email protected]>
On 2026-08-21, Jon Hunter <[email protected]> wrote:
> I replaced the WARN with a pr_err() and I see the same issue.

Thanks for testing. But just to be certain, can you restore the original
code (with the warning) and apply this horrible hack to force atomic
printing? I want to be certain that the problem goes away when nbcon
deferred printing is not active. For thet test you should boot normally
(without keep_bootcon).

===== BEGIN HACK =====
diff --git a/kernel/printk/internal.h b/kernel/printk/internal.h
index 85fbf1801cbe0..5806815fa11b2 100644
--- a/kernel/printk/internal.h
+++ b/kernel/printk/internal.h
@@ -202,6 +202,7 @@ static inline void printk_get_console_flush_type(struct console_flush_type *ft)
 				ft->nbcon_offload = true;
 			else
 				ft->nbcon_atomic = true;
+			ft->nbcon_atomic = true;
 		}
 
 		/* Legacy consoles are flushed directly when possible. */
diff --git a/kernel/printk/nbcon.c b/kernel/printk/nbcon.c
index 4b03b019cd5ee..152d9ac28176d 100644
--- a/kernel/printk/nbcon.c
+++ b/kernel/printk/nbcon.c
@@ -1185,6 +1185,7 @@ static bool nbcon_kthread_should_wakeup(struct console *con, struct nbcon_contex
 
 	if (kthread_should_stop())
 		return true;
+	return false;
 
 	/*
 	 * Block the kthread when the system is in an emergency or panic mode.
===== END HACK =====

I am expecting that this will work and the warning will be cleanly
visible on the UART console.

If the above test was successful, I am wondering if cpuidle should be
disabling the deferred printing as this seems quite similar to suspend.

Could you perform another test using the following hack _instead_ of the
above hack? This is probably a bit extreme since it does more than just
disable deferring, but it could help us figure out what is going on.

===== BEGIN HACK2 =====
diff --git a/drivers/cpuidle/cpuidle-tegra.c b/drivers/cpuidle/cpuidle-tegra.c
index aca907a62bb5d..0fb449e23f677 100644
--- a/drivers/cpuidle/cpuidle-tegra.c
+++ b/drivers/cpuidle/cpuidle-tegra.c
@@ -15,6 +15,7 @@
 #define pr_fmt(fmt)	"tegra-cpuidle: " fmt
 
 #include <linux/atomic.h>
+#include <linux/console.h>
 #include <linux/cpuidle.h>
 #include <linux/cpumask.h>
 #include <linux/cpu_pm.h>
@@ -165,6 +166,8 @@ static __cpuidle int tegra_cpuidle_state_enter(struct cpuidle_device *dev,
 {
 	int err;
 
+	console_suspend_all();
+
 	/*
 	 * CC6 state is the "CPU cluster power-off" state.  In order to
 	 * enter this state, at first the secondary CPU cores need to be
@@ -176,7 +179,7 @@ static __cpuidle int tegra_cpuidle_state_enter(struct cpuidle_device *dev,
 	if (index == TEGRA_CC6) {
 		err = tegra_cpuidle_coupled_barrier(dev);
 		if (err)
-			return err;
+			goto out;
 	}
 
 	local_fiq_disable();
@@ -204,6 +207,8 @@ static __cpuidle int tegra_cpuidle_state_enter(struct cpuidle_device *dev,
 	cpu_pm_exit();
 	tegra_pm_clear_cpu_in_lp2();
 	local_fiq_enable();
+out:
+	console_resume_all();
 
 	return err ?: index;
 }
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 3fcdf4b4e2e53..8d126b5068684 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -2787,7 +2787,7 @@ void console_suspend_all(void)
 	struct console *con;
 
 	if (console_suspend_enabled)
-		pr_info("Suspending console(s) (use no_console_suspend to debug)\n");
+		pr_info_once("Suspending console(s) (use no_console_suspend to debug)\n");
 
 	/*
 	 * Flush any console backlog and then avoid queueing irq_work until
===== END HACK2 =====

John Ogness
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.