From: Jacob Keller <jacob.e.keller@intel.com>
To: Lorenzo Bianconi <lorenzo@kernel.org>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>,
Alexander Lobakin <aleksander.lobakin@intel.com>,
<linux-arm-kernel@lists.infradead.org>,
<linux-mediatek@lists.infradead.org>, <netdev@vger.kernel.org>
Subject: Re: [PATCH net-next v9 2/3] net: airoha: fix ETS QoS stats counter underflow and cross-channel corruption
Date: Tue, 21 Jul 2026 14:34:10 -0700 [thread overview]
Message-ID: <992d2570-1d99-4916-a570-7147d6e2d59b@intel.com> (raw)
In-Reply-To: <al87am5-OScErxLn@lore-desk>
On 7/21/2026 2:27 AM, Lorenzo Bianconi wrote:
>> On 7/20/2026 3:03 PM, Lorenzo Bianconi wrote:
>>> airoha_qdma_get_tx_ets_stats() has two bugs:
>>> - The hardware counters read via airoha_qdma_rr() are 32-bit values
>>> but are stored in u64 locals and subtracted from u64 baselines. When
>>> a 32-bit hardware counter wraps around, the subtraction produces a
>>> large underflow value passed to _bstats_update().
>>
>> This issue would only be a problem during rollover, which depending on
>> how fast the counts increment may not be a big problem. I could see this
>> not being worth going to net since it could be rare enough that it isn't
>> considered a widespread issue...
>>
>>> - The baseline counters (cpu_tx_packets, fwd_tx_packets) are stored as
>>> single per-device fields, but airoha_qdma_get_tx_ets_stats() is
>>> called with different channel values (0-3). Each call reads a
>>> different channel's hardware counter but overwrites the same
>>> baseline, corrupting the delta computation for other channels.
>>>
>>
>> However, this issue seems like its going to cause a problem every time
>> you read because any time you use a mix of channels you will get
>> corrupted values?
>
> Hi Jacob,
>
> I agree this is a real bug (and it needs to be fixed). However, the real
> use-case is having a single channel per net_device (a single HTB offloaded
> qdisc) and multiple hw queues (connected to the ETS offloaded classes).
> In this scenario we do not trigger this issue.
>
>> This targets a commit which merged in v6.14, but the patch is part of a
>> series aimed at net-next. Could you explain why this shouldn't be
>> separated out and put as a fix in net? It seems pretty obvious that
>> users can easily reproduce problems by requesting stats from each
>> channel? Or is this not really possible to trigger from userspace until
>> patch 3/3?
>
> For the reason described above and to avoid any possible conflicts with patch
> 3/3 I decided to add this patch here (adding the proper Fixes tag for the
> backport) but if you prefer I can remove patch 2/3 from this series and send
> it to net. What do you prefer?
>
If users can't trigger the issue easily in the normal use cases, and the
result is only bad stat values (and not actually corrupt memory etc), I
have no objections to waiting. The scope of the fix is fairly minor and
avoiding the conflicts seems like a reasonable goal.
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
> Regards,
> Lorenzo
>
next prev parent reply other threads:[~2026-07-21 21:35 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-20 22:03 [PATCH net-next v9 0/3] airoha: add the capability to configure GDM3/GDM4 as WAN/LAN on demand Lorenzo Bianconi
2026-07-20 22:03 ` [PATCH net-next v9 1/3] net: airoha: rename airoha_priv_flags to airoha_dev_flags Lorenzo Bianconi
2026-07-20 22:36 ` Jacob Keller
2026-07-20 22:03 ` [PATCH net-next v9 2/3] net: airoha: fix ETS QoS stats counter underflow and cross-channel corruption Lorenzo Bianconi
2026-07-20 22:42 ` Jacob Keller
2026-07-21 9:27 ` Lorenzo Bianconi
2026-07-21 21:34 ` Jacob Keller [this message]
2026-07-20 22:03 ` [PATCH net-next v9 3/3] net: airoha: defer GDM3/GDM4 WAN mode and GDM2 loopback to QoS offload Lorenzo Bianconi
2026-07-20 22:48 ` Jacob Keller
2026-07-21 9:28 ` Lorenzo Bianconi
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=992d2570-1d99-4916-a570-7147d6e2d59b@intel.com \
--to=jacob.e.keller@intel.com \
--cc=aleksander.lobakin@intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=lorenzo@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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