* [PATCH v2 0/2] net/mlx5: Only consider online CPUs in affinity subset check
@ 2026-06-04 12:57 Fushuai Wang
2026-06-04 12:57 ` [PATCH v2 1/2] net/mlx5: Simplify cpumask operations in comp_irq_request_sf() Fushuai Wang
2026-06-04 12:57 ` [PATCH v2 2/2] net/mlx5: Use effective affinity mask for IRQ selection Fushuai Wang
0 siblings, 2 replies; 3+ messages in thread
From: Fushuai Wang @ 2026-06-04 12:57 UTC (permalink / raw)
To: saeedm, leon, tariqt, mbloch, andrew+netdev, davem, edumazet,
kuba, pabeni, shayd, parav, moshe
Cc: netdev, linux-rdma, linux-kernel, wangfushuai
From: Fushuai Wang <wangfushuai@baidu.com>
Hi all,
When an SF is created after a CPU has been taken offline, the IRQ affinity
check fails because existing IRQs in the pool may have affinity masks that
include the now-offline CPU. This causes SF creation to fail even though
suitable online CPUs are available.
This series fixes this issue and includes a small cleanup:
Patch 1 folds cpumask_copy() into cpumask_andnot() for better code clarity
in comp_irq_request_sf().
Patch 2 filters affinity masks to only consider effective CPUs before the
subset check, ensuring SF creation succeeds when CPUs have been taken offline.
--WANG
Fushuai Wang (2):
net/mlx5: Simplify cpumask operations in comp_irq_request_sf()
net/mlx5: Use effective affinity mask for IRQ selection
drivers/net/ethernet/mellanox/mlx5/core/eq.c | 3 +--
drivers/net/ethernet/mellanox/mlx5/core/irq_affinity.c | 5 ++++-
2 files changed, 5 insertions(+), 3 deletions(-)
--
2.36.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2 1/2] net/mlx5: Simplify cpumask operations in comp_irq_request_sf()
2026-06-04 12:57 [PATCH v2 0/2] net/mlx5: Only consider online CPUs in affinity subset check Fushuai Wang
@ 2026-06-04 12:57 ` Fushuai Wang
2026-06-04 12:57 ` [PATCH v2 2/2] net/mlx5: Use effective affinity mask for IRQ selection Fushuai Wang
1 sibling, 0 replies; 3+ messages in thread
From: Fushuai Wang @ 2026-06-04 12:57 UTC (permalink / raw)
To: saeedm, leon, tariqt, mbloch, andrew+netdev, davem, edumazet,
kuba, pabeni, shayd, parav, moshe
Cc: netdev, linux-rdma, linux-kernel, wangfushuai
From: Fushuai Wang <wangfushuai@baidu.com>
Combine cpumask_copy() and cpumask_andnot() into a single
cpumask_andnot() since the function can take cpu_online_mask
directly as the source.
Signed-off-by: Fushuai Wang <wangfushuai@baidu.com>
Reviewed-by: Shay Drory <shayd@nvidia.com>
---
drivers/net/ethernet/mellanox/mlx5/core/eq.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eq.c b/drivers/net/ethernet/mellanox/mlx5/core/eq.c
index 22a637111aa2..d11ec263d53c 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/eq.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eq.c
@@ -886,8 +886,7 @@ static int comp_irq_request_sf(struct mlx5_core_dev *dev, u16 vecidx)
return -ENOMEM;
af_desc->is_managed = false;
- cpumask_copy(&af_desc->mask, cpu_online_mask);
- cpumask_andnot(&af_desc->mask, &af_desc->mask, &table->used_cpus);
+ cpumask_andnot(&af_desc->mask, cpu_online_mask, &table->used_cpus);
irq = mlx5_irq_affinity_request(dev, pool, af_desc);
if (IS_ERR(irq)) {
kvfree(af_desc);
--
2.36.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH v2 2/2] net/mlx5: Use effective affinity mask for IRQ selection
2026-06-04 12:57 [PATCH v2 0/2] net/mlx5: Only consider online CPUs in affinity subset check Fushuai Wang
2026-06-04 12:57 ` [PATCH v2 1/2] net/mlx5: Simplify cpumask operations in comp_irq_request_sf() Fushuai Wang
@ 2026-06-04 12:57 ` Fushuai Wang
1 sibling, 0 replies; 3+ messages in thread
From: Fushuai Wang @ 2026-06-04 12:57 UTC (permalink / raw)
To: saeedm, leon, tariqt, mbloch, andrew+netdev, davem, edumazet,
kuba, pabeni, shayd, parav, moshe
Cc: netdev, linux-rdma, linux-kernel, wangfushuai
From: Fushuai Wang <wangfushuai@baidu.com>
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.
Use irq_get_effective_affinity_mask() instead, which returns the IRQ's
actual effective affinity that already excludes offline CPUs.
Fixes: 061f5b23588a ("net/mlx5: SF, Use all available cpu for setting cpu affinity")
Suggested-by: Shay Drory <shayd@nvidia.com>
Signed-off-by: Fushuai Wang <wangfushuai@baidu.com>
---
drivers/net/ethernet/mellanox/mlx5/core/irq_affinity.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/irq_affinity.c b/drivers/net/ethernet/mellanox/mlx5/core/irq_affinity.c
index 994fe83da4be..c5d784cbc8e4 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/irq_affinity.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/irq_affinity.c
@@ -105,9 +105,12 @@ irq_pool_find_least_loaded(struct mlx5_irq_pool *pool, const struct cpumask *req
lockdep_assert_held(&pool->lock);
xa_for_each_range(&pool->irqs, index, iter, start, end) {
- struct cpumask *iter_mask = mlx5_irq_get_affinity_mask(iter);
+ const struct cpumask *iter_mask;
int iter_refcount = mlx5_irq_read_locked(iter);
+ iter_mask = irq_get_effective_affinity_mask(mlx5_irq_get_irq(iter));
+ if (!iter_mask)
+ continue;
if (!cpumask_subset(iter_mask, req_mask))
/* skip IRQs with a mask which is not subset of req_mask */
continue;
--
2.36.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-06-04 12:58 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-04 12:57 [PATCH v2 0/2] net/mlx5: Only consider online CPUs in affinity subset check Fushuai Wang
2026-06-04 12:57 ` [PATCH v2 1/2] net/mlx5: Simplify cpumask operations in comp_irq_request_sf() Fushuai Wang
2026-06-04 12:57 ` [PATCH v2 2/2] net/mlx5: Use effective affinity mask for IRQ selection Fushuai Wang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox