From: "Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>
To: James Hogan <james.hogan@imgtec.com>
Cc: linux-kernel@vger.kernel.org, Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH 3/5] metag: smp: don't spin waiting for CPU to start
Date: Tue, 02 Jul 2013 11:42:39 +0530 [thread overview]
Message-ID: <51D26F57.8030400@linux.vnet.ibm.com> (raw)
In-Reply-To: <1372694659-30176-4-git-send-email-james.hogan@imgtec.com>
On 07/01/2013 09:34 PM, James Hogan wrote:
> Use a completion to block until a secondary CPU has started up, like ARM
> do, instead of a loop of udelays.
>
> On Meta, SMP is really SMT, with each "CPU" being a different hardware
> thread on the same Meta processor core, so as well as being more
> efficient and latency friendly, using a completion prevents the bogomips
> of the secondary CPU from being drastically skewed every time by the
> execution of the tight in-cache udelay loop on the other CPU.
>
> Signed-off-by: James Hogan <james.hogan@imgtec.com>
> Cc: "Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> ---
Reviewed-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Regards,
Srivatsa S. Bhat
> arch/metag/kernel/smp.c | 16 ++++++----------
> 1 file changed, 6 insertions(+), 10 deletions(-)
>
> diff --git a/arch/metag/kernel/smp.c b/arch/metag/kernel/smp.c
> index 09979f2..e413875 100644
> --- a/arch/metag/kernel/smp.c
> +++ b/arch/metag/kernel/smp.c
> @@ -8,6 +8,7 @@
> * published by the Free Software Foundation.
> */
> #include <linux/atomic.h>
> +#include <linux/completion.h>
> #include <linux/delay.h>
> #include <linux/init.h>
> #include <linux/spinlock.h>
> @@ -62,6 +63,8 @@ static DEFINE_PER_CPU(struct ipi_data, ipi_data) = {
>
> static DEFINE_SPINLOCK(boot_lock);
>
> +static DECLARE_COMPLETION(cpu_running);
> +
> /*
> * "thread" is assumed to be a valid Meta hardware thread ID.
> */
> @@ -235,20 +238,12 @@ int __cpuinit __cpu_up(unsigned int cpu, struct task_struct *idle)
> */
> ret = boot_secondary(thread, idle);
> if (ret == 0) {
> - unsigned long timeout;
> -
> /*
> * CPU was successfully started, wait for it
> * to come online or time out.
> */
> - timeout = jiffies + HZ;
> - while (time_before(jiffies, timeout)) {
> - if (cpu_online(cpu))
> - break;
> -
> - udelay(10);
> - barrier();
> - }
> + wait_for_completion_timeout(&cpu_running,
> + msecs_to_jiffies(1000));
>
> if (!cpu_online(cpu))
> ret = -EIO;
> @@ -391,6 +386,7 @@ asmlinkage void secondary_start_kernel(void)
> * OK, now it's safe to let the boot CPU continue
> */
> set_cpu_online(cpu, true);
> + complete(&cpu_running);
>
> /*
> * Enable local interrupts.
>
next prev parent reply other threads:[~2013-07-02 6:16 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-01 16:04 [PATCH 0/5] metag: smp/hotplug fixes James Hogan
2013-07-01 16:04 ` [PATCH 1/5] metag: use clear_tasks_mm_cpumask() James Hogan
2013-07-01 16:04 ` [PATCH 2/5] metag: smp: enable irqs after set_cpu_online James Hogan
2013-07-01 21:42 ` Thomas Gleixner
2013-07-02 5:57 ` Srivatsa S. Bhat
2013-07-01 16:04 ` [PATCH 3/5] metag: smp: don't spin waiting for CPU to start James Hogan
2013-07-01 21:46 ` Thomas Gleixner
2013-07-01 22:02 ` James Hogan
2013-07-02 6:12 ` Srivatsa S. Bhat [this message]
2013-07-01 16:04 ` [PATCH 4/5] metag: kick: prevent nested kick handlers James Hogan
2013-07-01 21:51 ` Thomas Gleixner
2013-07-01 22:17 ` James Hogan
2013-07-01 22:56 ` Thomas Gleixner
2013-07-02 0:00 ` James Hogan
2013-07-01 16:04 ` [PATCH 5/5] metag: cpu hotplug: route_irq: preserve irq mask James Hogan
2013-07-01 21:51 ` Thomas Gleixner
2013-07-02 6:16 ` Srivatsa S. Bhat
2013-07-02 9:59 ` James Hogan
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=51D26F57.8030400@linux.vnet.ibm.com \
--to=srivatsa.bhat@linux.vnet.ibm.com \
--cc=james.hogan@imgtec.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
/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
Powered by JetHome