mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: ning.a.zhang@intel.com
To: linux-kernel@vger.kernel.org
Cc: ning.a.zhang@intel.com
Subject: [PATCH] x86/smpboot: set topology CPU mask before use.
Date: Tue, 21 Nov 2017 10:02:46 +0800	[thread overview]
Message-ID: <20171121020246.22007-1-ning.a.zhang@intel.com> (raw)

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

                 reply	other threads:[~2017-11-21  2:02 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20171121020246.22007-1-ning.a.zhang@intel.com \
    --to=ning.a.zhang@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®