Re: [PATCH 7/7] x86/resctrl: Determine if Sub-NUMA Cluster is enabled and initialize.

From: Peter Newman
Date: Mon Feb 27 2023 - 08:30:55 EST


Hi Tony,

On Thu, Jan 26, 2023 at 7:42 PM Tony Luck <tony.luck@xxxxxxxxx> wrote:
> +static __init int find_snc_ways(void)
> +{
> + unsigned long *node_caches;
> + int cpu, node, ret;
> +
> + node_caches = kcalloc(BITS_TO_LONGS(nr_node_ids), sizeof(*node_caches), GFP_KERNEL);
> + if (!node_caches)
> + return 1;
> +
> + cpus_read_lock();
> + for_each_node(node) {

Someone tried this patch on a machine with a CPU-less node...

We need to check for this:

+ if (cpumask_empty(cpumask_of_node(node)))
+ continue;

> + cpu = cpumask_first(cpumask_of_node(node));
> + set_bit(get_cpu_cacheinfo_id(cpu, 3), node_caches);
> + }
> + cpus_read_unlock();

Thanks!
-Peter