Re: [PATCH 2/2] net/mlx5: Only consider online CPUs in affinity subset check
From: Fushuai Wang
Date: Thu Jun 04 2026 - 09:03:25 EST
> > From: Fushuai Wang <wangfushuai@xxxxxxxxx>
> >
> > When an SF is created after a CPU has been taken offline, the IRQ pool may
> > contain IRQs with affinity masks that include the offline CPU. Since only
> > online CPUs should be considered for IRQ placement, cpumask_subset() check
> > would fail because the iter_mask contains offline CPUs that are not present
> > in req_mask, causing SF creation to fail.
>
> Thank for the patch!
>
> can you please provide a full example? for simplicity, lets say the SF
> pool is of size of 2 IRQs.
>
Sure, here are the AI summarized steps:
1. When mlx5 driver loads, it initializes the IRQ pools.
For sf_ctrl_pool with ≤64 SFs:
- xa_num_irqs = {N, N} (There is only one slot)
2. When the first SF is created:
- The ctrl IRQ is allocated with mask=cpu_online_mask={0-191}
2. We take CPU 20 offline
3. Existing ctl irq still have mask={0-191}
4. Create a new SF:
- req_mask={0-19,21-191}
- iter_mask={0-191}
- {0-191} is NOT a subset of {0-19,21-191}
- least_loaded_irq=NULL
5. Try to allocate a new irq via irq_pool_request_irq()
6. xa_alloc() fails because the pool is full(There is only one slot)
7. sf creation fails with error
> >
> > Filter the affinity mask to only include online CPUs before checking if it's
> > a subset of the requested mask,
>
> won't this cause the affinity mask to be empty, which is kind of missing
> the point of this API... :(
Yes, I didn't realize this.
> can you check if irq_get_effective_affinity_mask() will solve the issue?
>
Yes, I tested that irq_get_effective_affinity_mask can solve the issue.
I will send a v2 shortly.
--
Regards,
WANG