From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 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== 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== 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 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) 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 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B73731F00A11; Sat, 5 Dec 2026 14:46:23 +0000 (UTC) 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== Subject: Re: [PATCH net-next v12 10/10] bnge: add cpu_rmap support for IRQ affinity From: netdev-bot+sashiko@kernel.org To: vikas.gupta@broadcom.com 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 Date: Sat, 05 Dec 2026 14:46:23 +0000 Message-ID: <179648198330.3146.10471721168563018721@kernel.org> In-Reply-To: <20261201132011.2705569-11-vikas.gupta@broadcom.com> References: <20261201132011.2705569-11-vikas.gupta@broadcom.com> X-sashiko-severity: Low Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 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