Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <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>

authored by

Alexander Gordeev and committed by
Vasily Gorbik
52aeda7a cd8e702f

+9 -3
+2
arch/s390/include/asm/topology.h
··· 43 43 int topology_set_cpu_management(int fc); 44 44 void topology_schedule_update(void); 45 45 void store_topology(struct sysinfo_15_1_x *info); 46 + void update_cpu_masks(void); 46 47 void topology_expect_change(void); 47 48 const struct cpumask *cpu_coregroup_mask(int cpu); 48 49 ··· 53 52 static inline void topology_schedule_update(void) { } 54 53 static inline int topology_cpu_init(struct cpu *cpu) { return 0; } 55 54 static inline int topology_cpu_dedicated(int cpu_nr) { return 0; } 55 + static inline void update_cpu_masks(void) { } 56 56 static inline void topology_expect_change(void) { } 57 57 58 58 #endif /* CONFIG_SCHED_TOPOLOGY */
+4 -2
arch/s390/kernel/smp.c
··· 858 858 init_cpu_timer(); 859 859 vtime_init(); 860 860 pfault_init(); 861 - notify_cpu_starting(smp_processor_id()); 861 + notify_cpu_starting(cpu); 862 862 if (topology_cpu_dedicated(cpu)) 863 863 set_cpu_flag(CIF_DEDICATED_CPU); 864 864 else 865 865 clear_cpu_flag(CIF_DEDICATED_CPU); 866 - set_cpu_online(smp_processor_id(), true); 866 + set_cpu_online(cpu, true); 867 + update_cpu_masks(); 867 868 inc_irq_stat(CPU_RST); 868 869 local_irq_enable(); 869 870 cpu_startup_entry(CPUHP_AP_ONLINE_IDLE); ··· 936 935 /* Handle possible pending IPIs */ 937 936 smp_handle_ext_call(); 938 937 set_cpu_online(smp_processor_id(), false); 938 + update_cpu_masks(); 939 939 /* Disable pseudo page faults on this cpu. */ 940 940 pfault_fini(); 941 941 /* Disable interrupt sources via control register. */
+3 -1
arch/s390/kernel/topology.c
··· 88 88 cpumask_copy(&mask, cpumask_of(cpu)); 89 89 break; 90 90 } 91 + cpumask_and(&mask, &mask, cpu_online_mask); 91 92 return mask; 92 93 } 93 94 ··· 104 103 for (i = 0; i <= smp_cpu_mtid; i++) 105 104 if (cpu_present(cpu + i)) 106 105 cpumask_set_cpu(cpu + i, &mask); 106 + cpumask_and(&mask, &mask, cpu_online_mask); 107 107 return mask; 108 108 } 109 109 ··· 243 241 return rc; 244 242 } 245 243 246 - static void update_cpu_masks(void) 244 + void update_cpu_masks(void) 247 245 { 248 246 struct cpu_topology_s390 *topo; 249 247 int cpu, id;