mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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 v03 2/4] hinic3: Avoid concurrent updates on 32-bit systems.
Date: Mon, 16 Nov 2026 13:51:02 +0000	[thread overview]
Message-ID: <179483706251.3136.3766644106019912452@kernel.org> (raw)
In-Reply-To: <6e3be192de613fb537fc2050ce28e1bd71346e35.1794467919.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 commit message and Fixes: tag describe a bug this driver can
  never hit.
- [Low] The patch drops `csum_errors` from `rx_errors` in
  hinic3_get_stats64() (`errors = rxq_stats->other_errors;`).

--

hinic3: Avoid concurrent updates on 32-bit systems.

This commit reworks the u64_stats reader loops in hinic3_get_stats64().
Per-queue values are now assigned inside the fetch/retry loop and added
into rtnl_link_stats64 outside it. The patch also drops csum_errors from
rx_errors, removes the NULL checks on nic_dev->txqs and nic_dev->rxqs, and
removes the zeroing of the local counters before each loop.

> 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.

[Severity: Low]
Can this driver be built on a 32-bit kernel? The Kconfig in
drivers/net/ethernet/huawei/hinic3/ has:

	depends on PCI_MSI && 64BIT

When BITS_PER_LONG == 64, include/linux/u64_stats_sync.h defines:

static inline bool __u64_stats_fetch_retry(const struct u64_stats_sync *syncp,
					   unsigned int start)
{
	return false;
}

So the old loop body ran exactly once per queue. The += into locals that
started at zero already gave correct totals in every configuration that
can be built.

The subject says "Avoid concurrent updates". However, the patch only
changes the reader side and does not change how updates are serialized.

This patch carries "Fixes: f47872bed40f" and will be picked up for
stable. Would it be better described as a cleanup of the reader idiom,
without the Fixes: tag?

> 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,

[ ... ]

>  		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;

[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.

Where is csum_errors reported as csum_bad? I could not find a netdev
queue stats implementation (stat_ops, get_queue_stats_rx or csum_bad)
anywhere under drivers/net/ethernet/huawei/hinic3/. It is not in this
patch, and it is not added later in the series.

After this change, the only remaining reference to csum_errors is the
reset in hinic3_rxq_clean_stats():

	rxq_stats->csum_errors = 0;
	rxq_stats->other_errors = 0;

Neither counter is incremented anywhere today, so rx_errors does not
change in practice. Once the datapath starts incrementing csum_errors,
would those counts then be missing from every uAPI?

This rx_errors change is unrelated to the retry loop change. Could it be
split into its own patch, or sent together with the qstats support it
refers to?

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/cover.1794467919.git.gongfan1%40huawei.com

  reply	other threads:[~2026-11-16 13:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-12  7:06 [PATCH net-next v03 0/4] net: hinic3: Bugfix for later patch-set Fan Gong
2026-11-12  7:06 ` [PATCH net-next v03 1/4] hinic3: Solve an stall issue in hinic3_rx_poll() Fan Gong
2026-11-16 13:51   ` netdev-bot+sashiko
2026-11-12  7:06 ` [PATCH net-next v03 2/4] hinic3: Avoid concurrent updates on 32-bit systems Fan Gong
2026-11-16 13:51   ` netdev-bot+sashiko [this message]
2026-11-12  7:06 ` [PATCH net-next v03 3/4] hinic3: fix some checkpatchs Fan Gong
2026-11-12  7:06 ` [PATCH net-next v03 4/4] hinic3: Ensure that the value of max_qps is not changed Fan Gong
2026-11-16 13:51   ` netdev-bot+sashiko

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=179483706251.3136.3766644106019912452@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®