From: Joel Schopp <jschopp@austin.ibm.com>
To: vatsa@in.ibm.com
Cc: Andrew Morton <akpm@osdl.org>,
Nathan Lynch <nathanl@austin.ibm.com>,
anton@samba.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ppc64: Fix cpu_up race
Date: Fri, 30 Jul 2004 14:03:31 -0500 [thread overview]
Message-ID: <410A9B83.9050303@austin.ibm.com> (raw)
In-Reply-To: <20040730052413.GB32010@in.ibm.com>
I've tested this patch extensively and it does fix the race.
In more detail the race is that the cpu can be running before it is
marked in the cpu_online_map. While running it can go idle and the idle
loop checks cpu_online_map, sees that it is not set, and assumes that a
hotplug remove is in progress and that it should stop itself. By the
time the cpu is marked online it is stopped.
Srivatsa Vaddagiri wrote:
> On Thu, Jul 29, 2004 at 03:30:11PM +1000, Anton Blanchard wrote:
>
>>
>>
>>>I think Anton pushed this to ameslab. I presume there should be some mechanism
>>>for ameslab stuff to be included mainline. If there is such mechanism, then
>>>I dont want to push the patch myself.
>>
>>It looks good, could you send it directly to akpm, ccing me?
>
>
> Andrew,
> Patch below fixes a cpu_up race in PPC64. Please apply.
>
>
> Signed-off-by : Srivatsa Vaddagiri <vatsa@in.ibm.com>
> Signed-off-by : Anton Blanchard <anton@samba.org>
>
>
> ---
>
> linux-2.6.8-rc2-vatsa/arch/ppc64/kernel/smp.c | 10 +++++++++-
> 1 files changed, 9 insertions(+), 1 deletion(-)
>
> diff -puN arch/ppc64/kernel/smp.c~ppc64_cpu_up_fix arch/ppc64/kernel/smp.c
> --- linux-2.6.8-rc2/arch/ppc64/kernel/smp.c~ppc64_cpu_up_fix 2004-07-30 10:33:55.000000000 +0530
> +++ linux-2.6.8-rc2-vatsa/arch/ppc64/kernel/smp.c 2004-07-30 10:34:02.000000000 +0530
> @@ -927,7 +927,11 @@ int __devinit __cpu_up(unsigned int cpu)
>
> if (smp_ops->give_timebase)
> smp_ops->give_timebase();
> - cpu_set(cpu, cpu_online_map);
> +
> + /* Wait until cpu puts itself in the online map */
> + while (!cpu_online(cpu))
> + cpu_relax();
> +
> return 0;
> }
>
> @@ -963,6 +967,10 @@ int __devinit start_secondary(void *unus
> #endif
> #endif
>
> + spin_lock(&call_lock);
> + cpu_set(cpu, cpu_online_map);
> + spin_unlock(&call_lock);
> +
> local_irq_enable();
>
> return cpu_idle(NULL);
>
> _
>
prev parent reply other threads:[~2004-07-30 19:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1091052774.24763.14.camel@pants.austin.ibm.com>
[not found] ` <20040729052716.GA24612@in.ibm.com>
[not found] ` <20040729053011.GC6456@krispykreme>
2004-07-30 5:24 ` [PATCH] ppc64: Fix cpu_up race Srivatsa Vaddagiri
2004-07-30 19:03 ` Joel Schopp [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=410A9B83.9050303@austin.ibm.com \
--to=jschopp@austin.ibm.com \
--cc=akpm@osdl.org \
--cc=anton@samba.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nathanl@austin.ibm.com \
--cc=vatsa@in.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.