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=1796107188; b=zmG+2ny/cGAId0yh5xNA+tCQbHhupMjBLQiG9CqbnR6DAUvFdH3gRUo1y8bO8Oj0YwBW ZsDq59DDN/WLfzPra4F/zt2weef5160kgEXQu0SLMFuxMzQoYb8JbBuA7Dq/UqFG5/6un RyYCSdlrdR2rpxxWCfIScL6HonqczhOEJ7zjgtRBivKRwF58v/zXi8eC6LuOtTaYYdg7I dx4ifcCiRIcwjNLQQ5CW1iDj1jiU8mrUKhoJOLuYelJzd9fZSsB5Awtpal5+ZjwKRFucj ZukbHKhI2BMJ1oJ5CCsVk73bnc9mjo6yc/vltRHy+ywhQM7G+J/5yDuoiSrGkicojQQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796107188; 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=I/Y0VdFuOvmfB8AwiMYrrULXIWcNfJlbwrP1j8d/mgI=; b=KM5mmlhNw7oFKKD5RxW+VlIxQ1ACtKeQvuHYzTcchmXxu8SxEmFBYP2gr6CdMO1Qy0yP cZAcmAovvhim+FcJOovYz4fNfvz64VqRM0D6GmC+dBvitd6jnf55SvaGG5pzTbUCVc+WP LchVrc4S53Tezb2vapPxnaW8JDebMbdYJkfd04/iL+VQ//GMDCxaEttJ1WGTDhPueQUgW +76g/Cad350SsT2T/P9bPakui5si0ug9ZEDqauiHd2u6iLCBKVLeMBUZ4jcI/mDP6x72f grANhDZV9JoVmehHuOuys0+RJgdCLuHkVFiOHgZ5qfCpfGvifKwdpZf85vBa27qA8HQ== 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=PdKTRhFJ; 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 9D32A60A2629; Tue, 1 Dec 2026 06:39:48 +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=PdKTRhFJ Received: by smtp.kernel.org (Postfix) with ESMTPSA id 68ABF1F008A0; Tue, 1 Dec 2026 06:39:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796107188; bh=I/Y0VdFuOvmfB8AwiMYrrULXIWcNfJlbwrP1j8d/mgI=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=PdKTRhFJWz3igNdy3/jIjFZNHuLrw3EEbk5xNFAIsvIaQ0a95enGPheeo+HpP/Kuw sMvxEr6/Yf6Rzn29Xz6rJR5r0bryZXOVEgLxNyAKgxmg4PCE+T6kXEeLIN7Ek/xwP1 lF/3gp7ip91TH7KL/zqX1/2BSiPZVSgGT+xZdoqRnmGGA1z/8mkiB/mcWFeIIO0+c6 H2feHEnz7WtLP+a4ggyyxqZXwFp9CM1wxFbSLe37+AY297IGuostLBa+u9fgNvDpT+ E3T4qoZzsZ6Sa08bg1dwRW4ggu4el8L3Y20Jk8TsCAlIgS2+A+kW1YK+iDS+Jl/8T8 rQenh/Q6UJiOg== Subject: Re: [PATCH net-next v11 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: Tue, 01 Dec 2026 06:39:46 +0000 Message-ID: <179610718694.3146.14417433453170301894@kernel.org> In-Reply-To: <20261130055736.2306367-11-vikas.gupta@broadcom.com> References: <20261130055736.2306367-11-vikas.gupta@broadcom.com> X-sashiko-severity: Medium 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 3 potential issue(s) to consider. Critical: 0 · High: 0 · Medium: 1 · Low: 2 If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough). - [Medium] The commit message describes an irq_cpu_rmap_add() design that the patch does not implement. - [Low] If one ring's rmap entry cannot be filled in, the driver only warns and keeps aRFS on with that entry left at its default. - [Low] bnge_nq0_seed_cpu_rmap() (bnge_netdev.c:2658-2677) takes NQ0's mask from irq_get_affinity_mask(vector), which is… -- bnge: add cpu_rmap support for IRQ affinity When CONFIG_RFS_ACCEL is enabled and ntuple is on, this patch allocates a cpu_rmap sized to the RX rings and publishes it in dev->rx_cpu_rmap, which turns aRFS on. Per-ring IRQ affinity notifiers update the rmap entries, and entry 0 is seeded from the affinity of the persistent NQ0 vector at open. > If adding an IRQ to the rmap fails for one ring, aRFS is turned off > for all rings, because a later ring would otherwise take the free slot > and map to the wrong RX queue. > > NQ0 is requested at probe, before the rmap exists, and is not one of > the open NQs that bnge_request_irq() loops over. Add its vector to the > rmap first, so that the index of every vector in the rmap is its RX > ring index. Otherwise each vector lands one slot too low, and aRFS > steers a flow to the wrong RX queue. [Severity: Medium] Do these two paragraphs describe what the patch does? The driver never calls irq_cpu_rmap_add() or cpu_rmap_add(), so no code hands out rmap slots in sequence. Every update passes an explicit index: bnge_irq_affinity_notify(): rc = cpu_rmap_update(rmap, irq->ring_nr, mask); bnge_nq0_seed_cpu_rmap(): rc = cpu_rmap_update(bn->netdev->rx_cpu_rmap, 0, mask); With explicit indices, a later ring cannot take a free slot, and no vector can land one slot too low. The NQ0 step only copies NQ0's current affinity into entry 0. The failure behaviour also differs from the description. On failure, bnge_register_irq_notifier(), bnge_irq_affinity_notify() and bnge_nq0_seed_cpu_rmap() only call netdev_warn(). dev->rx_cpu_rmap stays published and BNGE_NET_EN_NTUPLE is not cleared, so aRFS stays on rather than being turned off for all rings. Is this text left over from an earlier version based on irq_cpu_rmap_add()? Could the commit message be updated to describe the explicit-index scheme and the warn-only failure handling? > diff --git a/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c b/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c > index de7320521a3e0..d336c0f580b6a 100644 > --- a/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c > +++ b/drivers/net/ethernet/broadcom/bnge/bnge_netdev.c [ ... ] > +static void bnge_nq0_seed_cpu_rmap(struct bnge_net *bn) > +{ > + const struct cpumask *mask; > + unsigned int vector; > + u16 map_idx; > + int rc; > + > + map_idx = bn->nq0->nq_ring.ring_struct.map_idx; > + vector = bn->bd->irq_tbl[map_idx].vector; > + mask = irq_get_affinity_mask(vector); > + > + mutex_lock(&bn->rmap_lock); > + if (bn->netdev->rx_cpu_rmap && mask) { > + rc = cpu_rmap_update(bn->netdev->rx_cpu_rmap, 0, mask); [Severity: Low] Can this seed write a stale mask into entry 0? irq_get_affinity_mask() returns desc->irq_common_data.affinity. It is read here without desc->lock, and any pending affinity move is ignored. The core notifier that drives bnge_irq_affinity_notify() for NQ0 uses the pending mask instead: kernel/irq/manage.c:irq_affinity_notify() { ... if (irq_move_pending(&desc->irq_data)) irq_get_pending(cpumask, desc); else cpumask_copy(cpumask, desc->irq_common_data.affinity); ... } On a chip with IRQCHIP_MOVE_DEFERRED, such as x86 PCI MSI without interrupt remapping, the following sequence looks possible: - NQ0's smp_affinity is changed. irq_set_affinity_locked() only records the new mask as pending and schedules the notify work. - bnge_open_core() calls disable_irq(vector0) before bnge_request_irq(), so the pending move cannot complete in this window. - The NQ0 notify work runs after bnge_setup_interrupts() has published the rmap and writes the new mask into entry 0. Alternatively it ran while the interface was down, when the rmap was NULL, and did nothing. - bnge_nq0_seed_cpu_rmap() then reads the old live mask and writes it into entry 0. - When the move later completes, irq_move_masked_irq() does not schedule the notifier again. Entry 0 would then stay stale until the next NQ0 affinity change. aRFS would steer flows from the old CPUs to RX ring 0 while NQ0 runs on the new CPUs. > + if (rc) > + netdev_warn(bn->netdev, > + "aRFS rmap seed failed: %d\n", rc); > + } > + mutex_unlock(&bn->rmap_lock); > +} [ ... ] > @@ -2590,9 +2746,12 @@ static int bnge_nq_request_irq(struct bnge_net *bn, struct bnge_napi *bnapi) > irq->have_cpumask = 1; > cpumask_set_cpu(cpumask_local_spread(bnapi->index, numa_node), > irq->cpu_mask); > - if (irq_set_affinity_hint(irq->vector, irq->cpu_mask)) > + if (irq_set_affinity_and_hint(irq->vector, irq->cpu_mask)) > bnge_warn(bd, "Set affinity failed, IRQ = %d\n", > irq->vector); > + } else { > + bnge_warn(bd, "No affinity hint mask, IRQ = %d\n", > + irq->vector); > } [Severity: Low] What happens to this ring's rmap entry when zalloc_cpumask_var() fails? In that case irq_set_affinity_and_hint() is never called and the notify work never runs for this ring, so its rmap entry is never written. But bnge_setup_interrupts() has already published dev->rx_cpu_rmap, and alloc_cpu_rmap() only sets placeholder values: lib/cpu_rmap.c:alloc_cpu_rmap() { ... for_each_possible_cpu(cpu) { rmap->near[cpu].index = cpu % size; rmap->near[cpu].dist = CPU_RMAP_DIST_INF; } ... } The same applies when cpu_rmap_update() returns -ENOMEM in bnge_irq_affinity_notify() or bnge_nq0_seed_cpu_rmap(), since both only warn. A failed irq_set_affinity_notifier() in bnge_register_irq_notifier() is handled the same way, although it can only fail for a missing desc or an NMI. Would set_rps_cpu() then keep steering flows by the cpu % size placeholder while aRFS stays on? Those RX queues' IRQs may not be near the consuming CPU. This needs CONFIG_CPUMASK_OFFSTACK=y and an allocation failure, and it only affects steering quality. It does differ from the commit message's description that a per-ring failure turns aRFS off. > return 0; > } [ ... ] -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261130055736.2306367-1-vikas.gupta%40broadcom.com