Article View: linux.kernel.netdev
Article #19075Re: [PATCH net v2 1/5] eth: fbnic: wait on the correct queues in fbnic_queue_stop()
From: netdev-bot+sashiko
Date: Thu, 19 Nov 2026 09:54
Date: Thu, 19 Nov 2026 09:54
140 lines
13209 bytes
13209 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 0 (1) · Medium: 1 · Low: 0
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] After this patch, fbnic_queue_stop() passes
nv->qt[t].cmpl.q_idx to fbnic_wait_queue_idle().
Pre-existing issues:
- [High] This problem wasn't introduced by this patch, but
fbnic_queue_stop() stops the vector's netdev Tx queues with a bare…
--
eth: fbnic: wait on the correct queues in fbnic_queue_stop()
This patch sets q_idx on Tx completion rings. fbnic_queue_stop() now
passes cmpl.q_idx to fbnic_wait_queue_idle(), so Rx queues no longer
wait on queue 0. It also skips stop and wake of Tx rings that are
marked FBNIC_RING_F_DISABLED.
> diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c b/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c
> index 07d4b2e923627..5efed21e59329 100644
> --- a/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c
> +++ b/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c
[ ... ]
> @@ -3089,13 +3092,16 @@ static int fbnic_queue_stop(struct net_device *dev, void *qmem, int idx)
> napi_disable_locked(&nv->napi);
> fbnic_nv_irq_disable(nv);
>
> - for (i = 0; i < nv->txt_count; i++)
> + for (i = 0; i < nv->txt_count; i++) {
> + if (nv->qt[i].sub0.flags & FBNIC_RING_F_DISABLED)
> + continue;
> netif_stop_subqueue(dev, nv->qt[i].sub0.q_idx);
> + }
> fbnic_nv_disable(fbn, nv);
[Severity: High]
This isn't a bug introduced by this patch, but does anything here wait
for an fbnic_xmit_frame() call that is already running on another CPU?
netif_stop_subqueue() only sets __QUEUE_STATE_DRV_XOFF. Nothing calls
__netif_tx_lock() or synchronize_net() before fbnic_nv_disable(),
fbnic_wait_queue_idle() and fbnic_nv_flush() run. Only the full-down
path in fbnic_pci.c uses netif_tx_disable().
A sender may pass the netif_xmit_frozen_or_stopped() check before the
bit is set. It can then still be inside fbnic_tx_map(), writing
tx_buf[], ring->tail and the BQL state, and ringing the doorbell.
Suppose it sets ring->tail after fbnic_nv_flush() has run:
fbnic_nv_flush()
fbnic_clean_twq0(nv, 0, &qt->sub0, true, qt->sub0.tail);
...
netdev_tx_reset_queue(tx_queue);
Is the skb and its DMA mapping then leaked once __fbnic_nv_restart()
re-enables the ring and fbnic_enable_twq0() resets head/tail to 0? BQL
would also keep in-flight bytes that never complete, and that can
stall the Tx queue.
Now suppose the sender is delayed until after fbnic_enable_twq0() has
done this:
twq->tail = 0;
twq->head = 0;
It would then write a stale ring->tail and ring the doorbell, and the
hardware would fetch old descriptors whose buffers are already
unmapped. Could those completions make fbnic_clean_twq0() read a NULL
ring->tx_buf[] entry and dereference FBNIC_XMIT_CB(skb)->desc_count on
it?
To hit this, a queue restart (netdev bind-rx devmem, io_uring zcrx) has
to run on an Rx queue whose NAPI vector also serves a combined Tx queue,
while another CPU is sending on that Tx queue.
>
> for (t = 0; t < nv->txt_count + nv->rxt_count; t++) {
> err = fbnic_wait_queue_idle(fbn, t >= nv->txt_count,
> - nv->qt[t].sub0.q_idx);
> + nv->qt[t].cmpl.q_idx);
[Severity: Medium]
On an Rx-only vector the Tx triad has sub0 disabled and carries only the
XDP TWQ1 ring, so this call becomes fbnic_wait_queue_idle(fbn, false,
txq_idx). Does fbnic_wait_queue_idle() actually cover TWQ1 of that
queue?
It builds a single bit from the queue index and tests that bit in all
four Tx idle arrays:
fbnic_wait_queue_idle() {
...
off = idx / 32;
mask = BIT(idx % 32);
...
}
The TWQ, TQS and TDE idle arrays are twice as wide as the TCQ one:
#define FBNIC_QM_TWQ_IDLE_CNT 8
#define FBNIC_QM_TCQ_IDLE_CNT 4
#define FBNIC_QM_TQS_IDLE_CNT 8
#define FBNIC_QM_TDE_IDLE_CNT 8
There are 128 queues with two work queues each (TWQ0 and TWQ1), so this
looks like one bit per TWQ. fbnic_wait_all_queues_idle() reads all 8
registers, but fbnic_wait_queue_idle() only reads registers 0 to 3.
If bit idx maps to TWQ0, it is always idle here, because TWQ0 is
FBNIC_RING_F_DISABLED on this triad. The TWQ1 ring that carries XDP_TX
traffic would then never be polled.
Next, fbnic_queue_stop() calls fbnic_nv_flush(), which runs
fbnic_clean_twq1() and unmaps the XDP buffers. Could the hardware still
be fetching TWQ1 descriptors at that point?
The bit layout isn't documented in-tree, so the answer depends on the
hardware. The commit message gives "fbnic_wait_queue_idle(tx, 39)" as
the wait on the vector's XDP Tx queue. Is that wait enough to cover
TWQ1?
> if (err)
> goto err_restart;
> }
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261117215416.1901246-1-dimitri.daskalakis1%40gmail.com
Technical Details
Message-ID:
<179508206173.3136.15402623456535892800@kernel.org>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-366914-linux-kernel-netdev=dewy.ruReferences:
<20261117215416.1901246-2-dimitri.daskalakis1@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-366914-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net v2 1/5] eth: fbnic: wait on the correct queues in fbnic_queue_stop() Date: Thu, 19 Nov 2026 09:54:21 +0000 Organization: Usenet Network Message-ID: <179508206173.3136.15402623456535892800@kernel.org> References: <20261117215416.1901246-2-dimitri.daskalakis1@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2842130"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:1WfLSNRjXVKVG1ERV5tVo93+51M= sha256:IvxhUlYD/+FF+73T4wXZ78aKth62kaNTDnFXqKA/EVM= sha1:bMfpzKttqI3lC+kwWeKKF2ciQgk= sha256:y0TgGItfeopCM74cn+5+jfm9VEHkpRpul4g9mSHwY6g= 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 12DD41155A7; Thu, 19 Nov 2026 12:54:41 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.4 X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, 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 JGY_F42_H6Mp; Thu, 19 Nov 2026 12:54:36 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-366914-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 72A4A1155A0; Thu, 19 Nov 2026 12:54:28 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 70CFE1E3F9B; Thu, 19 Nov 2026 09:54:25 +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=1795082064; b=so3mcwfbPbf1KWW1u6sBxd36ZPxZUwbDpyGAnfSA5uQJ5/1jV5qKCyqECX+OXJjL7Lu1 8KzipeZ+XgKjHKOhQWHxAhW8Q/sQvtxnaF/izVcTuUk7MqS82EEHlFWo7sRkdKG4rUlym H5yEUoJBHk8Mqc1rAEgeQizZUgREDjupej6QLuVHovG6D9D5lN+3nSbFltzMighpJmwtB 7ggsNLO0ZWCONgEAMPC7tC0Uhq8dhXv59/sP1uzoR1NNaFcnEIFRE5QvxZzpOzfiAETRT 8iMEjJqNztsT/MEbRY8iciTuC+u/4gRqvOzWZmUaeJ5JkAJW9cA91vUEhjvdnn4hjVQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795082064; 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=h9SsKa89pdv6CdZOat+96TxZ6dXD8Iqx3PWwB13ANYM=; b=wJz14dkKs2m7qfKlMefjc/m5el/EgoAKdE6h0KQVRx5yb0Q0B+bkwlCGsV53PDcwaS5y 7AqxitV9zj44y0XtkA33FHQ5BuLzwFgyNcNWB+XeIEz31BZi11CcKtZbJBKGtPV2NhbpX ZsoLNly+J9Kp5Q0mJNvlqNARVzI/7mFjuxd88uduZM9j6Gnv2WJVOc7wip6NnLNyePDXx TZayDAZXxmsjA8NTJWRh31sk0Yi13eqrE8TSzQD82qCqmGp20dXEhscPX4DDBg4naZ9h6 4h+HRcMdsIMjOOQfd9qGEcybZMcOrMaPsLNy0B0Z4Brir0cYiqtZOZa6dNdn7Ol/nfA== 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=aSsOv2Ba; 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 85023606A330; Thu, 19 Nov 2026 09:54:24 +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=aSsOv2Ba 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=1795082063; b=ZYbl2S5Gpn8Z0qWImSofHTPXQOJtnhJ4QpePgw4sb5cP1TUynqaLeSDsVHJvfMcouk6n Q3gWUy8wp5cK5plTVXk3pV83i6ccJx4SoXFRZuAN1bMkJtMd1zva6SIiUM8ZdfGDPN6iA 3nRF2S6KjSOQys2WdiZcYnVlnkQhFKyOZ2gcf76whXLG93bF3sJ23h8za5uU5SJioxCkn n1s+iZQB5/7M0Vyee4BHlDY0kOui4vEov2sfb8m8Ie+lmwBXwecJx75oTuuYRHHio5j7k cSDgLTuydCPdx23+Sn5xR78cUCaWmfH3OFWaP4G4QQwaR/PdRdo1pa2N6LMy9lEi7AA== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795082063; 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=h9SsKa89pdv6CdZOat+96TxZ6dXD8Iqx3PWwB13ANYM=; b=Xufmtej93dV1hOPGEcGofYD2lo/QefsdAwkwxig5YBLL2HZ6gWVP+H/zCEQgHHEhIiEd ySuHZZfzmnDNvjApf/RsnWTB8VGdzT54gelh6x2sQzRkzE0Ft0+rGPF9Aqhg4C9fg3MpI +WwhCEJj5314nReYLTHUqKcbL9vDQ0gleLzCkBsW5LWgJx5N9W0Xv7mTkVhwS/Nw8fOge sTyqvozgiMPuF6zOFRbw/0RDbxb/g7S8LUFO2XTyL2IUO/ewGQDcfLHPlNFpxB2NtHGHT l+aUG6g0RL9rz/NsUIKpVuUe7X6Xjqj1kO2+oMwfEPznrVj8Sd5wlcwmpYRoFuR1FRA== 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=aSsOv2Ba; 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 A2092606A320; Thu, 19 Nov 2026 09:54:23 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2FDB41F000C5; Thu, 19 Nov 2026 09:54:22 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795082063; bh=h9SsKa89pdv6CdZOat+96TxZ6dXD8Iqx3PWwB13ANYM=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=aSsOv2BaxlpvGGuDpyN71M7yc+4TZItkDwPgE/mVRRxpKY/5Is1ICLm1OgQDx1CQU BA0gi+RgMuVvWHZeDOzxTCb2FZXMyL9Z9/FVms1/Van+NgiraVVl5+ChPi5CB+in0C XH/kpzSmFGtfsk/A4mqAhJZgHTf4iaen7PonvaAAK3ZiUi/F2/a66EezcOG7ADXlae p3GO/y46uHeMN7OeP4VWcAvW6EW3ubHu9BOEwkegZPuNYkm4wQHv1Lxdpv1zX4Bt21 f6EAHh607LaZEcwkMIHTnB2AJFaHdpmMldXw3eVwcCptWwhlNP8BT03LuCdW7ddVpI wswesMqFXK85Q== X-Cc: davem@davemloft.net, alexanderduyck@fb.com, kuba@kernel.org, kernel-team@meta.com, andrew+netdev@lunn.ch, edumazet@kernel.org, pabeni@redhat.com, shuah@kernel.org, hmohsin@meta.com, mike.marciniszyn@gmail.com, sdf@fomichev.me, bobbyeshleman@meta.com, bjorn@kernel.org, leitao@debian.org, horms@kernel.org, almasrymina@google.com, vadim.fedorenko@linux.dev, daskald@meta.com, netdev@vger.kernel.org, linux-kselftest@vger.kernel.org X-In-Reply-To: <20261117215416.1901246-2-dimitri.daskalakis1@gmail.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