Article View: linux.kernel.netdev
Article #25004Re: [PATCH net-next v11 10/10] bnge: add cpu_rmap support for IRQ affinity
From: netdev-bot+sashiko
Date: Tue, 01 Dec 2026 06:39
Date: Tue, 01 Dec 2026 06:39
190 lines
14955 bytes
14955 bytes
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
Technical Details
Message-ID:
<179610718694.3146.14417433453170301894@kernel.org>Path:
mbox-mo1.pugleaf.net!srv.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-374745-linux-kernel-netdev=dewy.ruReferences:
<20261130055736.2306367-11-vikas.gupta@broadcom.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.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-374745-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next v11 10/10] bnge: add cpu_rmap support for IRQ affinity Date: Tue, 01 Dec 2026 06:39:46 +0000 Organization: Usenet Network Message-ID: <179610718694.3146.14417433453170301894@kernel.org> References: <20261130055736.2306367-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="1637748"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:20yK1bOtNj9fICmrOZpLAV8lTfM= sha256:OCb78pHfCbJl+G6+vniMcWP9QzZqiJ5x1YQVeL6blpo= sha1:epseOJnkQyY/Rhy8bmOV+HORS5k= sha256:EpgP2FmYopqa6Gl+WSdzIODHw3qWInUnVZlwS04b308= 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 8CA9F11726B; Tue, 1 Dec 2026 09:40:29 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.5 X-Spam-Status: No, score=-3.5 tagged_above=-9999 required=6.31 tests=[DKIMWL_WL_HIGH=-0.001, 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 hTAV3W7OgdVT; Tue, 1 Dec 2026 09:40:26 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-374745-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 D11C1117264; Tue, 1 Dec 2026 09:40:17 +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 3F3E926591; Tue, 1 Dec 2026 06:40:09 +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=1796107189; b=GZAUssIx+U/cJrloP/OZ20yXD9X7U03qVLcoPl92GDDMhrQ4ujuUSnTPj97ggixNQCbI i3HbPeCqXaFtUr7EaZYA9ehp4wsRfqyaVnLK7bt8DcpiYZkQysPutTTB0O2WEOVxixyIy RgeVNWbtaKGeOmjPioE1RER4RYy82OtW41Ye+yjxKoiyL1cIhX9rV8hV9pF3Qu61t0ARp sEtrCM1yCOJC7skBfArvRclrIGcfzqm9IzOIc2YT65bEUEsePXPQbZfmtJNVmtbuo/gSR u9IpQwknYNtrgrbL2TLCGqsXVV00yEzI28hDoPbo9dTByraHCLk1eO+d8kNG0ww+eyQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796107189; 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=I/Y0VdFuOvmfB8AwiMYrrULXIWcNfJlbwrP1j8d/mgI=; b=EzPYZUoq99Fs2j8bxyRN+DOkOtZFDgSZi+tgabSrJiYsDEovMG/8pTGudnuTwDimIwII j0Ha1BMBieBGQwHEzPU6FQJvIz91qTS0CYQEnEfnw7Ur9CPByeEirpU6hb/MgOz61rCMX LX2a8yBVBq50kniqUsBPrXteMPyofMUr/PZzBSCZcvPo0HAUsnRR5GadjaaUJEszJchAP jog18iPeh1Gj2gRXiYHgf2FFF+hQsQdij8n1zYRVZIyCm9rUuxwoK3C0o3/xE/VcLf4wT ZxLuSxaA5iwo02BaXMI+5gau4sbaPwgM61ag2jReCLUIRlgkiWJ7ZatTCm9R9SSQnMg== 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=PdKTRhFJ; 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 7BA2B606A6A1; Tue, 1 Dec 2026 06:39:49 +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=PdKTRhFJ 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=1796107188; b=zmG+2ny/cGAId0yh5xNA+tCQbHhupMjBLQiG9CqbnR6DAUvFdH3gRUo1y8bO8Oj0YwBW ZsDq59DDN/WLfzPra4F/zt2weef5160kgEXQu0SLMFuxMzQoYb8JbBuA7Dq/UqFG5/6un RyYCSdlrdR2rpxxWCfIScL6HonqczhOEJ7zjgtRBivKRwF58v/zXi8eC6LuOtTaYYdg7I dx4ifcCiRIcwjNLQQ5CW1iDj1jiU8mrUKhoJOLuYelJzd9fZSsB5Awtpal5+ZjwKRFucj ZukbHKhI2BMJ1oJ5CCsVk73bnc9mjo6yc/vltRHy+ywhQM7G+J/5yDuoiSrGkicojQQ== X-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== 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=PdKTRhFJ; 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 9D32A60A2629; Tue, 1 Dec 2026 06:39:48 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 68ABF1F008A0; Tue, 1 Dec 2026 06:39:47 +0000 (UTC) X-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== 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: <20261130055736.2306367-11-vikas.gupta@broadcom.com> X-sashiko-severity: Medium 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