From nobody Mon Jun 8 06:35:41 2026 Received: from out-183.mta0.migadu.com (out-183.mta0.migadu.com [91.218.175.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B3D56413247 for ; Thu, 4 Jun 2026 12:58:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.183 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780577886; cv=none; b=PfsBmPfpYhMMIQrX/e1H2sz8PrY661YYrGpgNDpOYI78WfmFYtJt4tN8V2bI0+y9bE/xghMhASX6rll0ElGfXR95KTZeXu+iEKcPdiinbSeQuj+a4jTrwbTnZRqoLxtVbnzq0VZYL+mrO8T5x2gbCP6vMOZch14So0YCK5TS9UE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780577886; c=relaxed/simple; bh=79Mdp1AOyEnseQ6YciyHtVOQDkgA3tpWYMzYOqm3TB0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=fBXwsfioFcDoGaODY+LC0vMADQzapAOw9mp/Ur9rypN5tieQR4Mr1+60zWpEIsqILuOCtT/WO14lI7UfungDNokA7PEBVXmtI4O8o5P/cs49tH2JRKmKxs3k1BpPgc+k9o7njUZ0UiGGU8cCCwrp+VlLEbiVMn/B8YQiaFaZVlE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=R8/MNnUd; arc=none smtp.client-ip=91.218.175.183 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="R8/MNnUd" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1780577882; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=nlSixzpVPe58sKtClq15cLtWL0cPTKiwPec4PU8Bn4o=; b=R8/MNnUdp7U9NmYIomXbeTYl81HJaA8cfrOUNgwObKtfaTD2c5B8Y2OjGRiVP1lccHLQbp Wbt+F87UWjO8nbZ2a8bqQUaExGBCBuqnV94hIzrFGoaFWcNWnM7T7YTlwPPZCDLEFjWCg9 CPb4TqLDTsutvPatFBRBWeQdJw9J+sw= From: Fushuai Wang To: saeedm@nvidia.com, leon@kernel.org, tariqt@nvidia.com, mbloch@nvidia.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, shayd@nvidia.com, parav@nvidia.com, moshe@nvidia.com Cc: netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, wangfushuai@baidu.com Subject: [PATCH v2 1/2] net/mlx5: Simplify cpumask operations in comp_irq_request_sf() Date: Thu, 4 Jun 2026 20:57:04 +0800 Message-Id: <20260604125705.21241-2-fushuai.wang@linux.dev> In-Reply-To: <20260604125705.21241-1-fushuai.wang@linux.dev> References: <20260604125705.21241-1-fushuai.wang@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" From: Fushuai Wang 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 Reviewed-by: Shay Drory --- 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/eth= ernet/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 *de= v, u16 vecidx) return -ENOMEM; =20 af_desc->is_managed =3D 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 =3D mlx5_irq_affinity_request(dev, pool, af_desc); if (IS_ERR(irq)) { kvfree(af_desc); --=20 2.36.1 From nobody Mon Jun 8 06:35:41 2026 Received: from out-186.mta0.migadu.com (out-186.mta0.migadu.com [91.218.175.186]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E0ACA47CC71 for ; Thu, 4 Jun 2026 12:58:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.186 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780577891; cv=none; b=RQEOrsW4F/S8yKBPqBVgz+9c92IzdUJ7Xtu57uB9ZvoSC2DxHN2oKj/tGjob04/51SPDyZEbXzgJAxfOryuLKDyaA5c+SFOQdaI1Lun0c3St7ykq2vROVRmbAiVRBd4108UAbL6XRi1Tsgz5KCN1wuVB+hfFp7/i7lkOlD2xCLE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780577891; c=relaxed/simple; bh=ITxfvDI8oavPccggeMNhMEmG800okNLoYQVxixVjF4Q=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=XOe9xPAj115K1rc8gV+sU5+4qY4i0DekjATy1pVN6Tz4peqlrR9j7u5IbmH8FIIjvu+Qlg0UcpOkScGAaswnDRSbfasl+pukwRFnypDRVpHxMLs4sLbNHArhLukutvaEP8wJgAToNkhXJtIhN+V04+rZQAmHdYZq/Ftf/CgPWpw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=dqAS6YXd; arc=none smtp.client-ip=91.218.175.186 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="dqAS6YXd" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1780577888; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lzdPHcgJjIO+zOaddsmfgLBr0nf2Cuw80ULqxQvRe3g=; b=dqAS6YXdZ2542+iQaGqWxws+YR0KFa0MAKoAaREnVvgF+V/AqBr3p/vCrXTmpcmS1CCcP9 zAoAKdpZB3lwJVtJv/8PVcOjrASR2uuHhDFUOTSFvnMpLaVcrqHjqK9U75BMbM6pwX16hS wTFb4rbzmPz51e5iN0XrO2bawhMlSwk= From: Fushuai Wang To: saeedm@nvidia.com, leon@kernel.org, tariqt@nvidia.com, mbloch@nvidia.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, shayd@nvidia.com, parav@nvidia.com, moshe@nvidia.com Cc: netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, wangfushuai@baidu.com Subject: [PATCH v2 2/2] net/mlx5: Use effective affinity mask for IRQ selection Date: Thu, 4 Jun 2026 20:57:05 +0800 Message-Id: <20260604125705.21241-3-fushuai.wang@linux.dev> In-Reply-To: <20260604125705.21241-1-fushuai.wang@linux.dev> References: <20260604125705.21241-1-fushuai.wang@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" From: Fushuai Wang 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 a= ffinity") Suggested-by: Shay Drory Signed-off-by: Fushuai Wang --- 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/drive= rs/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 =20 lockdep_assert_held(&pool->lock); xa_for_each_range(&pool->irqs, index, iter, start, end) { - struct cpumask *iter_mask =3D mlx5_irq_get_affinity_mask(iter); + const struct cpumask *iter_mask; int iter_refcount =3D mlx5_irq_read_locked(iter); =20 + iter_mask =3D 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; --=20 2.36.1