mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: tip-bot for Li Zhong <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@kernel.org,
	peterz@infradead.org, zhong@linux.vnet.ibm.com,
	paulmck@linux.vnet.ibm.com, fweisbec@gmail.com,
	tglx@linutronix.de
Subject: [tip:timers/nohz] nohz: Protect smp_processor_id() in tick_nohz_task_switch()
Date: Mon, 29 Apr 2013 23:30:30 -0700	[thread overview]
Message-ID: <tip-6296ace467c8640317414ba589b124323806f7ce@git.kernel.org> (raw)
In-Reply-To: <1367119558.6391.34.camel@ThinkPad-T5421.cn.ibm.com>

Commit-ID:  6296ace467c8640317414ba589b124323806f7ce
Gitweb:     http://git.kernel.org/tip/6296ace467c8640317414ba589b124323806f7ce
Author:     Li Zhong <zhong@linux.vnet.ibm.com>
AuthorDate: Sun, 28 Apr 2013 11:25:58 +0800
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 29 Apr 2013 13:17:33 +0200

nohz: Protect smp_processor_id() in tick_nohz_task_switch()

I saw following error when testing the latest nohz code on
Power:

[   85.295384] BUG: using smp_processor_id() in preemptible [00000000] code: rsyslogd/3493
[   85.295396] caller is .tick_nohz_task_switch+0x1c/0xb8
[   85.295402] Call Trace:
[   85.295408] [c0000001fababab0] [c000000000012dc4] .show_stack+0x110/0x25c (unreliable)
[   85.295420] [c0000001fababba0] [c0000000007c4b54] .dump_stack+0x20/0x30
[   85.295430] [c0000001fababc10] [c00000000044eb74] .debug_smp_processor_id+0xf4/0x124
[   85.295438] [c0000001fababca0] [c0000000000d7594] .tick_nohz_task_switch+0x1c/0xb8
[   85.295447] [c0000001fababd20] [c0000000000b9748] .finish_task_switch+0x13c/0x160
[   85.295455] [c0000001fababdb0] [c0000000000bbe50] .schedule_tail+0x50/0x124
[   85.295463] [c0000001fababe30] [c000000000009dc8] .ret_from_fork+0x4/0x54

The code below moves the test into local_irq_save/restore
section to avoid the above complaint.

Signed-off-by: Li Zhong <zhong@linux.vnet.ibm.com>
Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Paul McKenney <paulmck@linux.vnet.ibm.com>
Link: http://lkml.kernel.org/r/1367119558.6391.34.camel@ThinkPad-T5421.cn.ibm.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 kernel/time/tick-sched.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index da53c8f..1c9f53b 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -251,14 +251,15 @@ void tick_nohz_task_switch(struct task_struct *tsk)
 {
 	unsigned long flags;
 
-	if (!tick_nohz_full_cpu(smp_processor_id()))
-		return;
-
 	local_irq_save(flags);
 
+	if (!tick_nohz_full_cpu(smp_processor_id()))
+		goto out;
+
 	if (tick_nohz_tick_stopped() && !can_stop_full_tick())
 		tick_nohz_full_kick();
 
+out:
 	local_irq_restore(flags);
 }
 

      reply	other threads:[~2013-04-30  6:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-27  9:59 [RFC PATCH]nohz: Use raw_smp_processor_id() " Li Zhong
2013-04-27 13:40 ` Frederic Weisbecker
2013-04-28  1:56   ` Li Zhong
2013-04-28  3:25   ` [RFC PATCH v2]nohz: protect smp_processor_id() " Li Zhong
2013-04-30  6:30     ` tip-bot for Li Zhong [this message]

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=tip-6296ace467c8640317414ba589b124323806f7ce@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=fweisbec@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=zhong@linux.vnet.ibm.com \
    /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

all inboxes | Powered by JetHome®