mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] x86/smpboot: set topology CPU mask before use.
@ 2017-11-21  2:02 ning.a.zhang
  0 siblings, 0 replies; only message in thread
From: ning.a.zhang @ 2017-11-21  2:02 UTC (permalink / raw)
  To: linux-kernel; +Cc: ning.a.zhang

From: Zhang Ning <ning.a.zhang@intel.com>

we detect topology CPU mask in tsc is used before it is set, it leads
to longer bootup time.

let's check the code.

smpboot.c:smp_callin()
     ---> calibarate.c:calibrate_delay()
          ---> tsc.c: calibrate_delay_is_known()
               ---> topology_core_cpumask(): read topology CPU mask
     ---> set_cpu_sibling_map(raw_smp_processor_id())
          ---> cpumask_set_cpu(cpu, topology_core_cpumask(cpu));

from the calling chain, we know topology CPU mask is used before it
actually set.

So move set_cpu_sibling_map before calibrate_delay.

Change-Id: I4eb8facb8751fe7aa2c6d2eac32437266d92ec00
Signed-off-by: Zhang Ning <ning.a.zhang@intel.com>
---
 arch/x86/kernel/smpboot.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 36171bcd91f8..acee1ca3ef43 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -181,6 +181,12 @@ static void smp_callin(void)
 	smp_store_cpu_info(cpuid);
 
 	/*
+	 * This must be done before setting cpu_online_mask
+	 * or calling notify_cpu_starting.
+	 */
+	set_cpu_sibling_map(raw_smp_processor_id());
+
+	/*
 	 * Get our bogomips.
 	 * Update loops_per_jiffy in cpu_data. Previous call to
 	 * smp_store_cpu_info() stored a value that is close but not as
@@ -190,11 +196,7 @@ static void smp_callin(void)
 	cpu_data(cpuid).loops_per_jiffy = loops_per_jiffy;
 	pr_debug("Stack at about %p\n", &cpuid);
 
-	/*
-	 * This must be done before setting cpu_online_mask
-	 * or calling notify_cpu_starting.
-	 */
-	set_cpu_sibling_map(raw_smp_processor_id());
+
 	wmb();
 
 	notify_cpu_starting(cpuid);
-- 
2.11.0

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-11-21  2:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-21  2:02 [PATCH] x86/smpboot: set topology CPU mask before use ning.a.zhang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®