LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: "Tony Luck" <tony.luck@gmail.com>
To: "Roland Dreier" <rdreier@cisco.com>
Cc: "David Miller" <davem@davemloft.net>,
	mingo@elte.hu, linux-kernel@vger.kernel.org
Subject: Re: Strange hang on ia64 with CONFIG_PRINTK_TIME=y
Date: Tue, 19 Feb 2008 14:40:35 -0800	[thread overview]
Message-ID: <12c511ca0802191440q6a2f5604xe6b563c32c3a90b2@mail.gmail.com> (raw)
In-Reply-To: <12c511ca0802141817i3295e83cxd7c05e07f2c54fea@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 860 bytes --]

> Perhaps what is happening is that cpu0 comes online ... safely skips
> over the early printk calls.  Calls cpu_init() which sets up the resources
> *it* needs (ar.k3 points to per-cpu space), and then executes
> sched_init() which marks it safe for all printk's. Then cpu1 comes
> up and does a printk before it gets to cpu_init().

I just tried Ingo's patch[1] on a 2.6.25-rc2 kernel with printk timestamps
turned on ... and it booted just fine on my tiger4.  The default path
for non-boot cpus is from head.S to start_secondary(), and that
calls cpu_init() pretty quickly.  There shouldn't normally[2] be any
printk() calls on the non-boot cpu before it is safe to do so.

-Tony

[1] Attached
[2] If you set #define SMP_DEBUG in arch/ia64/kernel/smpboot.c
that enables at least one printk() that will cause problems if you have
also configured timestamps.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: ingo.patch --]
[-- Type: text/x-patch; name=ingo.patch, Size: 1271 bytes --]

 kernel/sched.c |   14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

Index: linux-x86.q/kernel/sched.c
===================================================================
--- linux-x86.q.orig/kernel/sched.c
+++ linux-x86.q/kernel/sched.c
@@ -666,6 +666,8 @@ const_debug unsigned int sysctl_sched_rt
  */
 const_debug unsigned int sysctl_sched_rt_ratio = 62259;
 
+static __read_mostly int scheduler_running;
+
 /*
  * For kernel-internal use: high-speed (but slightly incorrect) per-cpu
  * clock constructed from sched_clock():
@@ -676,14 +678,16 @@ unsigned long long cpu_clock(int cpu)
 	unsigned long flags;
 	struct rq *rq;
 
-	local_irq_save(flags);
-	rq = cpu_rq(cpu);
 	/*
 	 * Only call sched_clock() if the scheduler has already been
 	 * initialized (some code might call cpu_clock() very early):
 	 */
-	if (rq->idle)
-		update_rq_clock(rq);
+	if (unlikely(!scheduler_running))
+		return 0;
+
+	local_irq_save(flags);
+	rq = cpu_rq(cpu);
+	update_rq_clock(rq);
 	now = rq->clock;
 	local_irq_restore(flags);
 
@@ -7255,6 +7259,8 @@ void __init sched_init(void)
 	 * During early bootup we pretend to be a normal task:
 	 */
 	current->sched_class = &fair_sched_class;
+
+	scheduler_running = 1;
 }
 
 #ifdef CONFIG_DEBUG_SPINLOCK_SLEEP
--

  reply	other threads:[~2008-02-19 22:40 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-13  6:24 Roland Dreier
2008-02-13  7:01 ` David Miller
2008-02-13 12:57   ` Ingo Molnar
2008-02-13 13:02     ` Ingo Molnar
2008-02-14  0:26       ` Roland Dreier
2008-02-13 13:03     ` David Miller
2008-02-13 13:06       ` Ingo Molnar
2008-02-14  0:59       ` Tony Luck
2008-02-14  1:04         ` David Miller
2008-02-14  3:33           ` Tony Luck
2008-02-14  3:47             ` Roland Dreier
2008-02-14 18:24               ` Luck, Tony
2008-02-14 21:27               ` Tony Luck
2008-02-14 22:04                 ` Roland Dreier
2008-02-14 22:23                   ` Luck, Tony
2008-02-15  2:17                     ` Tony Luck
2008-02-19 22:40                       ` Tony Luck [this message]
2008-02-20  8:12                         ` Ingo Molnar
2008-02-20  8:15                           ` David Miller
2008-02-20 23:35                         ` Roland Dreier
2008-02-20 23:36                         ` Roland Dreier

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=12c511ca0802191440q6a2f5604xe6b563c32c3a90b2@mail.gmail.com \
    --to=tony.luck@gmail.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rdreier@cisco.com \
    --subject='Re: Strange hang on ia64 with CONFIG_PRINTK_TIME=y' \
    /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

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).