Commit 95968497 authored by Alexander Gordeev's avatar Alexander Gordeev Committed by Vasily Gorbik

s390/cpuinfo: show number of online cores

Show number of cores that run at least one SMT thread
Signed-off-by: default avatarAlexander Gordeev <agordeev@linux.ibm.com>
Reviewed-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
parent 1a2ae03b
...@@ -17,6 +17,7 @@ struct cpu_topology_s390 { ...@@ -17,6 +17,7 @@ struct cpu_topology_s390 {
unsigned short book_id; unsigned short book_id;
unsigned short drawer_id; unsigned short drawer_id;
unsigned short dedicated : 1; unsigned short dedicated : 1;
int booted_cores;
cpumask_t thread_mask; cpumask_t thread_mask;
cpumask_t core_mask; cpumask_t core_mask;
cpumask_t book_mask; cpumask_t book_mask;
...@@ -35,6 +36,7 @@ extern struct cpu_topology_s390 cpu_topology[NR_CPUS]; ...@@ -35,6 +36,7 @@ extern struct cpu_topology_s390 cpu_topology[NR_CPUS];
#define topology_drawer_id(cpu) (cpu_topology[cpu].drawer_id) #define topology_drawer_id(cpu) (cpu_topology[cpu].drawer_id)
#define topology_drawer_cpumask(cpu) (&cpu_topology[cpu].drawer_mask) #define topology_drawer_cpumask(cpu) (&cpu_topology[cpu].drawer_mask)
#define topology_cpu_dedicated(cpu) (cpu_topology[cpu].dedicated) #define topology_cpu_dedicated(cpu) (cpu_topology[cpu].dedicated)
#define topology_booted_cores(cpu) (cpu_topology[cpu].booted_cores)
#define mc_capable() 1 #define mc_capable() 1
...@@ -53,6 +55,7 @@ static inline void topology_init_early(void) { } ...@@ -53,6 +55,7 @@ static inline void topology_init_early(void) { }
static inline void topology_schedule_update(void) { } static inline void topology_schedule_update(void) { }
static inline int topology_cpu_init(struct cpu *cpu) { return 0; } static inline int topology_cpu_init(struct cpu *cpu) { return 0; }
static inline int topology_cpu_dedicated(int cpu_nr) { return 0; } static inline int topology_cpu_dedicated(int cpu_nr) { return 0; }
static inline int topology_booted_cores(int cpu_nr) { return 1; }
static inline void update_cpu_masks(void) { } static inline void update_cpu_masks(void) { }
static inline void topology_expect_change(void) { } static inline void topology_expect_change(void) { }
......
...@@ -160,6 +160,7 @@ static void show_cpu_topology(struct seq_file *m, unsigned long n) ...@@ -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, "drawer id : %d\n", topology_drawer_id(n));
seq_printf(m, "dedicated : %d\n", topology_cpu_dedicated(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, "address : %d\n", smp_cpu_get_cpu_address(n));
seq_printf(m, "cpu cores : %d\n", topology_booted_cores(n));
#endif /* CONFIG_SCHED_TOPOLOGY */ #endif /* CONFIG_SCHED_TOPOLOGY */
} }
......
...@@ -245,8 +245,8 @@ int topology_set_cpu_management(int fc) ...@@ -245,8 +245,8 @@ int topology_set_cpu_management(int fc)
void update_cpu_masks(void) void update_cpu_masks(void)
{ {
struct cpu_topology_s390 *topo; struct cpu_topology_s390 *topo, *topo_package, *topo_sibling;
int cpu, id; int cpu, sibling, pkg_first, smt_first, id;
for_each_possible_cpu(cpu) { for_each_possible_cpu(cpu) {
topo = &cpu_topology[cpu]; topo = &cpu_topology[cpu];
...@@ -254,6 +254,7 @@ void update_cpu_masks(void) ...@@ -254,6 +254,7 @@ void update_cpu_masks(void)
topo->core_mask = cpu_group_map(&socket_info, cpu); topo->core_mask = cpu_group_map(&socket_info, cpu);
topo->book_mask = cpu_group_map(&book_info, cpu); topo->book_mask = cpu_group_map(&book_info, cpu);
topo->drawer_mask = cpu_group_map(&drawer_info, cpu); topo->drawer_mask = cpu_group_map(&drawer_info, cpu);
topo->booted_cores = 0;
if (topology_mode != TOPOLOGY_MODE_HW) { if (topology_mode != TOPOLOGY_MODE_HW) {
id = topology_mode == TOPOLOGY_MODE_PACKAGE ? 0 : cpu; id = topology_mode == TOPOLOGY_MODE_PACKAGE ? 0 : cpu;
topo->thread_id = cpu; topo->thread_id = cpu;
...@@ -263,6 +264,21 @@ void update_cpu_masks(void) ...@@ -263,6 +264,21 @@ void update_cpu_masks(void)
topo->drawer_id = id; 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) void store_topology(struct sysinfo_15_1_x *info)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment