From: Yong Zhang <yong.zhang0@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: linux-rt-users@vger.kernel.org, tglx@linutronix.de
Subject: [RFC] [PATCH -rt 3/5] printk: don't call printk_tick in printk_needs_cpu()
Date: Sun, 16 Oct 2011 18:56:45 +0800 [thread overview]
Message-ID: <1318762607-2261-4-git-send-email-yong.zhang0@gmail.com> (raw)
In-Reply-To: <1318762607-2261-1-git-send-email-yong.zhang0@gmail.com>
printk_tick() can't be called in atomic context, otherwise below
warning will show:
[ 117.597095] BUG: sleeping function called from invalid context at kernel/rtmutex.c:645
[ 117.597102] in_atomic(): 1, irqs_disabled(): 1, pid: 0, name: kworker/0:0
[ 117.597111] Pid: 0, comm: kworker/0:0 Not tainted 3.0.6-rt17-00284-gb76d419-dirty #7
[ 117.597116] Call Trace:
[ 117.597131] [<c06e3b61>] ? printk+0x1d/0x24
[ 117.597142] [<c01390b6>] __might_sleep+0xe6/0x110
[ 117.597151] [<c06e634c>] rt_spin_lock+0x1c/0x30
[ 117.597158] [<c0142f26>] __wake_up+0x26/0x60
[ 117.597166] [<c014c78e>] printk_tick+0x3e/0x40
[ 117.597173] [<c014c7b4>] printk_needs_cpu+0x24/0x30
[ 117.597181] [<c017ecc8>] tick_nohz_stop_sched_tick+0x2e8/0x410
[ 117.597191] [<c017305a>] ? sched_clock_idle_wakeup_event+0x1a/0x20
[ 117.597201] [<c010182a>] cpu_idle+0x4a/0xb0
[ 117.597209] [<c06e0b97>] start_secondary+0xd3/0xd7
Signed-off-by: Yong Zhang <yong.zhang0@gmail.com>
---
kernel/printk.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/printk.c b/kernel/printk.c
index 0c9a0ab..a50af4e 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -1282,8 +1282,8 @@ void printk_tick(void)
int printk_needs_cpu(int cpu)
{
- if (cpu_is_offline(cpu))
- printk_tick();
+ if (unlikely(cpu_is_offline(cpu)))
+ __this_cpu_write(printk_pending, 0);
return __this_cpu_read(printk_pending);
}
--
1.7.1
next prev parent reply other threads:[~2011-10-16 10:56 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-16 10:56 [RFC] [PATCH -rt 0/5] patchset focusing on cpu hotplug Yong Zhang
2011-10-16 10:56 ` [PATCH -rt 1/5] hotplug: sync_unplug: No '\n' in task name Yong Zhang
2011-10-16 10:56 ` [PATCH -rt 2/5] hotplug: Call cpu_unplug_begin() a little early Yong Zhang
2011-10-16 10:56 ` Yong Zhang [this message]
2011-10-16 10:56 ` [PATCH -rt 4/5] workqueue: hotplug fix Yong Zhang
2011-10-19 7:14 ` Thomas Gleixner
2011-10-24 2:26 ` Yong Zhang
2011-10-24 9:25 ` Thomas Gleixner
2011-10-16 10:56 ` [RFC] [PATCH -rt 5/5] cpufreq: get rid of get_online_cpus()/put_online_cpus() Yong Zhang
2011-10-19 9:12 ` Thomas Gleixner
2011-10-24 2:44 ` Yong Zhang
2011-10-24 9:24 ` Thomas Gleixner
2011-10-24 11:30 ` Yong Zhang
2011-10-24 11:45 ` Thomas Gleixner
2011-10-24 11:56 ` Yong Zhang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1318762607-2261-4-git-send-email-yong.zhang0@gmail.com \
--to=yong.zhang0@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-users@vger.kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).