From: Sudeep Holla Date: Fri, 6 Jul 2018 11:02:45 +0000 (+0100) Subject: arm64: topology: restrict updating siblings_masks to online cpus only X-Git-Tag: v5.15~8199^2~57 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5ec8b59172b4e8d26a12952ce3a2914b30128538;p=platform%2Fkernel%2Flinux-starfive.git arm64: topology: restrict updating siblings_masks to online cpus only It's incorrect to iterate over all the possible CPUs to update the sibling masks when any CPU is hotplugged in. In case the topology siblings masks of the CPU is removed when is it hotplugged out, we end up updating those masks when one of it's sibling is powered up again. This will provide inconsistent view. Further, since the CPU calling update_sibling_masks is yet to be set online, there's no need to compare itself with each online CPU when updating the siblings masks. This patch restricts updation of sibling masks only for CPUs that are already online. It also the drops the unnecessary cpuid check. Cc: Catalin Marinas Cc: Will Deacon Tested-by: Ganapatrao Kulkarni Tested-by: Hanjun Guo Signed-off-by: Sudeep Holla Signed-off-by: Will Deacon --- diff --git a/arch/arm64/kernel/topology.c b/arch/arm64/kernel/topology.c index cb81df5..1a3f8ab 100644 --- a/arch/arm64/kernel/topology.c +++ b/arch/arm64/kernel/topology.c @@ -231,7 +231,7 @@ static void update_siblings_masks(unsigned int cpuid) int cpu; /* update core and thread sibling masks */ - for_each_possible_cpu(cpu) { + for_each_online_cpu(cpu) { cpu_topo = &cpu_topology[cpu]; if (cpuid_topo->llc_id == cpu_topo->llc_id) { @@ -243,15 +243,13 @@ static void update_siblings_masks(unsigned int cpuid) continue; cpumask_set_cpu(cpuid, &cpu_topo->core_sibling); - if (cpu != cpuid) - cpumask_set_cpu(cpu, &cpuid_topo->core_sibling); + cpumask_set_cpu(cpu, &cpuid_topo->core_sibling); if (cpuid_topo->core_id != cpu_topo->core_id) continue; cpumask_set_cpu(cpuid, &cpu_topo->thread_sibling); - if (cpu != cpuid) - cpumask_set_cpu(cpu, &cpuid_topo->thread_sibling); + cpumask_set_cpu(cpu, &cpuid_topo->thread_sibling); } }