Skip to content

Commit ff98a5f

Browse files
deggemanRussell King
authored andcommitted
ARM: 8943/1: Fix topology setup in case of CPU hotplug for CONFIG_SCHED_MC
Commit ca74b31 ("arm: Use common cpu_topology structure and functions.") changed cpu_coregroup_mask() from the ARM32 specific implementation in arch/arm/include/asm/topology.h to the one shared with ARM64 and RISCV in drivers/base/arch_topology.c. Currently on ARM32 (TC2 w/ CONFIG_SCHED_MC) the task scheduler setup code (w/ CONFIG_SCHED_DEBUG) shows this during CPU hotplug: ERROR: groups don't span domain->span It happens to CPUs of the cluster of the CPU which gets hot-plugged out on scheduler domain MC. Turns out that the shared cpu_coregroup_mask() requires that the hot-plugged CPU is removed from the core_sibling mask via remove_cpu_topology(). Otherwise the 'is core_sibling subset of cpumask_of_node()' doesn't work. In this case the task scheduler has to deal with cpumask_of_node instead of core_sibling which is wrong on scheduler domain MC. e.g. CPU3 hot-plugged out on TC2 [cluster0: 0,3-4 cluster1: 1-2]: cpu_coregroup_mask(): CPU3 cpumask_of_node=0-2,4 core_sibling=0,3-4 ^ should be: cpu_coregroup_mask(): CPU3 cpumask_of_node=0-2,4 core_sibling=0,4 Add remove_cpu_topology() to __cpu_disable() to remove the CPU from the topology masks in case of a CPU hotplug out operation. At the same time tweak store_cpu_topology() slightly so it will call update_siblings_masks() in case of CPU hotplug in operation via secondary_start_kernel()->smp_store_cpu_info(). This aligns the ARM32 implementation with the ARM64 one. Guarding remove_cpu_topology() with CONFIG_GENERIC_ARCH_TOPOLOGY is necessary since some Arm32 defconfigs (aspeed_g5_defconfig, milbeaut_m10v_defconfig, spear13xx_defconfig) specify an explicit # CONFIG_ARM_CPU_TOPOLOGY is not set w/ ./arch/arm/Kconfig: select GENERIC_ARCH_TOPOLOGY if ARM_CPU_TOPOLOGY Fixes: ca74b31 ("arm: Use common cpu_topology structure and functions") Reviewed-by: Sudeep Holla <[email protected]> Reviewed-by: Lukasz Luba <[email protected]> Tested-by: Lukasz Luba <[email protected]> Tested-by: Ondrej Jirman <[email protected]> Signed-off-by: Dietmar Eggemann <[email protected]> Signed-off-by: Russell King <[email protected]>
1 parent 1a70cf0 commit ff98a5f

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

arch/arm/kernel/smp.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,10 @@ int __cpu_disable(void)
240240
if (ret)
241241
return ret;
242242

243+
#ifdef CONFIG_GENERIC_ARCH_TOPOLOGY
244+
remove_cpu_topology(cpu);
245+
#endif
246+
243247
/*
244248
* Take this CPU offline. Once we clear this, we can't return,
245249
* and we must not schedule until we're ready to give up the cpu.

arch/arm/kernel/topology.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,8 @@ void store_cpu_topology(unsigned int cpuid)
196196
struct cpu_topology *cpuid_topo = &cpu_topology[cpuid];
197197
unsigned int mpidr;
198198

199-
/* If the cpu topology has been already set, just return */
200-
if (cpuid_topo->core_id != -1)
201-
return;
199+
if (cpuid_topo->package_id != -1)
200+
goto topology_populated;
202201

203202
mpidr = read_cpuid_mpidr();
204203

@@ -231,14 +230,15 @@ void store_cpu_topology(unsigned int cpuid)
231230
cpuid_topo->package_id = -1;
232231
}
233232

234-
update_siblings_masks(cpuid);
235-
236233
update_cpu_capacity(cpuid);
237234

238235
pr_info("CPU%u: thread %d, cpu %d, socket %d, mpidr %x\n",
239236
cpuid, cpu_topology[cpuid].thread_id,
240237
cpu_topology[cpuid].core_id,
241238
cpu_topology[cpuid].package_id, mpidr);
239+
240+
topology_populated:
241+
update_siblings_masks(cpuid);
242242
}
243243

244244
static inline int cpu_corepower_flags(void)

0 commit comments

Comments
 (0)