From: sashiko-bot@kernel.org
To: "Wei Hu" <weh@linux.microsoft.com>
Cc: linux-rdma@vger.kernel.org, linux-hyperv@vger.kernel.org,
bpf@vger.kernel.org
Subject: Re: [PATCH net-next v7 07/13] net: mana: swap queue sets in mana_change_mtu
Date: Sat, 17 Oct 2026 15:39:27 +0000 [thread overview]
Message-ID: <sashiko-outbox-175607@kernel.org> (raw)
In-Reply-To: <87e016ed7479a33be87128b01bb07d2e1807c87d.1791710735.git.weh@linux.microsoft.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] mana: data race on TX stats syncp in mana_xdp_xmit
--
commit 03c88ebc19bffbae5acfce1a1948eb4cb597ee75
Author: Long Li <longli@microsoft.com>
net: mana: swap queue sets in mana_change_mtu
Carry the MTU in the queue set and size replacement RX buffers from it.
Publish ndev->mtu after RSS configuration succeeds; allocation failure
leaves the live queues and advertised MTU unchanged.
> diff --git a/drivers/net/ethernet/microsoft/mana/mana_bpf.c b/drivers/net/ethernet/microsoft/mana/mana_bpf.c
> index 484f061bc75e4..687b9ce7d9a3b 100644
> --- a/drivers/net/ethernet/microsoft/mana/mana_bpf.c
> +++ b/drivers/net/ethernet/microsoft/mana/mana_bpf.c
> @@ -68,7 +73,7 @@ int mana_xdp_xmit(struct net_device *ndev, int n, struct xdp_frame **frames,
> count++;
> }
>
> - tx_stats = &apc->tx_qp[q_idx]->txq.stats;
> + tx_stats = apc->tx_qp[q_idx]->txq.stats;
>
> u64_stats_update_begin(&tx_stats->syncp);
> tx_stats->xdp_xmit += count;
[Severity: Medium]
Does this stats update in mana_xdp_xmit() lack mutual exclusion when racing
with other CPUs?
When multiple CPUs redirect traffic via ndo_xdp_xmit, they can map to the
same q_idx (since q_idx = smp_processor_id() % real_num_tx_queues) and
execute u64_stats_update_begin() concurrently.
This could also race with mana_start_xmit(), which updates the same
per-queue syncp:
> diff --git a/drivers/net/ethernet/microsoft/mana/mana_en.c b/drivers/net/ethernet/microsoft/mana/mana_en.c
> index 489558176a5de..c1ff4d9b8d45f 100644
> --- a/drivers/net/ethernet/microsoft/mana/mana_en.c
> +++ b/drivers/net/ethernet/microsoft/mana/mana_en.c
> @@ -551,7 +579,7 @@ netdev_tx_t mana_start_xmit(struct sk_buff *skb, struct net_device *ndev)
> /* Populated the packet and bytes counters based on post GSO packet
> * calculations
> */
> - tx_stats = &txq->stats;
> + tx_stats = txq->stats;
> u64_stats_update_begin(&tx_stats->syncp);
> tx_stats->packets += num_gso_seg;
While mana_start_xmit() holds __netif_tx_lock, that lock does not protect
against lockless mana_xdp_xmit() calls.
On architectures where u64_stats_update_begin() uses seqcounts, could this
concurrent modification corrupt the seqcount and cause readers (like
mana_get_stats64()) to infinite loop or read torn values?
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1791710735.git.weh@linux.microsoft.com?part=7
next prev parent reply other threads:[~2026-10-17 15:39 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-16 15:38 [PATCH net-next v7 00/13] net: mana: reconfigure by replacing the queue set Wei Hu
2026-10-16 15:38 ` [PATCH net-next v7 01/13] net: mana: add queue-set allocation and teardown helpers Wei Hu
2026-10-17 15:39 ` sashiko-bot
2026-10-16 15:38 ` [PATCH net-next v7 02/13] net: mana: share the EQ pool across a queue-set swap Wei Hu
2026-10-17 15:39 ` sashiko-bot
2026-10-16 15:38 ` [PATCH net-next v7 03/13] net: mana: keep per-queue statistics in the port context Wei Hu
2026-10-17 15:39 ` sashiko-bot
2026-10-16 15:38 ` [PATCH net-next v7 04/13] net: mana: swap queue sets in mana_set_channels Wei Hu
2026-10-17 15:39 ` sashiko-bot
2026-10-16 15:38 ` [PATCH net-next v7 05/13] net: mana: swap queue sets in mana_set_ringparam Wei Hu
2026-10-17 15:39 ` sashiko-bot
2026-10-16 15:38 ` [PATCH net-next v7 06/13] net: mana: swap queue sets in mana_set_priv_flags Wei Hu
2026-10-17 15:39 ` sashiko-bot
2026-10-16 15:38 ` [PATCH net-next v7 07/13] net: mana: swap queue sets in mana_change_mtu Wei Hu
2026-10-17 15:39 ` sashiko-bot [this message]
2026-10-16 15:38 ` [PATCH net-next v7 08/13] net: mana: swap queue sets in mana_xdp_set Wei Hu
2026-10-17 15:39 ` sashiko-bot
2026-10-16 15:38 ` [PATCH net-next v7 09/13] net: mana: do not bail out of mana_detach on dealloc failure Wei Hu
2026-10-17 15:39 ` sashiko-bot
2026-10-16 15:38 ` [PATCH net-next v7 10/13] net: mana: release EQs left idle by a channel-count reduction Wei Hu
2026-10-17 15:39 ` sashiko-bot
2026-10-16 15:38 ` [PATCH net-next v7 11/13] net: mana: keep a user-configured RSS table across a queue rebuild Wei Hu
2026-10-17 15:39 ` sashiko-bot
2026-10-16 15:38 ` [PATCH net-next v7 12/13] net: mana: keep the surviving queues when the channel count is reduced Wei Hu
2026-10-17 15:39 ` sashiko-bot
2026-10-16 15:38 ` [PATCH net-next v7 13/13] net: mana: keep the existing queues when the channel count is raised Wei Hu
2026-10-17 15:39 ` sashiko-bot
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=sashiko-outbox-175607@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=weh@linux.microsoft.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.