@@ -2986,6 +2986,21 @@ void __init console_init(void)
}
}
+#ifdef CONFIG_PRINTK
+static int __init printk_activate_kthreads(void)
+{
+ struct console *con;
+
+ console_lock();
+ for_each_console(con)
+ printk_start_kthread(con);
+ kthreads_started = true;
+ console_unlock();
+
+ return 0;
+}
+#endif
+
/*
* Some boot consoles access data that is in the init section and which will
* be discarded after the initcalls have been run. To make sure that no code
@@ -3002,6 +3017,7 @@ void __init console_init(void)
*/
static int __init printk_late_init(void)
{
+ bool no_bootcon = true;
struct console *con;
int ret;
@@ -3023,15 +3039,20 @@ static int __init printk_late_init(void)
pr_warn("bootconsole [%s%d] uses init memory and must be disabled even before the real one is ready\n",
con->name, con->index);
unregister_console(con);
+ continue;
}
+
+ no_bootcon = false;
}
#ifdef CONFIG_PRINTK
- console_lock();
- for_each_console(con)
- start_printk_kthread(con);
- kthreads_started = true;
- console_unlock();
+ /*
+ * Some console drivers are not ready to use the same port with
+ * boot (early) and normal console in parallel. Stay on the safe
+ * side and enable kthreads only when there is no boot console.
+ */
+ if (no_bootcon)
+ printk_activate_kthreads();
#endif
ret = cpuhp_setup_state_nocalls(CPUHP_PRINTK_DEAD, "printk:dead", NULL,