public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <ak@suse.de>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: Andi Kleen <ak@suse.de>, Andrew Morton <akpm@osdl.org>,
	manpreet@fabric7.com,
	lkml - Kernel Mailing List <linux-kernel@vger.kernel.org>,
	discuss@x86-64.org
Subject: Re: [PATCH] i386/x86-64: Fix timer SMP bootup race
Date: Sat, 15 Jan 2005 06:23:11 +0100	[thread overview]
Message-ID: <20050115052311.GC22863@wotan.suse.de> (raw)
In-Reply-To: <1105765760.12263.12.camel@localhost.localdomain>

On Sat, Jan 15, 2005 at 04:09:19PM +1100, Rusty Russell wrote:
> On Sat, 2005-01-15 at 05:09 +0100, Andi Kleen wrote:
> > Fix boot up SMP race in timer setup on i386/x86-64.
> > 
> > This fixes a long standing race in 2.6 i386/x86-64 SMP boot.
> > The per CPU timers would only get initialized after an secondary
> > CPU was running. But during initialization the secondary CPU would
> > already enable interrupts to compute the jiffies. When a per 
> > CPU timer fired in this window it would run into a BUG in timer.c
> > because the timer heap for that CPU wasn't fully initialized.
> > 
> > The race only happens when a CPU takes a long time to boot
> > (e.g. very slow console output with debugging enabled).
> > 
> > To fix I added a new cpu notifier notifier command CPU_UP_PREPARE_EARLY
> > that is called before the secondary CPU is started. timer.c
> > uses that now to initialize the per CPU timers early before
> > the other CPU runs any Linux code.
> 
> Andi, that's horrible.  I suspect you know it's horrible and were hoping
> someone would fix it properly.  The semantics of CPU_UP_PREPARE are
> supposed to do this already.

I shortly considered redoing the boot process, but then it looked 
too risky to me. 

e.g. I guess on x86-64 it wouldn't be that difficult, just a bit of work,
but on i386 with all the weird hardware it could be quite destabilizing.
But doing it on x86-64 only is not a good solution.


> 
> The cause of this bug is that (1) i386 and x86_64 actually bring the
> secondary CPUs up at boot before the core code officially brings them up
> using cpu_up(), after the appropriate callbacks, and (2) they call into
> core code tp process timer interrupts before they've been officially
> brought up.
> 
> The former is because I just added a shim rather than rewriting the x86
> boot process, because it would have broken too much.  The fix is do the
> boot process properly, or to suppress the call to do_timer before the
> CPU is actually "up".

I don't see a better short term solution.

If you had done it properly in 2.5 it would be working and tested
by now ;-) , but doing it in the middle of 2.6 would seem a bit misplaced
to me.

-Andi

  reply	other threads:[~2005-01-15  5:23 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-15  4:09 [PATCH] i386/x86-64: Fix timer SMP bootup race Andi Kleen
2005-01-15  5:09 ` Rusty Russell
2005-01-15  5:23   ` Andi Kleen [this message]
2005-01-15  7:34     ` Rusty Russell
2005-01-15  7:40       ` Andrew Morton
2005-01-15  7:59       ` Andi Kleen
2005-01-16  4:20         ` Rusty Russell
2005-01-16  5:34           ` Andi Kleen
2005-01-16  6:42             ` Rusty Russell
2005-01-15  6:28 ` Andrew Morton
2005-01-15  6:43   ` Andi Kleen
2005-01-15  6:54     ` Andrew Morton
2005-01-15  7:18       ` Andi Kleen
2005-01-17  2:34 ` Rusty Russell
2005-01-17  5:43   ` Andi Kleen

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=20050115052311.GC22863@wotan.suse.de \
    --to=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=discuss@x86-64.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manpreet@fabric7.com \
    --cc=rusty@rustcorp.com.au \
    /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