LWN.net Logo

Re: [PATCH] Fix scheduling-while-atomic problem in console_cpu_notify()

From:  "Paul E. McKenney" <paulmck-AT-linux.vnet.ibm.com>
To:  linux-kernel-AT-vger.kernel.org
Subject:  Re: [PATCH] Fix scheduling-while-atomic problem in console_cpu_notify()
Date:  Mon, 15 Oct 2012 21:35:59 -0700
Message-ID:  <20121016043559.GA32179@linux.vnet.ibm.com>
Cc:  cernekee-AT-gmail.com, torbenh-AT-gmx.de, torvalds-AT-linux-foundation.org, tglx-AT-linutronix.de, srivatsa.bhat-AT-linux.vnet.ibm.com
Archive-link:  Article, Thread

On Mon, Oct 15, 2012 at 05:31:28PM -0700, Paul E. McKenney wrote:
> 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.
> 
> Signed-off-by: Paul E. McKenney <paul.mckenney@linaro.org>

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.

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>

diff --git a/kernel/printk.c b/kernel/printk.c
index 66a2ea3..2d607f4 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -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();



(Log in to post comments)

Copyright © 2012, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds