Re: [PATCH] arch_topology: Do not set llc_sibling if llc_id is invalid

From: Andy Shevchenko
Date: Mon Apr 11 2022 - 11:12:03 EST


On Mon, Apr 11, 2022 at 12:10 PM Qing Wang <wangqing@xxxxxxxx> wrote:
>
> From: Wang Qing <wangqing@xxxxxxxx>
>
> When ACPI is not enabled, cpuid_topo->llc_id = cpu_topo->llc_id = -1, which
> will set llc_sibling 0xff(...), this is misleading.

Shouldn't it be a Fixes tag then?

> Don't set llc_sibling(default 0) if we don't know the cache topology.

...

> - if (cpuid_topo->llc_id == cpu_topo->llc_id) {
> + if (cpu_topo->llc_id != -1 && cpuid_topo->llc_id == cpu_topo->llc_id) {

I'm wondering if more strict check is better here, i.e.

if (cpu_topo->llc_id >= 0 && cpuid_topo->llc_id ==
cpu_topo->llc_id) {

> cpumask_set_cpu(cpu, &cpuid_topo->llc_sibling);
> cpumask_set_cpu(cpuid, &cpu_topo->llc_sibling);
> }

--
With Best Regards,
Andy Shevchenko