summaryrefslogtreecommitdiffstats
path: root/arch/s390/kernel
diff options
context:
space:
mode:
authorAlexander Gordeev <agordeev@linux.ibm.com>2020-03-13 16:52:44 +0100
committerVasily Gorbik <gor@linux.ibm.com>2020-03-23 13:41:54 +0100
commit959684978d5a8443cfb0ed59a9d1fc59d2a80d09 (patch)
tree8e403c87731132d1ad8d5aa3165eede54885d36a /arch/s390/kernel
parent1a2ae03b1938b050c3bbd79e79d5075e0307fe20 (diff)
downloadlinux-959684978d5a8443cfb0ed59a9d1fc59d2a80d09.tar.bz2
s390/cpuinfo: show number of online cores
Show number of cores that run at least one SMT thread Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com> Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Diffstat (limited to 'arch/s390/kernel')
-rw-r--r--arch/s390/kernel/processor.c1
-rw-r--r--arch/s390/kernel/topology.c20
2 files changed, 19 insertions, 2 deletions
diff --git a/arch/s390/kernel/processor.c b/arch/s390/kernel/processor.c
index b98654d0ce41..41172093160e 100644
--- a/arch/s390/kernel/processor.c
+++ b/arch/s390/kernel/processor.c
@@ -160,6 +160,7 @@ static void show_cpu_topology(struct seq_file *m, unsigned long n)
seq_printf(m, "drawer id : %d\n", topology_drawer_id(n));
seq_printf(m, "dedicated : %d\n", topology_cpu_dedicated(n));
seq_printf(m, "address : %d\n", smp_cpu_get_cpu_address(n));
+ seq_printf(m, "cpu cores : %d\n", topology_booted_cores(n));
#endif /* CONFIG_SCHED_TOPOLOGY */
}
diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c
index 09711d55f123..d03edebce754 100644
--- a/arch/s390/kernel/topology.c
+++ b/arch/s390/kernel/topology.c
@@ -245,8 +245,8 @@ int topology_set_cpu_management(int fc)
void update_cpu_masks(void)
{
- struct cpu_topology_s390 *topo;
- int cpu, id;
+ struct cpu_topology_s390 *topo, *topo_package, *topo_sibling;
+ int cpu, sibling, pkg_first, smt_first, id;
for_each_possible_cpu(cpu) {
topo = &cpu_topology[cpu];
@@ -254,6 +254,7 @@ void update_cpu_masks(void)
topo->core_mask = cpu_group_map(&socket_info, cpu);
topo->book_mask = cpu_group_map(&book_info, cpu);
topo->drawer_mask = cpu_group_map(&drawer_info, cpu);
+ topo->booted_cores = 0;
if (topology_mode != TOPOLOGY_MODE_HW) {
id = topology_mode == TOPOLOGY_MODE_PACKAGE ? 0 : cpu;
topo->thread_id = cpu;
@@ -263,6 +264,21 @@ void update_cpu_masks(void)
topo->drawer_id = id;
}
}
+ for_each_online_cpu(cpu) {
+ topo = &cpu_topology[cpu];
+ pkg_first = cpumask_first(&topo->core_mask);
+ topo_package = &cpu_topology[pkg_first];
+ if (cpu == pkg_first) {
+ for_each_cpu(sibling, &topo->core_mask) {
+ topo_sibling = &cpu_topology[sibling];
+ smt_first = cpumask_first(&topo_sibling->thread_mask);
+ if (sibling == smt_first)
+ topo_package->booted_cores++;
+ }
+ } else {
+ topo->booted_cores = topo_package->booted_cores;
+ }
+ }
}
void store_topology(struct sysinfo_15_1_x *info)