Skip to content

Commit 3fcbf1c

Browse files
sudeep-hollagregkh
authored andcommitted
arch_topology: Fix cache attributes detection in the CPU hotplug path
init_cpu_topology() is called only once at the boot and all the cache attributes are detected early for all the possible CPUs. However when the CPUs are hotplugged out, the cacheinfo gets removed. While the attributes are added back when the CPUs are hotplugged back in as part of CPU hotplug state machine, it ends up called quite late after the update_siblings_masks() are called in the secondary_start_kernel() resulting in wrong llc_sibling_masks. Move the call to detect_cache_attributes() inside update_siblings_masks() to ensure the cacheinfo is updated before the LLC sibling masks are updated. This will fix the incorrect LLC sibling masks generated when the CPUs are hotplugged out and hotplugged back in again. Reported-by: Ionela Voinescu <[email protected]> Tested-by: Geert Uytterhoeven <[email protected]> Tested-by: Ionela Voinescu <[email protected]> Reviewed-by: Conor Dooley <[email protected]> Reviewed-by: Ionela Voinescu <[email protected]> Signed-off-by: Sudeep Holla <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 0c80f9e commit 3fcbf1c

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

drivers/base/arch_topology.c

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,11 @@ const struct cpumask *cpu_clustergroup_mask(int cpu)
732732
void update_siblings_masks(unsigned int cpuid)
733733
{
734734
struct cpu_topology *cpu_topo, *cpuid_topo = &cpu_topology[cpuid];
735-
int cpu;
735+
int cpu, ret;
736+
737+
ret = detect_cache_attributes(cpuid);
738+
if (ret)
739+
pr_info("Early cacheinfo failed, ret = %d\n", ret);
736740

737741
/* update core and thread sibling masks */
738742
for_each_online_cpu(cpu) {
@@ -821,7 +825,7 @@ __weak int __init parse_acpi_topology(void)
821825
#if defined(CONFIG_ARM64) || defined(CONFIG_RISCV)
822826
void __init init_cpu_topology(void)
823827
{
824-
int ret, cpu;
828+
int ret;
825829

826830
reset_cpu_topology();
827831
ret = parse_acpi_topology();
@@ -836,13 +840,5 @@ void __init init_cpu_topology(void)
836840
reset_cpu_topology();
837841
return;
838842
}
839-
840-
for_each_possible_cpu(cpu) {
841-
ret = detect_cache_attributes(cpu);
842-
if (ret) {
843-
pr_info("Early cacheinfo failed, ret = %d\n", ret);
844-
break;
845-
}
846-
}
847843
}
848844
#endif

0 commit comments

Comments
 (0)