* [PATCH] x86/topology: use total_cpus for max logical packages calculation
@ 2018-11-07 2:36 Hui Wang
2018-12-18 12:42 ` [tip:x86/cpu] x86/topology: Use " tip-bot for Hui Wang
0 siblings, 1 reply; 2+ messages in thread
From: Hui Wang @ 2018-11-07 2:36 UTC (permalink / raw)
To: linux-kernel, tglx; +Cc: guijianfeng, wencongyang2, douliyang1, qiaonuohan
nr_cpu_ids can be limited on the command line via nr_cpus=. This can break the
logical package management because it results in a smaller number of packages
while in kdump kernel.
Check below case:
There is a two sockets system, each socket has 8 cores, which has 16 logical
cpus while HT was turn on.
0 1 2 3 4 5 6 7 | 16 17 18 19 20 21 22 23
cores on socket 0 threads on socket 0
8 9 10 11 12 13 14 15 | 24 25 26 27 28 29 30 31
cores on socket 1 threads on socket 1
While start kdump kernel with option nr_cpus=16, and panic was triggered on one
of the cpus 24-31 eg. 26, then online cpu will be 1-15, 26(cpu 0 was disabled in
kdump), ncpus will be 16 and __max_logical_packages will be 1, but actually two
packages were booted on.
This issue can reproduced by set kdump option nr_cpus=<real physical core
numbers>, and then trigger panic on last socket's thread, for example:
taskset -c 26 echo c > /proc/sysrq-trigger
Use total_cpus which will not be limited by nr_cpus command line to calculate
the value of __max_logical_packages.
Signed-off-by: Hui Wang <john.wanghui@huawei.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 a9134d1910b9..ccd1f2a8e557 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -1347,7 +1347,7 @@ void __init calculate_max_logical_packages(void)
* extrapolate the boot cpu's data to all packages.
*/
ncpus = cpu_data(0).booted_cores * topology_max_smt_threads();
- __max_logical_packages = DIV_ROUND_UP(nr_cpu_ids, ncpus);
+ __max_logical_packages = DIV_ROUND_UP(total_cpus, ncpus);
pr_info("Max logical packages: %u\n", __max_logical_packages);
}
--
2.17.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* [tip:x86/cpu] x86/topology: Use total_cpus for max logical packages calculation
2018-11-07 2:36 [PATCH] x86/topology: use total_cpus for max logical packages calculation Hui Wang
@ 2018-12-18 12:42 ` tip-bot for Hui Wang
0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for Hui Wang @ 2018-12-18 12:42 UTC (permalink / raw)
To: linux-tip-commits
Cc: qiaonuohan, wencongyang2, douliyang1, john.wanghui, guijianfeng,
linux-kernel, mingo, tglx, hpa
Commit-ID: aa02ef099cff042c2a9109782ec2bf1bffc955d4
Gitweb: https://git.kernel.org/tip/aa02ef099cff042c2a9109782ec2bf1bffc955d4
Author: Hui Wang <john.wanghui@huawei.com>
AuthorDate: Wed, 7 Nov 2018 10:36:43 +0800
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 18 Dec 2018 13:38:37 +0100
x86/topology: Use total_cpus for max logical packages calculation
nr_cpu_ids can be limited on the command line via nr_cpus=. This can break the
logical package management because it results in a smaller number of packages
while in kdump kernel.
Check below case:
There is a two sockets system, each socket has 8 cores, which has 16 logical
cpus while HT was turn on.
0 1 2 3 4 5 6 7 | 16 17 18 19 20 21 22 23
cores on socket 0 threads on socket 0
8 9 10 11 12 13 14 15 | 24 25 26 27 28 29 30 31
cores on socket 1 threads on socket 1
While starting the kdump kernel with command line option nr_cpus=16 panic
was triggered on one of the cpus 24-31 eg. 26, then online cpu will be
1-15, 26(cpu 0 was disabled in kdump), ncpus will be 16 and
__max_logical_packages will be 1, but actually two packages were booted on.
This issue can reproduced by set kdump option nr_cpus=<real physical core
numbers>, and then trigger panic on last socket's thread, for example:
taskset -c 26 echo c > /proc/sysrq-trigger
Use total_cpus which will not be limited by nr_cpus command line to calculate
the value of __max_logical_packages.
Signed-off-by: Hui Wang <john.wanghui@huawei.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: <guijianfeng@huawei.com>
Cc: <wencongyang2@huawei.com>
Cc: <douliyang1@huawei.com>
Cc: <qiaonuohan@huawei.com>
Link: https://lkml.kernel.org/r/20181107023643.22174-1-john.wanghui@huawei.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 a9134d1910b9..ccd1f2a8e557 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -1347,7 +1347,7 @@ void __init calculate_max_logical_packages(void)
* extrapolate the boot cpu's data to all packages.
*/
ncpus = cpu_data(0).booted_cores * topology_max_smt_threads();
- __max_logical_packages = DIV_ROUND_UP(nr_cpu_ids, ncpus);
+ __max_logical_packages = DIV_ROUND_UP(total_cpus, ncpus);
pr_info("Max logical packages: %u\n", __max_logical_packages);
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-12-18 12:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-07 2:36 [PATCH] x86/topology: use total_cpus for max logical packages calculation Hui Wang
2018-12-18 12:42 ` [tip:x86/cpu] x86/topology: Use " tip-bot for Hui Wang
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.