From: netdev-bot+sashiko@kernel.org
To: gongfan1@huawei.com
Cc: wudi234@huawei.com, tengpeisen@huawei.com,
netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
andrew+netdev@lunn.ch, ioana.ciornei@nxp.com,
maxime.chevallier@bootlin.com, mohsin.bashr@gmail.com,
dimitri.daskalakis1@gmail.com, hramamurthy@google.com,
larysa.zaremba@intel.com, vadim.fedorenko@linux.dev,
linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
zhoushuai28@huawei.com, wulike1@huawei.com
Subject: Re: [PATCH net-next v02 2/5] hinic3: Avoid concurrent updates on 32-bit systems.
Date: Sun, 15 Nov 2026 04:56:52 +0000 [thread overview]
Message-ID: <179471861282.2199510.12155151522849226893@kernel.org> (raw)
In-Reply-To: <3c49f9de764a5d8c463706882e191a945f376518.1794371175.git.gongfan1@huawei.com>
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] The patch is titled "Avoid concurrent updates on 32-bit systems",
says the `+=` inside the u64_stats retry loop of hinic3_get_stats64()…
- [Low] After this patch, struct hinic3_rxq_stats::csum_errors
(hinic3_rx.h:36) has no consumer anywhere in the tree.
--
hinic3: Avoid concurrent updates on 32-bit systems.
This commit changes hinic3_get_stats64() to read the per-queue counters
by assignment inside the u64_stats retry loop and add them into
rtnl_link_stats64 after the loop. It also removes csum_errors from
rx_errors, removes the NULL checks on nic_dev->txqs and nic_dev->rxqs,
and removes the dead stores before the loops.
> hinic3: Avoid concurrent updates on 32-bit systems.
>
> Within the while loop of hinic3_get_stats64(), the counters between
> u64_stats_fetch_retry and u64_stats_fetch_begin are incremented by +=.
> This operation will cause repeated counting of the counters on a 32-bit
> system. Therefore, change += to + and the counters are incremented
> out side the wile loop.
[ ... ]
> Fixes: f47872bed40f ("hinic3: Add .ndo_tx_timeout and .ndo_get_stats64")
[Severity: Low]
Can the double counting described here happen in this driver?
The hinic3 Kconfig entry only allows 64-bit builds, and COMPILE_TEST
does not remove that limit:
drivers/net/ethernet/huawei/hinic3/Kconfig:
depends on X86 || ARM64 || COMPILE_TEST
depends on PCI_MSI && 64BIT
When BITS_PER_LONG == 64, the retry helper always returns false:
include/linux/u64_stats_sync.h:
static inline bool __u64_stats_fetch_retry(const struct u64_stats_sync *syncp,
unsigned int start)
{
return false;
}
So each do/while body in hinic3_get_stats64() runs exactly once, and the
old += loop already gave correct totals.
Even on a hypothetical 32-bit build, nothing would force a retry. The
only u64_stats_update_begin()/u64_stats_update_end() sections in hinic3
seem to be the init-time zeroing helpers hinic3_txq_clean_stats() and
hinic3_rxq_clean_stats().
The new reader pattern is fine as a cleanup. Would it be better to
describe the patch as a cleanup, drop the Fixes: tag and target net-next?
With the tag, a change that has no runtime effect goes to stable. It
would also bring along the NULL check removal, the dead store removal
and the change to what rx_errors reports.
> diff --git a/drivers/net/ethernet/huawei/hinic3/hinic3_netdev_ops.c b/drivers/net/ethernet/huawei/hinic3/hinic3_netdev_ops.c
> index da73811641a9d..d1fd91d97ccfc 100644
> --- a/drivers/net/ethernet/huawei/hinic3/hinic3_netdev_ops.c
> +++ b/drivers/net/ethernet/huawei/hinic3/hinic3_netdev_ops.c
> @@ -791,49 +791,35 @@ static void hinic3_get_stats64(struct net_device *netdev,
[ ... ]
> for (i = 0; i < nic_dev->max_qps; i++) {
> - if (!nic_dev->rxqs)
> - break;
> -
> rxq = &nic_dev->rxqs[i];
> rxq_stats = &rxq->rxq_stats;
> do {
> start = u64_stats_fetch_begin(&rxq_stats->syncp);
> - bytes += rxq_stats->bytes;
> - packets += rxq_stats->packets;
> - errors += rxq_stats->csum_errors +
> - rxq_stats->other_errors;
> - dropped += rxq_stats->dropped;
> + bytes = rxq_stats->bytes;
> + packets = rxq_stats->packets;
> + errors = rxq_stats->other_errors;
> + dropped = rxq_stats->dropped;
[Severity: Low]
The commit message says:
csum_errors and other_errors are not the same things. csum_errors will
go to csum_bad in netdev netlink qstats.
Does hinic3 have a qstats path for this? I couldn't find netdev_stat_ops,
get_queue_stats_rx or csum_bad anywhere under
drivers/net/ethernet/huawei/hinic3/.
That means this line removes the last reader of csum_errors in struct
hinic3_rxq_stats.
The field has no writer either. hinic3_rx_csum() detects the checksum
error but returns without counting it:
if (unlikely(csum_err)) {
/* pkt type is recognized by HW, and csum is wrong */
skb->ip_summed = CHECKSUM_NONE;
return;
}
The only other reference is the zeroing in hinic3_rxq_clean_stats().
Removing checksum errors from rx_errors does match the rx-csum-bad
definition. Could the commit message be corrected, or the qstats
reporting be added along with an increment in hinic3_rx_csum()?
As things stand, csum_errors is declared and zeroed but never counted
or reported. If a writer is added later, checksum errors still won't
show up in any user-visible interface until qstats support exists.
> + } while (u64_stats_fetch_retry(&rxq_stats->syncp, start));
> + stats->rx_packets += packets;
> + stats->rx_bytes += bytes;
> + stats->rx_errors += errors;
> + stats->rx_dropped += dropped;
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/cover.1794371175.git.gongfan1%40huawei.com
next prev parent reply other threads:[~2026-11-15 4:56 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-11 4:15 [PATCH net-next v02 0/5] net: hinic3: Bugfix for later patch-set Fan Gong
2026-11-11 4:15 ` [PATCH net-next v02 1/5] hinic3: Solve an stall issue in hinic3_rx_poll() Fan Gong
2026-11-15 4:56 ` netdev-bot+sashiko
2026-11-11 4:15 ` [PATCH net-next v02 2/5] hinic3: Avoid concurrent updates on 32-bit systems Fan Gong
2026-11-15 4:56 ` netdev-bot+sashiko [this message]
2026-11-11 4:15 ` [PATCH net-next v02 3/5] hinic3: fix some checkpatchs Fan Gong
2026-11-15 4:56 ` netdev-bot+sashiko
2026-11-11 4:15 ` [PATCH net-next v02 4/5] hinic3: Ensure the value of max_qps is greater than 1 Fan Gong
2026-11-15 4:56 ` netdev-bot+sashiko
2026-11-11 4:15 ` [PATCH net-next v02 5/5] hinic3: Ensure that the value of max_qps is not changed Fan Gong
2026-11-15 4:56 ` netdev-bot+sashiko
2026-11-11 4:22 ` [PATCH net-next v02 0/5] net: hinic3: Bugfix for later patch-set netdev-bot+sinfo
2026-11-11 21:17 ` Jakub Kicinski
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=179471861282.2199510.12155151522849226893@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=dimitri.daskalakis1@gmail.com \
--cc=edumazet@google.com \
--cc=gongfan1@huawei.com \
--cc=horms@kernel.org \
--cc=hramamurthy@google.com \
--cc=ioana.ciornei@nxp.com \
--cc=kuba@kernel.org \
--cc=larysa.zaremba@intel.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maxime.chevallier@bootlin.com \
--cc=mohsin.bashr@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=tengpeisen@huawei.com \
--cc=vadim.fedorenko@linux.dev \
--cc=wudi234@huawei.com \
--cc=wulike1@huawei.com \
--cc=zhoushuai28@huawei.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
all inboxes | Powered by JetHome®