From: Prarit Bhargava <prarit@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: Prarit Bhargava <prarit@redhat.com>,
Prarit@vger.kernel.org, Jakub Kicinski <kubakici@wp.pl>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Clark Williams <williams@redhat.com>
Subject: Re: [bisected] x86 boot still broken on -rc2
Date: Mon, 4 Dec 2017 11:45:21 -0500 [thread overview]
Message-ID: <20171204164521.17870-1-prarit@redhat.com> (raw)
In-Reply-To: <b7e29d24-2317-2355-65aa-04978bd45add@redhat.com>
On 12/04/2017 08:13 AM, Prarit Bhargava wrote:
>
>
> x86: Booting SMP configuration:
> .... node #0, CPUs: #1 #2 #3 #4
> .... node #1, CPUs: #5 #6 #7 #8 #9
> .... node #0, CPUs: #10 #11 #12 #13 #14
> .... node #1, CPUs: #15 #16 #17 #18 #19
> smp: Brought up 2 nodes, 20 CPUs
> smpboot: Max logical packages: 1
>
> which means that the calculation of logical packages is wrong because
>
> ncpus = cpu_data(0).booted_cores * smp_num_siblings;
> ncpus = 10 * 2;
> ncpus = 20;
>
> smp_num_siblings is defined as "The number of threads in a core" which
> should be 1 if HT/SMT is disabled.
>
> It looks like my patch has exposed a bug in the
> smp_num_siblings calculation. I'm still debugging ...
The bug is that smp_num_siblings has been incorrectly calculated as the
*maximum* number of threads in a core, and not the actual number of threads in
a core on systems which have a CPUID level greater than 0xb. (see
arch/x86/kernel/cpu/topology.c:59)
That will take some time to investigate and come up with a proper solution and
fix. In the meantime, the patch below will fix the problem in the short-term.
I've tested the patch using SMT enabled, SMT disabled, maxcpus=1 and nr_cpus=1.
tglx, Please revert b4c0a7326f5d ("x86/smpboot: Fix __max_logical_packages
estimate") if you think that is a better option. The problem with
smp_num_siblings has been around for almost a decade.
P.
---8<---
Subject: [PATCH] arch/x86: Do not use smp_num_siblings in
__max_logical_packages calculation
Documentation/x86/topology.txt defines smp_num_siblings as "The number of
threads in a core". Since commit bbb65d2d365e ("x86: use cpuid vector 0xb
when available for detecting cpu topology") smp_num_siblings is the
maximum number of threads in a core. If Simultaneous MultiThreading
(SMT) is disabled on a system, smp_num_siblings is 2 and not 1 as
expected.
Use topology_max_smt_threads() in the __max_logical_packages calculation.
Signed-off-by: Prarit Bhargava <prarit@redhat.com
Cc: Jakub Kicinski <kubakici@wp.pl>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Clark Williams <williams@redhat.com>
---
arch/x86/kernel/smpboot.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 3d01df7d7cf6..eaee15fb7d8b 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -1304,7 +1304,7 @@ void __init native_smp_cpus_done(unsigned int max_cpus)
* Today neither Intel nor AMD support heterogenous systems so
* extrapolate the boot cpu's data to all packages.
*/
- ncpus = cpu_data(0).booted_cores * smp_num_siblings;
+ ncpus = cpu_data(0).booted_cores * topology_max_smt_threads();
__max_logical_packages = DIV_ROUND_UP(nr_cpu_ids, ncpus);
pr_info("Max logical packages: %u\n", __max_logical_packages);
--
1.8.3.1
next prev parent reply other threads:[~2017-12-04 16:45 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-02 0:39 x86 boot broken on -rc1? Jakub Kicinski
2017-12-04 1:28 ` [bisected] x86 boot still broken on -rc2 Jakub Kicinski
2017-12-04 12:28 ` Prarit Bhargava
2017-12-04 13:13 ` Prarit Bhargava
2017-12-04 16:45 ` Prarit Bhargava [this message]
2017-12-04 19:48 ` Jakub Kicinski
2017-12-13 19:37 ` x86 boot broken on -rc1? Björn Töpel
2017-12-13 19:58 ` Jakub Kicinski
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=20171204164521.17870-1-prarit@redhat.com \
--to=prarit@redhat.com \
--cc=Prarit@vger.kernel.org \
--cc=kubakici@wp.pl \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=williams@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox