All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -rt] printk: Don't emit console_cpu_notify() for CPU_DYING
@ 2011-11-16  9:42 Yong Zhang
  2011-11-16 14:19 ` Steven Rostedt
  0 siblings, 1 reply; 4+ messages in thread
From: Yong Zhang @ 2011-11-16  9:42 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: LKML, linux-rt-users

Otherwise we will get below warning:

BUG: sleeping function called from invalid context at /build/linux/kernel/rtmutex.c:645
in_atomic(): 1, irqs_disabled(): 1, pid: 1054, name: migration/9
no locks held by migration/9/1054.
irq event stamp: 36
hardirqs last  enabled at (35): [<ffffffff815f5b50>] _raw_spin_unlock_irq+0x30/0x70
hardirqs last disabled at (36): [<ffffffff810b7eaf>] stop_machine_cpu_stop+0x8f/0x110
softirqs last  enabled at (0): [<ffffffff81051b53>] copy_process+0x6d3/0x1640
softirqs last disabled at (0): [<          (null)>]           (null)
Pid: 1054, comm: migration/9 Not tainted 3.2.0-rc1-rt2-11312-gbf51260-dirty #12
Call Trace:
 [<ffffffff81040c4e>] __might_sleep+0x12e/0x1e0
 [<ffffffff815f4d24>] rt_spin_lock+0x24/0x60
 [<ffffffff810c4aa2>] ? touch_nmi_watchdog+0x42/0x80
 [<ffffffff813f58f3>] serial8250_console_write+0x143/0x150
 [<ffffffff81054323>] __call_console_drivers+0x93/0xb0
 [<ffffffff8105438c>] _call_console_drivers+0x4c/0x80
 [<ffffffff8105448d>] console_unlock+0xcd/0x240
 [<ffffffff815ef5ac>] console_cpu_notify+0x26/0x2d
 [<ffffffff81083744>] notifier_call_chain+0x84/0xf0
 [<ffffffff810837be>] __raw_notifier_call_chain+0xe/0x10
 [<ffffffff81055ac0>] __cpu_notify+0x20/0x40
 [<ffffffff815de3e2>] take_cpu_down+0x32/0x40
 [<ffffffff810b7eca>] stop_machine_cpu_stop+0xaa/0x110
 [<ffffffff810b7e20>] ? stop_one_cpu+0x80/0x80
 [<ffffffff810b7e20>] ? stop_one_cpu+0x80/0x80
 [<ffffffff810b79be>] cpu_stopper_thread+0xce/0x1b0
 [<ffffffff810b78f0>] ? wait_for_stop_done+0xa0/0xa0
 [<ffffffff810b78f0>] ? wait_for_stop_done+0xa0/0xa0
 [<ffffffff810430c9>] ? sub_preempt_count+0xa9/0xe0
 [<ffffffff810b78f0>] ? wait_for_stop_done+0xa0/0xa0
 [<ffffffff810b78f0>] ? wait_for_stop_done+0xa0/0xa0
 [<ffffffff8107c096>] kthread+0xa6/0xb0
 [<ffffffff810430c9>] ? sub_preempt_count+0xa9/0xe0
 [<ffffffff815f5b5b>] ? _raw_spin_unlock_irq+0x3b/0x70
 [<ffffffff815f8534>] kernel_thread_helper+0x4/0x10
 [<ffffffff810423bc>] ? finish_task_switch+0x8c/0x110
 [<ffffffff815f5b5b>] ? _raw_spin_unlock_irq+0x3b/0x70
 [<ffffffff815f5f21>] ? retint_restore_args+0xe/0xe
 [<ffffffff8107bff0>] ? kthreadd+0x160/0x160
 [<ffffffff815f8530>] ? gs_change+0xb/0xb
CPU 9 is now offline

Signed-off-by: Yong Zhang <yong.zhang0@gmail.com>
---
 kernel/printk.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/kernel/printk.c b/kernel/printk.c
index 535bc3b..ba0393e 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -1223,7 +1223,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();
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH -rt] printk: Don't emit console_cpu_notify() for CPU_DYING
  2011-11-16  9:42 [PATCH -rt] printk: Don't emit console_cpu_notify() for CPU_DYING Yong Zhang
@ 2011-11-16 14:19 ` Steven Rostedt
  2011-11-16 14:48   ` Thomas Gleixner
  0 siblings, 1 reply; 4+ messages in thread
From: Steven Rostedt @ 2011-11-16 14:19 UTC (permalink / raw)
  To: Yong Zhang; +Cc: Thomas Gleixner, LKML, linux-rt-users

On Wed, 2011-11-16 at 17:42 +0800, Yong Zhang wrote:
> Otherwise we will get below warning:
> 
> BUG: sleeping function called from invalid context at /build/linux/kernel/rtmutex.c:645
> in_atomic(): 1, irqs_disabled(): 1, pid: 1054, name: migration/9
> no locks held by migration/9/1054.
> irq event stamp: 36
> hardirqs last  enabled at (35): [<ffffffff815f5b50>] _raw_spin_unlock_irq+0x30/0x70
> hardirqs last disabled at (36): [<ffffffff810b7eaf>] stop_machine_cpu_stop+0x8f/0x110
> softirqs last  enabled at (0): [<ffffffff81051b53>] copy_process+0x6d3/0x1640
> softirqs last disabled at (0): [<          (null)>]           (null)
> Pid: 1054, comm: migration/9 Not tainted 3.2.0-rc1-rt2-11312-gbf51260-dirty #12
> Call Trace:

Thomas, doesn't printk not print to serial in atomic contexts? Or did
that change?

-- Steve



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH -rt] printk: Don't emit console_cpu_notify() for CPU_DYING
  2011-11-16 14:19 ` Steven Rostedt
@ 2011-11-16 14:48   ` Thomas Gleixner
  2011-11-17  5:29     ` Yong Zhang
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Gleixner @ 2011-11-16 14:48 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: Yong Zhang, LKML, linux-rt-users

On Wed, 16 Nov 2011, Steven Rostedt wrote:

> On Wed, 2011-11-16 at 17:42 +0800, Yong Zhang wrote:
> > Otherwise we will get below warning:
> > 
> > BUG: sleeping function called from invalid context at /build/linux/kernel/rtmutex.c:645
> > in_atomic(): 1, irqs_disabled(): 1, pid: 1054, name: migration/9
> > no locks held by migration/9/1054.
> > irq event stamp: 36
> > hardirqs last  enabled at (35): [<ffffffff815f5b50>] _raw_spin_unlock_irq+0x30/0x70
> > hardirqs last disabled at (36): [<ffffffff810b7eaf>] stop_machine_cpu_stop+0x8f/0x110
> > softirqs last  enabled at (0): [<ffffffff81051b53>] copy_process+0x6d3/0x1640
> > softirqs last disabled at (0): [<          (null)>]           (null)
> > Pid: 1054, comm: migration/9 Not tainted 3.2.0-rc1-rt2-11312-gbf51260-dirty #12
> > Call Trace:
> 
> Thomas, doesn't printk not print to serial in atomic contexts? Or did
> that change?

Not that I know of.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH -rt] printk: Don't emit console_cpu_notify() for CPU_DYING
  2011-11-16 14:48   ` Thomas Gleixner
@ 2011-11-17  5:29     ` Yong Zhang
  0 siblings, 0 replies; 4+ messages in thread
From: Yong Zhang @ 2011-11-17  5:29 UTC (permalink / raw)
  To: Thomas Gleixner, Steven Rostedt; +Cc: LKML, linux-rt-users

On Wed, Nov 16, 2011 at 03:48:11PM +0100, Thomas Gleixner wrote:
> On Wed, 16 Nov 2011, Steven Rostedt wrote:
> > Thomas, doesn't printk not print to serial in atomic contexts? Or did

I guess you mean console_trylock_for_printk() will fail in atomic context?
If so, yeah, that doesn't change.

But the issue is console_cpu_notify() call console_lock() directly.
That means below scenario could also happen in mainline:

	CPU A				CPU B

doing printk with console_sem held
				take_cpu_down();
				  cpu_notify(CPU_DYING);
				    console_cpu_notify();
				      console_lock();
				        down(&console_sem);
					  *bang*
  up(&console_sem);

Sounds I should also send this patch to mainline.

Thanks,
Yong

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-11-17  5:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-16  9:42 [PATCH -rt] printk: Don't emit console_cpu_notify() for CPU_DYING Yong Zhang
2011-11-16 14:19 ` Steven Rostedt
2011-11-16 14:48   ` Thomas Gleixner
2011-11-17  5:29     ` Yong Zhang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.