Skip to contentSkip to conversation

printk: Postpone kthread startup

RFC PATCH Superseded John Ogness 2 participants 3 messages Oct 15 – Oct 16 Printk

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

John Ogness

author maintainer
#0 lore raw

RFC PATCH 1/1 printk: Postpone kthread startup

There have been various bug reports related to SMP systems hanging on boot. The reports vary wildly but seem to have some overlap with regard to missed IPI's during SMP setup. The reports also show that reverting NBCON console usage allows the bugs to disappear.

The NBCON kthreads for console printing are started very early during boot using early_initcall(). Since these kthreads are actively enabling/disabling interrupts during early boot, they may be interfering with SMP setup.

Postpone kthread starting until after all arch initcalls have completed.

---
@pmladek: This patch came about from the RedHat reports we were talking about at LPC. Derek is still doing final testing, but this patch most likely fixes the issue. We probably will want this for the 7.3-hotfix in order to preempt any other surprise bug reports.

It would be nice to start the kthreads sooner, but it is not worth possibly hanging some sensitive (buggy?) hardware.

 kernel/printk/nbcon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/printk/nbcon.c +1 -1
index f05cc90123bd4..04fdd71b37e55 100644
@@ -1475,7 +1475,7 @@ static int __init printk_setup_threads(void)
 	console_list_unlock();
 	return 0;
 }
-early_initcall(printk_setup_threads);
+subsys_initcall(printk_setup_threads);
 
 /**
  * nbcon_alloc - Allocate buffers needed by the nbcon console
author maintainer
#1 lore raw
Quoted 5 lines · John Ogness

There have been various bug reports related to SMP systems hanging on boot. The reports vary wildly but seem to have some overlap with regard to missed IPI's during SMP setup. The reports also show that reverting NBCON console usage allows the bugs to disappear.

Quoted 7 lines

The NBCON kthreads for console printing are started very early during boot using early_initcall(). Since these kthreads are actively enabling/disabling interrupts during early boot, they may be interfering with SMP setup.

Postpone kthread starting until after all arch initcalls have completed.

This should also contain:

Fixes 5f1b414ca027 ("printk: nbcon: Start printing threads")
#2 lore raw
In reply to John Ogness

Hi all,

Quoted 4 lines · John Ogness

There have been various bug reports related to SMP systems hanging on boot. The reports vary wildly but seem to have some overlap with regard to missed IPI's during SMP setup. The reports also show that reverting NBCON console usage allows the bugs to disappear.

FWIW, in some of those cases, the issue tends to be exacerbated by problematic hardware. Some of the reports were coming from platforms running older microcode that have had known issues on "complex workloads" with SMT enabled.

Quoted 9 lines

The NBCON kthreads for console printing are started very early during boot using early_initcall(). Since these kthreads are actively enabling/disabling interrupts during early boot, they may be interfering with SMP setup.

Postpone kthread starting until after all arch initcalls have completed.

Quoted 6 lines

---
@pmladek: This patch came about from the RedHat reports we were talking about at LPC. Derek is still doing final testing, but this patch most likely fixes the issue. We probably will want this for the 7.3-hotfix in order to preempt any other surprise bug reports.

I am wrapping up my last set of trial runs here, but I haven't been able to reproduce the issue using the "conventional" methods we've discussed. I would just like to confirm "once and for all" some of the noise I am seeing is caused by some network instability or whatever. I should be done with it soon.

Quoted 4 lines

It would be nice to start the kthreads sooner, but it is not worth possibly hanging some sensitive (buggy?) hardware.

buggy is an appropriate word too :)

Quoted 9 lines
 kernel/printk/nbcon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/printk/nbcon.c +0 -0
index f05cc90123bd4..04fdd71b37e55 100644

kernel/printk/nbcon.c static int __init printk_setup_threads(void) · line 1481

Quoted 8 lines
kernel/printk/nbcon.c +1 -1
@@ -1475,7 +1475,7 @@ static int __init printk_setup_threads(void)
 	console_list_unlock();
 	return 0;
 }
-early_initcall(printk_setup_threads);
+subsys_initcall(printk_setup_threads);
 
 /**
  * nbcon_alloc - Allocate buffers needed by the nbcon console

Cheers,

Signature · 1 line
Derek <[email protected]>