public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: Andi Kleen <ak@suse.de>
Cc: 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: Sun, 16 Jan 2005 17:42:02 +1100	[thread overview]
Message-ID: <1105857722.24045.22.camel@localhost.localdomain> (raw)
In-Reply-To: <20050116053424.GB2489@wotan.suse.de>

On Sun, 2005-01-16 at 06:34 +0100, Andi Kleen wrote:
> On Sun, Jan 16, 2005 at 03:20:47PM +1100, Rusty Russell wrote:
> > But adding a bizarro "pre-prepare" notifier verged on nonsensical 8(.  I
> 
> I don't see the big issue. Preparse is just not as early as you thought.

State machine for non-boot CPUs currently goes:

 ------------
|            v
|	CPU_UP_PREPARE <-----
|	     |		     |
|	     v		     |
|	__cpu_up() ---> CPU_UP_CANCELED
|	     |
|	     v
|	CPU_ONLINE
|	     |
|	     v
|	CPU_DOWN_PREPARE <----
|	     |		      |
|	     v	              |
|	__cpu_down()---> CPU_DOWN_FAILED
|	     |
|	     v
|	CPU_DEAD
|	     |
 ------------

You've tacked a CPU_UP_PREPARE_EARLY above this state for two
architectures, which only gets called at boot, and only is used by
timers, to fix the fact that those archs don't actually follow this
state machine yet.

And sure enough, you've added a potential bug, since timer_jiffies
doesn't get reset to jiffies when a CPU comes back up.  Really, a
specific hack as below is required.

> > I'm also not clear on why we need to enable interrupts around
> > calibrate_delay() on secondary processors, but I'll try that too and
> > find out 8)
> 
> Because you cannot calibrate the timer without a timer tick.

AFAICT from a quick reading, that's not true.  CPU0 will bump the
jiffies, which is all you need: local interrupts not required.

> Even if you changed that it wouldn't help because the race can
> as well happen in the idle loop on the secondaries.

Again, I don't think so: the other CPUs are sitting in start_secondary()
waiting for __cpu_up().

As I said, I will try it and see.  It would certainly be the nicest
solution.  If not, I'll code a "timer_smp_boot_init()" function for x86
myself.

Cheers,
Rusty.
-- 
A bad analogy is like a leaky screwdriver -- Richard Braakman


  reply	other threads:[~2005-01-16  6:42 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
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 [this message]
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=1105857722.24045.22.camel@localhost.localdomain \
    --to=rusty@rustcorp.com.au \
    --cc=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=discuss@x86-64.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manpreet@fabric7.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