Skip to content

Commit 52aeda7

Browse files
Alexander GordeevVasily Gorbik
authored andcommitted
s390/topology: remove offline CPUs from CPU topology masks
The CPU topology masks on s390 contain also bits of CPUs which are offline. Currently this is already a problem, since common code scheduler expects e.g. cpu_smt_mask() to reflect reality. This update changes the described behaviour and s390 starts to behave like all other architectures. Signed-off-by: Alexander Gordeev <[email protected]> Reviewed-by: Heiko Carstens <[email protected]> Signed-off-by: Heiko Carstens <[email protected]> Signed-off-by: Vasily Gorbik <[email protected]>
1 parent cd8e702 commit 52aeda7

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

arch/s390/include/asm/topology.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ int topology_cpu_init(struct cpu *);
4343
int topology_set_cpu_management(int fc);
4444
void topology_schedule_update(void);
4545
void store_topology(struct sysinfo_15_1_x *info);
46+
void update_cpu_masks(void);
4647
void topology_expect_change(void);
4748
const struct cpumask *cpu_coregroup_mask(int cpu);
4849

@@ -52,6 +53,7 @@ static inline void topology_init_early(void) { }
5253
static inline void topology_schedule_update(void) { }
5354
static inline int topology_cpu_init(struct cpu *cpu) { return 0; }
5455
static inline int topology_cpu_dedicated(int cpu_nr) { return 0; }
56+
static inline void update_cpu_masks(void) { }
5557
static inline void topology_expect_change(void) { }
5658

5759
#endif /* CONFIG_SCHED_TOPOLOGY */

arch/s390/kernel/smp.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -858,12 +858,13 @@ static void smp_init_secondary(void)
858858
init_cpu_timer();
859859
vtime_init();
860860
pfault_init();
861-
notify_cpu_starting(smp_processor_id());
861+
notify_cpu_starting(cpu);
862862
if (topology_cpu_dedicated(cpu))
863863
set_cpu_flag(CIF_DEDICATED_CPU);
864864
else
865865
clear_cpu_flag(CIF_DEDICATED_CPU);
866-
set_cpu_online(smp_processor_id(), true);
866+
set_cpu_online(cpu, true);
867+
update_cpu_masks();
867868
inc_irq_stat(CPU_RST);
868869
local_irq_enable();
869870
cpu_startup_entry(CPUHP_AP_ONLINE_IDLE);
@@ -935,6 +936,7 @@ int __cpu_disable(void)
935936
/* Handle possible pending IPIs */
936937
smp_handle_ext_call();
937938
set_cpu_online(smp_processor_id(), false);
939+
update_cpu_masks();
938940
/* Disable pseudo page faults on this cpu. */
939941
pfault_fini();
940942
/* Disable interrupt sources via control register. */

arch/s390/kernel/topology.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ static cpumask_t cpu_group_map(struct mask_info *info, unsigned int cpu)
8888
cpumask_copy(&mask, cpumask_of(cpu));
8989
break;
9090
}
91+
cpumask_and(&mask, &mask, cpu_online_mask);
9192
return mask;
9293
}
9394

@@ -103,6 +104,7 @@ static cpumask_t cpu_thread_map(unsigned int cpu)
103104
for (i = 0; i <= smp_cpu_mtid; i++)
104105
if (cpu_present(cpu + i))
105106
cpumask_set_cpu(cpu + i, &mask);
107+
cpumask_and(&mask, &mask, cpu_online_mask);
106108
return mask;
107109
}
108110

@@ -241,7 +243,7 @@ int topology_set_cpu_management(int fc)
241243
return rc;
242244
}
243245

244-
static void update_cpu_masks(void)
246+
void update_cpu_masks(void)
245247
{
246248
struct cpu_topology_s390 *topo;
247249
int cpu, id;

0 commit comments

Comments
 (0)