Skip to contentSkip to conversation

Fix scheduling-while-atomic problem in console_cpu_notify()

PATCH In review Paul E. McKenney 2 participants 3 messages Oct 16, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix scheduling-while-atomic problem in console_cpu_notify()

The console_cpu_notify( function runs with interrupts disabled in the CPU_DEAD case. It therefore cannot block, for example, as will happen when it calls console_lock(). Therefore, remove the CPU_DEAD leg of the switch statement to avoid this problem.

kernel/printk.c +0 -1
index 66a2ea3..8e23a14 100644
@@ -1889,7 +1889,6 @@ static int __cpuinit console_cpu_notify(struct notifier_block *self,
 {
 	switch (action) {
 	case CPU_ONLINE:
-	case CPU_DEAD:
 	case CPU_DYING:
 	case CPU_DOWN_FAILED:
 	case CPU_UP_CANCELED:
#1 lore raw
Quoted 6 lines · Paul E. McKenney

The console_cpu_notify( function runs with interrupts disabled in the CPU_DEAD case. It therefore cannot block, for example, as will happen when it calls console_lock(). Therefore, remove the CPU_DEAD leg of the switch statement to avoid this problem.

s/CPU_DEAD/CPU_DYING/

Apparently it is a bad idea to compose and send a patch while in a C++ standards committee meeting where people are arguing about async futures... Fixed patch below.

Thanx, Paul

------------------------------------------------------------------------

printk: Fix scheduling-while-atomic problem in console_cpu_notify()

The console_cpu_notify( function runs with interrupts disabled in the CPU_DYING case. It therefore cannot block, for example, as will happen when it calls console_lock(). Therefore, remove the CPU_DYING leg of the switch statement to avoid this problem.

kernel/printk.c +0 -1
index 66a2ea3..2d607f4 100644
@@ -1890,7 +1890,6 @@ static int __cpuinit console_cpu_notify(struct notifier_block *self,
 	switch (action) {
 	case CPU_ONLINE:
 	case CPU_DEAD:
-	case CPU_DYING:
 	case CPU_DOWN_FAILED:
 	case CPU_UP_CANCELED:
 		console_lock();
Reviewed-by
#2 lore raw
Quoted 18 lines · Paul E. McKenney
Quoted 6 lines · Paul E. McKenney

The console_cpu_notify( function runs with interrupts disabled in the CPU_DEAD case. It therefore cannot block, for example, as will happen when it calls console_lock(). Therefore, remove the CPU_DEAD leg of the switch statement to avoid this problem.

s/CPU_DEAD/CPU_DYING/

Apparently it is a bad idea to compose and send a patch while in a C++ standards committee meeting where people are arguing about async futures... Fixed patch below.

Thanx, Paul

------------------------------------------------------------------------

Quoted 9 lines

printk: Fix scheduling-while-atomic problem in console_cpu_notify()

The console_cpu_notify( function runs with interrupts disabled in the CPU_DYING case. It therefore cannot block, for example, as will happen when it calls console_lock(). Therefore, remove the CPU_DYING leg of the switch statement to avoid this problem.

Regards,
Srivatsa S. Bhat

Quoted 13 lines
kernel/printk.c +0 -1
index 66a2ea3..2d607f4 100644
@@ -1890,7 +1890,6 @@ static int __cpuinit console_cpu_notify(struct notifier_block *self,
 	switch (action) {
 	case CPU_ONLINE:
 	case CPU_DEAD:
-	case CPU_DYING:
 	case CPU_DOWN_FAILED:
 	case CPU_UP_CANCELED:
 		console_lock();