RE: [PATCH V2 net-next] net: mana: Assigning IRQ affinity on HT cores

From: Haiyang Zhang
Date: Tue Nov 21 2023 - 12:37:20 EST




> -----Original Message-----
> From: Souradeep Chakrabarti <schakrabarti@xxxxxxxxxxxxxxxxxxx>
> Sent: Tuesday, November 21, 2023 8:55 AM


> + /* for each interrupt find the cpu of a particular
> + * sibling set and if it belongs to the specific numa
> + * then assign irq to it and clear the cpu bit from
> + * the corresponding avail_cpus.
> + * Increase the cpu_count for that node.
> + * Once all cpus for a numa node is assigned, then
> + * move to different numa node and continue the same.
> + */
> + for (i = irq_start; i < nvec; ) {
> +
> + /* check if the numa node has cpu or not
> + * to avoid infinite loop.
> + */
> + if (cpumask_empty(cpumask_of_node(numa_node))) {
> + numa_node++;

Since it starts at start_numa_node, we should consider roll over at the
num_online_nodes() like the code below:
if (numa_node == num_online_nodes())
numa_node = 0;

It should also check empty for the next one.
And set node_count = 0; after the loop.

> + if (++node_count == num_online_nodes()) {
> + err = -EAGAIN;
Consider return -ENODEV, because we are not asking for retry.

> + goto free_irq;
> + }
> + }

Thanks,
- Haiyang