All of lore.kernel.org
 help / color / mirror / Atom feed
From: Santosh Shilimkar <santosh.shilimkar@ti.com>
To: linux-arm-kernel@lists.infradead.org
Cc: linux-omap@vger.kernel.org, ccross@android.com,
	catalin.marinas@arm.com, linux@arm.linux.org.uk,
	linus.ml.walleij@gmail.com,
	Santosh Shilimkar <santosh.shilimkar@ti.com>,
	Russell King <rmk+kernel@arm.linux.org.uk>
Subject: [PATCH 5/5] ARM: smp: Skip secondary cpu calibration to speed-up boot
Date: Mon, 24 Jan 2011 14:21:19 +0530	[thread overview]
Message-ID: <1295859080-15259-6-git-send-email-santosh.shilimkar@ti.com> (raw)
In-Reply-To: <1295859080-15259-1-git-send-email-santosh.shilimkar@ti.com>

On some architectures, secondary cores shares clock with primiary
core and hence scale together. Hence secondary core lpj calibration
is not necessary and can be skipped to save considerable time.

This can speed up the secondary cpu boot and hotplug cpu online
paths.

The patch is still under discussion and relevant thread is
here.
	http://www.mail-archive.com/linux-omap@vger.kernel.org/msg42902.html

Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Cc: Russell King <rmk+kernel@arm.linux.org.uk>
---
 arch/arm/include/asm/smp.h     |    8 ++++++++
 arch/arm/kernel/smp.c          |   35 ++++++++++++++++++++++++++---------
 arch/arm/mach-omap2/omap-smp.c |    3 +++
 3 files changed, 37 insertions(+), 9 deletions(-)

diff --git a/arch/arm/include/asm/smp.h b/arch/arm/include/asm/smp.h
index 96ed521..150d202 100644
--- a/arch/arm/include/asm/smp.h
+++ b/arch/arm/include/asm/smp.h
@@ -69,6 +69,14 @@ asmlinkage void secondary_start_kernel(void);
 extern void platform_secondary_init(unsigned int cpu);
 
 /*
+ * Skip the secondary calibration on architectures sharing clock
+ * with primary cpu. Needs to be called for archs inside
+ * platform_secondary_init()
+ */
+extern void secondary_skip_calibrate(void);
+
+
+/*
  * Initialize cpu_possible map, and enable coherency
  */
 extern void platform_smp_prepare_cpus(unsigned int);
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index 4539ebc..6aa99bc 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -55,6 +55,8 @@ enum ipi_msg_type {
 	IPI_CPU_STOP,
 };
 
+static unsigned int skip_secondary_calibrate;
+
 int __cpuinit __cpu_up(unsigned int cpu)
 {
 	struct cpuinfo_arm *ci = &per_cpu(cpu_data, cpu);
@@ -270,6 +272,16 @@ static void __cpuinit smp_store_cpu_info(unsigned int cpuid)
 }
 
 /*
+ * Skip the secondary calibration on architectures sharing clock
+ * with primary cpu. Needs to be called for archs from
+ * platform_secondary_init()
+ */
+void secondary_skip_calibrate(void)
+{
+	skip_secondary_calibrate = 1;
+}
+
+/*
  * This is the secondary CPU boot entry.  We're using this CPUs
  * idle thread stack, but a set of temporary page tables.
  */
@@ -312,7 +324,8 @@ asmlinkage void __cpuinit secondary_start_kernel(void)
 	 */
 	percpu_timer_setup();
 
-	calibrate_delay();
+	if (!skip_secondary_calibrate)
+		calibrate_delay();
 
 	smp_store_cpu_info(cpu);
 
@@ -330,16 +343,20 @@ asmlinkage void __cpuinit secondary_start_kernel(void)
 void __init smp_cpus_done(unsigned int max_cpus)
 {
 	int cpu;
-	unsigned long bogosum = 0;
+	char bogosum[32];
+	unsigned long bogosums = 0;
+
+	if (!skip_secondary_calibrate) {
+		for_each_online_cpu(cpu)
+			bogosums += per_cpu(cpu_data, cpu).loops_per_jiffy;
 
-	for_each_online_cpu(cpu)
-		bogosum += per_cpu(cpu_data, cpu).loops_per_jiffy;
+		snprintf(bogosum, sizeof(bogosums), " (%lu.%02lu BogoMIPS).\n",
+			bogosums / (500000/HZ), (bogosums / (5000/HZ)) % 100);
+	} else
+		bogosum[0] = '\0';
 
-	printk(KERN_INFO "SMP: Total of %d processors activated "
-	       "(%lu.%02lu BogoMIPS).\n",
-	       num_online_cpus(),
-	       bogosum / (500000/HZ),
-	       (bogosum / (5000/HZ)) % 100);
+	pr_info("SMP: Total of %d processors activated%s.\n",
+		num_online_cpus(), bogosum);
 }
 
 void __init smp_prepare_boot_cpu(void)
diff --git a/arch/arm/mach-omap2/omap-smp.c b/arch/arm/mach-omap2/omap-smp.c
index b66cfe8..7342cd5 100644
--- a/arch/arm/mach-omap2/omap-smp.c
+++ b/arch/arm/mach-omap2/omap-smp.c
@@ -39,6 +39,9 @@ void __cpuinit platform_secondary_init(unsigned int cpu)
 	 */
 	gic_secondary_init(0);
 
+	/* Allow to skip secondary CPU calibration */
+	secondary_skip_calibrate();
+
 	/*
 	 * Synchronise with the boot thread.
 	 */
-- 
1.6.0.4


WARNING: multiple messages have this Message-ID (diff)
From: santosh.shilimkar@ti.com (Santosh Shilimkar)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 5/5] ARM: smp: Skip secondary cpu calibration to speed-up boot
Date: Mon, 24 Jan 2011 14:21:19 +0530	[thread overview]
Message-ID: <1295859080-15259-6-git-send-email-santosh.shilimkar@ti.com> (raw)
In-Reply-To: <1295859080-15259-1-git-send-email-santosh.shilimkar@ti.com>

On some architectures, secondary cores shares clock with primiary
core and hence scale together. Hence secondary core lpj calibration
is not necessary and can be skipped to save considerable time.

This can speed up the secondary cpu boot and hotplug cpu online
paths.

The patch is still under discussion and relevant thread is
here.
	http://www.mail-archive.com/linux-omap at vger.kernel.org/msg42902.html

Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Cc: Russell King <rmk+kernel@arm.linux.org.uk>
---
 arch/arm/include/asm/smp.h     |    8 ++++++++
 arch/arm/kernel/smp.c          |   35 ++++++++++++++++++++++++++---------
 arch/arm/mach-omap2/omap-smp.c |    3 +++
 3 files changed, 37 insertions(+), 9 deletions(-)

diff --git a/arch/arm/include/asm/smp.h b/arch/arm/include/asm/smp.h
index 96ed521..150d202 100644
--- a/arch/arm/include/asm/smp.h
+++ b/arch/arm/include/asm/smp.h
@@ -69,6 +69,14 @@ asmlinkage void secondary_start_kernel(void);
 extern void platform_secondary_init(unsigned int cpu);
 
 /*
+ * Skip the secondary calibration on architectures sharing clock
+ * with primary cpu. Needs to be called for archs inside
+ * platform_secondary_init()
+ */
+extern void secondary_skip_calibrate(void);
+
+
+/*
  * Initialize cpu_possible map, and enable coherency
  */
 extern void platform_smp_prepare_cpus(unsigned int);
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index 4539ebc..6aa99bc 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -55,6 +55,8 @@ enum ipi_msg_type {
 	IPI_CPU_STOP,
 };
 
+static unsigned int skip_secondary_calibrate;
+
 int __cpuinit __cpu_up(unsigned int cpu)
 {
 	struct cpuinfo_arm *ci = &per_cpu(cpu_data, cpu);
@@ -270,6 +272,16 @@ static void __cpuinit smp_store_cpu_info(unsigned int cpuid)
 }
 
 /*
+ * Skip the secondary calibration on architectures sharing clock
+ * with primary cpu. Needs to be called for archs from
+ * platform_secondary_init()
+ */
+void secondary_skip_calibrate(void)
+{
+	skip_secondary_calibrate = 1;
+}
+
+/*
  * This is the secondary CPU boot entry.  We're using this CPUs
  * idle thread stack, but a set of temporary page tables.
  */
@@ -312,7 +324,8 @@ asmlinkage void __cpuinit secondary_start_kernel(void)
 	 */
 	percpu_timer_setup();
 
-	calibrate_delay();
+	if (!skip_secondary_calibrate)
+		calibrate_delay();
 
 	smp_store_cpu_info(cpu);
 
@@ -330,16 +343,20 @@ asmlinkage void __cpuinit secondary_start_kernel(void)
 void __init smp_cpus_done(unsigned int max_cpus)
 {
 	int cpu;
-	unsigned long bogosum = 0;
+	char bogosum[32];
+	unsigned long bogosums = 0;
+
+	if (!skip_secondary_calibrate) {
+		for_each_online_cpu(cpu)
+			bogosums += per_cpu(cpu_data, cpu).loops_per_jiffy;
 
-	for_each_online_cpu(cpu)
-		bogosum += per_cpu(cpu_data, cpu).loops_per_jiffy;
+		snprintf(bogosum, sizeof(bogosums), " (%lu.%02lu BogoMIPS).\n",
+			bogosums / (500000/HZ), (bogosums / (5000/HZ)) % 100);
+	} else
+		bogosum[0] = '\0';
 
-	printk(KERN_INFO "SMP: Total of %d processors activated "
-	       "(%lu.%02lu BogoMIPS).\n",
-	       num_online_cpus(),
-	       bogosum / (500000/HZ),
-	       (bogosum / (5000/HZ)) % 100);
+	pr_info("SMP: Total of %d processors activated%s.\n",
+		num_online_cpus(), bogosum);
 }
 
 void __init smp_prepare_boot_cpu(void)
diff --git a/arch/arm/mach-omap2/omap-smp.c b/arch/arm/mach-omap2/omap-smp.c
index b66cfe8..7342cd5 100644
--- a/arch/arm/mach-omap2/omap-smp.c
+++ b/arch/arm/mach-omap2/omap-smp.c
@@ -39,6 +39,9 @@ void __cpuinit platform_secondary_init(unsigned int cpu)
 	 */
 	gic_secondary_init(0);
 
+	/* Allow to skip secondary CPU calibration */
+	secondary_skip_calibrate();
+
 	/*
 	 * Synchronise with the boot thread.
 	 */
-- 
1.6.0.4

  parent reply	other threads:[~2011-01-24  8:51 UTC|newest]

Thread overview: 132+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-24  8:51 [PATCH 0/5] ARM: Few patches for PM enablement Santosh Shilimkar
2011-01-24  8:51 ` Santosh Shilimkar
2011-01-24  8:51 ` [PATCH 1/5] ARM: gic: Add hooks for architecture specific extensions Santosh Shilimkar
2011-01-24  8:51   ` Santosh Shilimkar
2011-01-25  3:03   ` Colin Cross
2011-01-25  3:03     ` Colin Cross
2011-01-25 20:54     ` Colin Cross
2011-01-25 20:54       ` Colin Cross
2011-01-26  7:22       ` Santosh Shilimkar
2011-01-26  7:22         ` Santosh Shilimkar
2011-01-26  7:23         ` Colin Cross
2011-01-26  7:23           ` Colin Cross
2011-01-26  7:31           ` Santosh Shilimkar
2011-01-26  7:31             ` Santosh Shilimkar
2011-01-26  7:52             ` Colin Cross
2011-01-26  7:52               ` Colin Cross
2011-01-26  7:55               ` Santosh Shilimkar
2011-01-26  7:55                 ` Santosh Shilimkar
2011-01-24  8:51 ` [PATCH 2/5] ARM: gic: Add distributor and interface enable/disable accessory api Santosh Shilimkar
2011-01-24  8:51   ` Santosh Shilimkar
2011-03-01  5:58   ` Santosh Shilimkar
2011-03-01  5:58     ` Santosh Shilimkar
2011-01-24  8:51 ` [PATCH 3/5] ARM: twd: Add context save restore support Santosh Shilimkar
2011-01-24  8:51   ` Santosh Shilimkar
2011-01-24 11:06   ` Russell King - ARM Linux
2011-01-24 11:06     ` Russell King - ARM Linux
2011-01-24 11:11     ` Russell King - ARM Linux
2011-01-24 11:11       ` Russell King - ARM Linux
2011-01-24 11:16       ` Santosh Shilimkar
2011-01-24 11:16         ` Santosh Shilimkar
2011-01-25  7:39       ` Colin Cross
2011-01-25  7:39         ` Colin Cross
2011-01-25 10:32         ` Russell King - ARM Linux
2011-01-25 10:32           ` Russell King - ARM Linux
2011-01-25 13:23           ` Thomas Gleixner
2011-01-25 13:23             ` Thomas Gleixner
2011-01-25 13:37             ` Russell King - ARM Linux
2011-01-25 13:37               ` Russell King - ARM Linux
2011-01-25 13:55               ` Santosh Shilimkar
2011-01-25 13:55                 ` Santosh Shilimkar
2011-01-25 14:12               ` Thomas Gleixner
2011-01-25 14:12                 ` Thomas Gleixner
2011-01-25 14:15                 ` Russell King - ARM Linux
2011-01-25 14:15                   ` Russell King - ARM Linux
2011-01-25 14:24                   ` Thomas Gleixner
2011-01-25 14:24                     ` Thomas Gleixner
2011-01-25 16:04               ` Santosh Shilimkar
2011-01-25 16:04                 ` Santosh Shilimkar
2011-01-25 16:13                 ` Russell King - ARM Linux
2011-01-25 16:13                   ` Russell King - ARM Linux
2011-01-25 16:14                   ` Santosh Shilimkar
2011-01-25 16:14                     ` Santosh Shilimkar
2011-01-25 11:29         ` Russell King - ARM Linux
2011-01-25 11:29           ` Russell King - ARM Linux
2011-01-25 11:40           ` Santosh Shilimkar
2011-01-25 11:40             ` Santosh Shilimkar
2011-01-25 11:48             ` Russell King - ARM Linux
2011-01-25 11:48               ` Russell King - ARM Linux
2011-01-25 12:08               ` Santosh Shilimkar
2011-01-25 12:08                 ` Santosh Shilimkar
2011-01-25 12:17                 ` Russell King - ARM Linux
2011-01-25 12:17                   ` Russell King - ARM Linux
2011-01-25 12:20                   ` Santosh Shilimkar
2011-01-25 12:20                     ` Santosh Shilimkar
2011-01-25 18:44           ` Colin Cross
2011-01-25 18:44             ` Colin Cross
2011-01-24 11:14     ` Santosh Shilimkar
2011-01-24 11:14       ` Santosh Shilimkar
2011-01-24  8:51 ` [PATCH 4/5] ARM: scu: Move register defines to header file Santosh Shilimkar
2011-01-24  8:51   ` Santosh Shilimkar
2011-01-25 11:46   ` Russell King - ARM Linux
2011-01-25 11:46     ` Russell King - ARM Linux
2011-01-25 12:02     ` Santosh Shilimkar
2011-01-25 12:02       ` Santosh Shilimkar
2011-01-25 12:16       ` Russell King - ARM Linux
2011-01-25 12:16         ` Russell King - ARM Linux
2011-01-25 12:29         ` Russell King - ARM Linux
2011-01-25 12:29           ` Russell King - ARM Linux
2011-01-25 12:39           ` Santosh Shilimkar
2011-01-25 12:39             ` Santosh Shilimkar
2011-01-25 12:36         ` Santosh Shilimkar
2011-01-25 12:36           ` Santosh Shilimkar
2011-01-25 12:56           ` Russell King - ARM Linux
2011-01-25 12:56             ` Russell King - ARM Linux
2011-01-25 13:04             ` Russell King - ARM Linux
2011-01-25 13:04               ` Russell King - ARM Linux
2011-01-25 13:06               ` Russell King - ARM Linux
2011-01-25 13:06                 ` Russell King - ARM Linux
2011-01-25 18:23                 ` Santosh Shilimkar
2011-01-25 18:23                   ` Santosh Shilimkar
2011-02-04 10:41                   ` Russell King - ARM Linux
2011-02-04 10:41                     ` Russell King - ARM Linux
2011-02-04 10:46                     ` Santosh Shilimkar
2011-02-04 10:46                       ` Santosh Shilimkar
2011-02-04 11:30                       ` Russell King - ARM Linux
2011-02-04 11:30                         ` Russell King - ARM Linux
2011-02-04 11:34                         ` Santosh Shilimkar
2011-02-04 11:34                           ` Santosh Shilimkar
2011-02-07  9:51                         ` Santosh Shilimkar
2011-02-07  9:51                           ` Santosh Shilimkar
2011-02-07 10:18                           ` Russell King - ARM Linux
2011-02-07 10:18                             ` Russell King - ARM Linux
2011-02-07 10:21                             ` Santosh Shilimkar
2011-02-07 10:21                               ` Santosh Shilimkar
2011-02-07 10:23                               ` Russell King - ARM Linux
2011-02-07 10:23                                 ` Russell King - ARM Linux
2011-02-07 10:30                                 ` Santosh Shilimkar
2011-02-07 10:30                                   ` Santosh Shilimkar
2011-02-10 14:49                             ` Santosh Shilimkar
2011-02-10 14:49                               ` Santosh Shilimkar
2011-02-10 16:13                               ` Russell King - ARM Linux
2011-02-10 16:13                                 ` Russell King - ARM Linux
2011-02-10 16:26                                 ` Santosh Shilimkar
2011-02-10 16:26                                   ` Santosh Shilimkar
2011-01-25 13:05             ` Santosh Shilimkar
2011-01-25 13:05               ` Santosh Shilimkar
2011-01-25 13:41           ` Russell King - ARM Linux
2011-01-25 13:41             ` Russell King - ARM Linux
2011-01-25 13:47             ` Santosh Shilimkar
2011-01-25 13:47               ` Santosh Shilimkar
2011-01-24  8:51 ` Santosh Shilimkar [this message]
2011-01-24  8:51   ` [PATCH 5/5] ARM: smp: Skip secondary cpu calibration to speed-up boot Santosh Shilimkar
2011-01-24 10:30   ` Russell King - ARM Linux
2011-01-24 10:30     ` Russell King - ARM Linux
2011-01-24  8:51 ` Santosh Shilimkar
2011-01-24  8:51   ` Santosh Shilimkar
2011-01-24  8:55   ` Santosh Shilimkar
2011-01-24  8:55     ` Santosh Shilimkar
2011-02-04 10:19 ` [PATCH 0/5] ARM: Few patches for PM enablement Santosh Shilimkar
2011-02-04 10:19   ` Santosh Shilimkar
2011-02-11 14:24   ` Santosh Shilimkar
2011-02-11 14:24     ` Santosh Shilimkar

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=1295859080-15259-6-git-send-email-santosh.shilimkar@ti.com \
    --to=santosh.shilimkar@ti.com \
    --cc=catalin.marinas@arm.com \
    --cc=ccross@android.com \
    --cc=linus.ml.walleij@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=rmk+kernel@arm.linux.org.uk \
    /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.