[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-947134d9b00f342415af7eddd42a5fce7262a1b9@git.kernel.org>
Date: Thu, 7 Dec 2017 01:40:09 -0800
From: tip-bot for Prarit Bhargava <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, williams@...hat.com, hpa@...or.com,
mingo@...nel.org, tglx@...utronix.de, prarit@...hat.com,
kubakici@...pl
Subject: [tip:x86/urgent] x86/smpboot: Do not use smp_num_siblings in
__max_logical_packages calculation
Commit-ID: 947134d9b00f342415af7eddd42a5fce7262a1b9
Gitweb: https://git.kernel.org/tip/947134d9b00f342415af7eddd42a5fce7262a1b9
Author: Prarit Bhargava <prarit@...hat.com>
AuthorDate: Mon, 4 Dec 2017 11:45:21 -0500
Committer: Thomas Gleixner <tglx@...utronix.de>
CommitDate: Thu, 7 Dec 2017 10:28:22 +0100
x86/smpboot: 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(), which contains the active numer of threads,
in the __max_logical_packages calculation.
On a single socket, single core, single thread system __max_smt_threads has
not been updated when the __max_logical_packages calculation happens, so its
zero which makes the package estimate fail. Initialize it to one, which is
the minimum number of threads on a core.
[ tglx: Folded the __max_smt_threads fix in ]
Fixes: b4c0a7326f5d ("x86/smpboot: Fix __max_logical_packages estimate")
Reported-by: Jakub Kicinski <kubakici@...pl>
Signed-off-by: Prarit Bhargava <prarit@...hat.com
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Tested-by: Jakub Kicinski <kubakici@...pl>
Cc: netdev@...r.kernel.org
Cc: "netdev@...r.kernel.org"
Cc: Clark Williams <williams@...hat.com>
Link: https://lkml.kernel.org/r/20171204164521.17870-1-prarit@redhat.com
---
arch/x86/kernel/smpboot.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 05a97d5..35cb20994 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -106,7 +106,7 @@ EXPORT_SYMBOL(__max_logical_packages);
static unsigned int logical_packages __read_mostly;
/* Maximum number of SMT threads on any online core */
-int __max_smt_threads __read_mostly;
+int __read_mostly __max_smt_threads = 1;
/* Flag to indicate if a complete sched domain rebuild is required */
bool x86_topology_update;
@@ -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);
Powered by blists - more mailing lists