Article View: linux.kernel.netdev
Article #27410Re: [PATCH net-next v12 10/10] bnge: add cpu_rmap support for IRQ affinity
From: netdev-bot+sashiko
Date: Sat, 05 Dec 2026 14:46
Date: Sat, 05 Dec 2026 14:46
147 lines
13503 bytes
13503 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] The patch builds its own aRFS cpu_rmap handling in
drivers/net/ethernet/broadcom/bnge/bnge_netdev.c, although the…
- [Low] The new comment on struct bnge_irq
(drivers/net/ethernet/broadcom/bnge/bnge_resc.h:67) says that @ring_nr…
--
bnge: add cpu_rmap support for IRQ affinity
This patch turns on aRFS for bnge. When NTUPLE is enabled, it allocates
dev->rx_cpu_rmap at open and frees it at close. A driver-installed IRQ
affinity notifier on every RX NQ and on NQ0 keeps the rmap entries up to
date. A new bn->rmap_lock and a saved NQ0 affinity are used to seed entry
0 at open.
> diff --git a/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c b/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c
> index de7320521a3e0..54ea9aa5b0d32 100644
> --- a/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c
> +++ b/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c
[ ... ]
> @@ -2552,14 +2572,155 @@ static void bnge_hwrm_resource_free(struct bnge_net *bn, bool close_path)
[ ... ]
> +static void bnge_register_irq_notifier(struct bnge_net *bn,
> + struct bnge_irq *irq)
> +{
> + struct irq_affinity_notify *notify = &irq->affinity_notify;
> + int rc;
> +
> + irq->bn = bn;
> + notify->irq = irq->vector;
> + notify->notify = bnge_irq_affinity_notify;
> + notify->release = bnge_irq_affinity_release;
> + rc = irq_set_affinity_notifier(irq->vector, notify);
[Severity: Low]
Was the core-managed cpu_rmap path considered here?
The networking core already provides netif_enable_cpu_rmap(), the
rx_cpu_rmap_auto handling in netif_napi_set_irq_locked(),
netif_set_affinity_auto(), and netif_del_cpu_rmap() called from
free_netdev(). ena, ice, iavf and idpf already use it.
bnge already gives the core the IRQ of every NAPI, NQ0 included, in
bnge_init_napi():
netif_napi_set_irq_locked(&bnapi->napi,
bd->irq_tbl[map_idx].vector);
However, it never sets rx_cpu_rmap_auto or irq_affinity_auto. As a
result, netif_napi_set_irq_locked() returns early and the core never
uses that mapping.
An IRQ can only have one irq_affinity_notify attached. This driver
notifier therefore rules out the core notifier on the same vectors. The
commit message explains why irq_cpu_rmap_add() is unsuitable, but it
doesn't mention the core path.
The driver-built approach also adds bn->rmap_lock, the embedded
bn->nq0_aff cpumask and bnge_nq0_seed_cpu_rmap(). It also allocates and
frees dev->rx_cpu_rmap on every open and close, in
bnge_setup_interrupts() and bnge_free_cpu_rmap(). Freeing the rmap at
close opens the window that the comment above bnge_free_cpu_rmap()
describes:
set_rps_cpu() loads the pointer twice with plain loads, so a reader
that is between the two loads is not covered; that has to be fixed
in the core.
A core-managed rmap lives until free_netdev(), so it doesn't have that
window.
The core path looks usable for bnge. When the rmap is full, cpu_rmap_add()
returns -ENOSPC, so TX-only NAPIs past rx_nr_rings would be skipped. With
irq_affinity_auto set, napi_restore_config() calls irq_set_affinity()
when the NAPI is enabled. That might also fix the NQ0 seeding problem
described in the commit message, though this hasn't been confirmed.
Could the core path be used here instead? If not, could the commit
message explain why it doesn't fit bnge?
> + if (rc)
> + netdev_warn(bn->netdev,
> + "Set affinity notifier failed, IRQ = %d: %d\n",
> + irq->vector, rc);
> +}
[ ... ]
> @@ -2583,6 +2744,16 @@ static int bnge_nq_request_irq(struct bnge_net *bn, struct bnge_napi *bnapi)
> return rc;
>
> irq->requested = 1;
> + irq->ring_nr = bnapi->index;
> +
> + /* The affinity notifier keeps the aRFS rmap entry of this ring
> + * current. It does not use cpu_mask, so install it independent of
> + * the allocation of the hint mask below. NQ0 is requested at probe,
> + * when it has no rx_ring yet, and its notifier must exist from then
> + * on.
> + */
> + if (bnapi->rx_ring || bnapi == bn->nq0)
> + bnge_register_irq_notifier(bn, irq);
[Severity: Low]
This isn't a bug today, but the new comment on struct bnge_irq in
bnge_resc.h says:
* @ring_nr is the RX ring (and rmap) index this vector serves.
bnge_nq_request_irq() sets ring_nr = bnapi->index for every open NQ,
before and regardless of the rx_ring check. When BNGE_EN_SHARED_CHNL is
clear, bnge_alloc_core() places the TX rings after the RX rings:
if (bd->flags & BNGE_EN_SHARED_CHNL)
j = 0;
else
j = bd->rx_nr_rings;
The TX-only NQs then have no rx_ring and get ring_nr >= rx_nr_rings.
That is neither an RX ring index nor a valid rmap index.
Nothing goes out of range today. Those NQs get no notifier, and
bnge_irq_affinity_notify() checks irq->ring_nr < bn->bd->rx_nr_rings.
Could the comment be adjusted, or ring_nr be set only for NQs that serve
an RX ring? Otherwise a later user that trusts the comment could index
bn->rx_ring[] or the rmap past rx_nr_rings.
>
> if (zalloc_cpumask_var(&irq->cpu_mask, GFP_KERNEL)) {
> int numa_node = dev_to_node(&bd->pdev->dev);
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261201132011.2705569-1-vikas.gupta%40broadcom.com
Technical Details
Message-ID:
<179648198330.3146.10471721168563018721@kernel.org>Path:
mbox-mo1.pugleaf.net!news-lon.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-378025-linux-kernel-netdev=dewy.ruReferences:
<20261201132011.2705569-11-vikas.gupta@broadcom.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lon.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-378025-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next v12 10/10] bnge: add cpu_rmap support for IRQ affinity Date: Sat, 05 Dec 2026 14:46:23 +0000 Organization: Usenet Network Message-ID: <179648198330.3146.10471721168563018721@kernel.org> References: <20261201132011.2705569-11-vikas.gupta@broadcom.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="3049427"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:p85qGwSDwuE/F/nQfLyUzWMjOos= sha256:UAOcdODi81AKHHPIS4WhZ3hbaK7D1YAlOIdLBLcU7pg= sha1:1XtyUJJHtOyn7arp0IMqlZzu7/o= sha256:ctqLpON97cV5asn+DmMfTse4BjGZXiCIMX8iUP2TOOk= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 0C665117E35; Sat, 5 Dec 2026 17:47:03 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.639 X-Spam-Status: No, score=-3.639 tagged_above=-9999 required=6.31 tests=[DKIMWL_WL_HIGH=-0.14, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lWKpj9Holm4b; Sat, 5 Dec 2026 17:47:00 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-378025-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id 80111117E40; Sat, 5 Dec 2026 17:46:49 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id C1A5C2C3CA; Sat, 5 Dec 2026 14:46:41 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796481985; b=WsmfmQgDgO30evYrwrxUFAl9pStrajG2OgrMFNQH5TtHOCThSdsKCRTF0FoELeLjjEC3 ygkw/1/sNyr3OZfOiWMNG9o4+OSVVl9HOnBRFIKUk6dT1zFqF3PvZKOgoRvqpNoCo4xH7 2ECCj6uJGTDhx81XGGAolIQZq9KsnO/COUb7a9Vx8ppZW6bzEQGvexQ02D7LG+aVEIGKU oGo9m6S24x+kjhqBfbDyj15rL4WfnTjMPjt+AMHjUQPtbmvYqz+SP2HAXcfnALZLJRmT5 N5da/4VvPKxNsWuZp7F2z1J/rWmPDnmrNY9NUyi+V5gq3ahTUBVvTu1SRvHYxoxABvw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796481985; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=sFSLyukLvkQAaIIPWPU2jExLMagfzpaCIl1KyTtWhIk=; b=fgXfRM+Vvz+ruf2u3cfKR7s78gZdrWhQpHEkjCRLFjfdB15HPX3WH4LNVG/9brLA8d26 L1H8TEctZErcLRF9IQfQWwz084yiUSZKxzpFdWWW9DU42EQ0v84CDE58SdjbBJ8D38Gqu ytS1rtZkYXBeg5d7kZZk2n9v7eyx7ZI9AVk9Z2NBlN6WIm55Zyr3uzac4G1sy5lJ1NCAD 0MF527KKCH5mzYSibrV60KWMoPDTlrQgv5TzaApbPX/ZS+HmSPGU4PgG2Skyxvxq+teY1 TsCWeNNWmDCc9ZCegu4P53+SklkIOiq9cY2ZZN7tGQLrLeGHHk8AmQ8jNO1hXopN1yg== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=fHoLnbhM; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C6DA460A2626; Sat, 5 Dec 2026 14:46:25 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=fHoLnbhM X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796481985; b=mub6OTffPDw2jlKcW6exvpzDNuqydhCuVSiIeJdjJalf3vp4fC2jipVr1Ny7AD2XpBVL Zb3cSE3MUsPXxa6g1mDxRWemXR+lfq3BWvRLls2aqbP0Gi1pi68VfuujFEHHWdRPvhFSd FOP+/GWQRgloRb1BYw1yfSw6I21X2zQG4+8GibmN7vyBcvfIRk+1w4t99AUDzqVdGtn4Q lJiqXzdL2Eeux2F9VXD9KO7oFMSUsfL79e8SrIXh91i41NAvdjezVIicEZBKb/hMFH/VD 91mUDWNbiz7H1q3q/WCG0VKTz9RMnpu70k4/28lht9ISn3Vw3QJZqr6IvaRFHuEko6g== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796481985; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=sFSLyukLvkQAaIIPWPU2jExLMagfzpaCIl1KyTtWhIk=; b=VBpd9pZ+ll2NV0CexHsmvDc9M/Ou6Zi2IBZnxGzfTP7cyjSpQrr5twIkR3wCL0YRfB6X nQ6lbXYRY7HosJq5z4aI28WeFAagDkra0Nf5xnzxcKmbRnATcANrPX2GwILJW03uY0HvT FQ/Tx/Z/qggzFV6PXRfoN1ovGBhjowzEsOGM0K6ixDwf8AMT2fUk1CV22WZL4a/Y/PphR LFG8VEMNx4x/pQ6c055ORDWJnXO1gV0HSos/wwiVF8XBjN4usBHs4ePpmyWaqDviYeGtt gCAfOWCy+ncDWSTmN0ZwfIR7yT9G+Ee+WsIaXb3ZaBOexH0j33rXpoDWxMNgs4iTfXw== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=fHoLnbhM; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E7408606A69B; Sat, 5 Dec 2026 14:46:24 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id B73731F00A11; Sat, 5 Dec 2026 14:46:23 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796481984; bh=sFSLyukLvkQAaIIPWPU2jExLMagfzpaCIl1KyTtWhIk=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=fHoLnbhMV3lF0ROc+wuMPEDfYDWUwMHUZM7bt8kj7GA4vc20fyne8Z9H23vByW+/d 6Wq3FhiOj3tlp1jtXxPi3SWuuHq3hHntUUhmtaWUVrg0OHEFOfh2SRZS8ckCra5R9Q QZ+K6czknX4jZwEPFUKHMZ4JfNQ3Tl7FCAM4jjndg4JIcDHkDL5qh2ZjUJ/WW+5Mo7 8gWD13WmRueym98qe9T6gajrDIDJJTCGvJohpCR/pQVuK6Orsii9RC3IdWkDEBFYMn JOGAwtrFRDnvQPfTPUT2Dmscx7c4WF/MBz92eFGgVGLEv2yPSUoNmyy4NlQuBrhAcz x/x+JsG5qA8wA== X-Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, andrew+netdev@lunn.ch, horms@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bhargava.marreddy@broadcom.com, rahul-rg.gupta@broadcom.com, vsrama-krishna.nemani@broadcom.com, rajashekar.hudumula@broadcom.com, dharmender.garg@broadcom.com, ajit.khaparde@broadcom.com X-In-Reply-To: <20261201132011.2705569-11-vikas.gupta@broadcom.com> X-sashiko-severity: Low X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list