From: sashiko-bot@kernel.org
To: "Stanislav Fomichev" <sdf.kernel@gmail.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH net v3 3/3] net: stmmac: document oversized AF_XDP frame handling
Date: Thu, 20 Aug 2026 16:06:47 +0000 [thread overview]
Message-ID: <20260820160648.6AE451F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260819160535.1472459-4-sdf@fomichev.me>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] The driver uses a bit flag and a polling loop to simulate a lock instead of using standard synchronization primitives.
--
--- Patch [3]: [PATCH net v3 3/3] net: stmmac: document oversized AF_XDP frame handling ---
commit 71d40d9a1bd119643235e87e55c9834a8a5c6c83
Author: Stanislav Fomichev <sdf.kernel@gmail.com>
net: stmmac: document oversized AF_XDP frame handling
This commit updates the driver to document its intentional ring imbalance
when dropping AF_XDP zero-copy frames that exceed taprio's queueMaxSDU. It
adds comments explaining that completing a rejected descriptor is unsafe
due to ordered completions, and instead wedges the ring to expose the error.
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 62de03e65a90c..6a532747c0394 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -2713,6 +2713,10 @@ static bool stmmac_xdp_xmit_zc(struct stmmac_priv *priv, u32 queue, u32 budget)
> if (priv->est && priv->est->enable &&
> priv->est->max_sdu[queue] &&
> xdp_desc.len > priv->est->max_sdu[queue]) {
> + /* Completions are ordered, so this descriptor cannot
> + * be completed safely. Wedge the ring to expose the
> + * application error instead.
> + */
> priv->xstats.max_sdu_txq_drop[queue]++;
> continue;
> }
[Severity: High]
This isn't a bug introduced by this patch, but I noticed an ad-hoc locking
pattern using a bit flag in stmmac_reset_subtask() in this file:
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:stmmac_reset_subtask() {
...
rtnl_lock();
netif_trans_update(priv->dev);
while (test_and_set_bit(STMMAC_RESETING, &priv->state))
usleep_range(1000, 2000);
set_bit(STMMAC_DOWN, &priv->state);
dev_close(priv->dev);
dev_open(priv->dev, NULL);
...
}
Are there any standard locking primitives that could be used here instead?
Simulating a lock with a bit flag and a sleep loop avoids lockdep tracking,
deadlock detection, and standard kernel memory ordering guarantees.
Could this pattern lead to subtle concurrency issues or hidden deadlocks
during the driver's reset task?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260819160535.1472459-1-sdf@fomichev.me?part=3
prev parent reply other threads:[~2026-08-20 16:06 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-19 16:05 [PATCH net v3 0/3] xsk: pre-existing AF_XDP TX metadata fixes from Sashiko Stanislav Fomichev
2026-08-19 16:05 ` [PATCH net v3 1/3] xsk: align TX metadata layout across ABIs Stanislav Fomichev
2026-08-19 16:05 ` [PATCH net v3 2/3] xsk: honor XDP_TX_METADATA in zero-copy path Stanislav Fomichev
2026-08-19 16:05 ` [PATCH net v3 3/3] net: stmmac: document oversized AF_XDP frame handling Stanislav Fomichev
2026-08-20 15:33 ` Maciej Fijalkowski
2026-08-20 16:06 ` sashiko-bot [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260820160648.6AE451F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=sdf.kernel@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox