On 06/10/21 09:43, Barry Song wrote:
>
> Hi Valentin,
> Yep, this is a very good question. I'd like change the code to:
> diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c
> index 7cb31d959f33..fc0836f460fb 100644
> --- a/drivers/base/arch_topology.c
> +++ b/drivers/base/arch_topology.c
> @@ -622,7 +622,8 @@ 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) {
> + if (cpuid_topo->cluster_id == cpu_topo->cluster_id &&
> + cpuid_topo->cluster_id != -1) {
> cpumask_set_cpu(cpu, &cpuid_topo->cluster_sibling);
> cpumask_set_cpu(cpuid, &cpu_topo->cluster_sibling);
> }
>
> This should be consistent with Tim's patch3/3 for x86 in case
> id is BAD_APICID:
> static bool match_l2c(struct cpuinfo_x86 *c, struct cpuinfo_x86 *o)
> {
> ...
> /* Do not match if we do not have a valid APICID for cpu: */
> if (per_cpu(cpu_l2c_id, cpu1) == BAD_APICID)
> return false;
> ...
> }
>
LGTM.