Message ID | 20220518093325.2070336-3-sudeep.holla@arm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | arch_topology: Updates to add socket support and fix cluster ids | expand |
On 18/05/2022 11:33, Sudeep Holla wrote: > Currently the cluster identifier is not set on the DT based platforms. > The reset or default value is -1 for all the CPUs. Once we assign the > cluster identifier values correctly that imay result in getting the thread > siblings wrongs as the core identifiers can be same for 2 different CPUs > belonging to 2 different cluster. > > So, in order to get the thread sibling cpumasks correct, we need to > update them only if the cores they belong are in the same cluster within > the socket. Let us skip updation of the thread sibling cpumaks if the > cluster identifier doesn't match. So this issue should be there on ACPI systems as well then. Kunpeng920 and Ampere Altra don't have SMT, so very likely nobody has noticed this so far. [...]
On Fri, May 20, 2022 at 02:32:19PM +0200, Dietmar Eggemann wrote: > On 18/05/2022 11:33, Sudeep Holla wrote: > > Currently the cluster identifier is not set on the DT based platforms. > > The reset or default value is -1 for all the CPUs. Once we assign the > > cluster identifier values correctly that imay result in getting the thread > > siblings wrongs as the core identifiers can be same for 2 different CPUs > > belonging to 2 different cluster. > > > > So, in order to get the thread sibling cpumasks correct, we need to > > update them only if the cores they belong are in the same cluster within > > the socket. Let us skip updation of the thread sibling cpumaks if the > > cluster identifier doesn't match. > > So this issue should be there on ACPI systems as well then. Kunpeng920 > and Ampere Altra don't have SMT, so very likely nobody has noticed this > so far. No, I think it is handled correctly. May be the wordings of my commit log needs changing. Previously the core ids were generated and unique across the platform. But with this change I am assigned the id as read from the DT node using core@<id>. That results in the problem and needs to be taken care. This doesn't change the end result(the actual mask) but the way we arrive at that. In short this is not fixing any issue that was broken before.
diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c index 44f733b365cc..7f5aa655c1f4 100644 --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c @@ -697,15 +697,17 @@ void update_siblings_masks(unsigned int cpuid) if (cpuid_topo->package_id != cpu_topo->package_id) continue; - if (cpuid_topo->cluster_id == cpu_topo->cluster_id && - cpuid_topo->cluster_id != -1) { + cpumask_set_cpu(cpuid, &cpu_topo->core_sibling); + cpumask_set_cpu(cpu, &cpuid_topo->core_sibling); + + if (cpuid_topo->cluster_id != cpu_topo->cluster_id) + continue; + + if (cpuid_topo->cluster_id != -1) { cpumask_set_cpu(cpu, &cpuid_topo->cluster_sibling); cpumask_set_cpu(cpuid, &cpu_topo->cluster_sibling); } - cpumask_set_cpu(cpuid, &cpu_topo->core_sibling); - cpumask_set_cpu(cpu, &cpuid_topo->core_sibling); - if (cpuid_topo->core_id != cpu_topo->core_id) continue;
Currently the cluster identifier is not set on the DT based platforms. The reset or default value is -1 for all the CPUs. Once we assign the cluster identifier values correctly that imay result in getting the thread siblings wrongs as the core identifiers can be same for 2 different CPUs belonging to 2 different cluster. So, in order to get the thread sibling cpumasks correct, we need to update them only if the cores they belong are in the same cluster within the socket. Let us skip updation of the thread sibling cpumaks if the cluster identifier doesn't match. This change won't affect even if the cluster identifiers are not set currently but will avoid any breakage once we set the same correctly. Signed-off-by: Sudeep Holla <sudeep.holla@arm.com> --- drivers/base/arch_topology.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)