From: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
To: Baochen Qiang <baochen.qiang@oss.qualcomm.com>,
christophergriffin05@gmail.com,
Jeff Johnson <jjohnson@kernel.org>
Cc: linux-wireless@vger.kernel.org, ath11k@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] wifi: ath11k: read a station's TX rate under base_lock
Date: Mon, 16 Nov 2026 07:00:06 -0800 [thread overview]
Message-ID: <f7ecb009-4c95-4ef2-b569-3b2069298c41@oss.qualcomm.com> (raw)
In-Reply-To: <a346e622-8fe9-4912-9ded-b531b1bdc82e@oss.qualcomm.com>
On 11/15/2026 7:03 PM, Baochen Qiang wrote:
>
>
> On 11/14/2026 10:34 PM, Christopher Griffin via B4 Relay wrote:
>> From: Christopher Griffin <christophergriffin05@gmail.com>
>>
>> ath11k_update_per_peer_tx_stats() and ath11k_dp_tx_update_txcompl()
>> rewrite arsta->txrate under ab->base_lock: they clear it, then fill in
>> its fields one by one. ath11k_mac_op_sta_statistics() copies it into the
>> station info without that lock, so a station dump that runs while a TX
>> status updates the rate can copy the HE flag with an nss of 0, and
>> cfg80211 warns:
>>
>> WARNING: CPU: 3 PID: 30429 at net/wireless/util.c:1581 ieee80211_get_vht_max_nss+0x474/0x868 [cfg80211]
>> Call trace:
>> ieee80211_get_vht_max_nss+0x474/0x868 [cfg80211] (P)
>> cfg80211_calculate_bitrate+0x1e0/0x4f4 [cfg80211]
>> nl80211_put_sta_rate+0x50/0x1230 [cfg80211]
>> nl80211_put_sta_rate+0xa30/0x1230 [cfg80211]
>> nl80211_dump_station+0x4b8/0x7e0 [cfg80211]
>>
>> (the line is the nss check in the inlined
>> cfg80211_calculate_bitrate_he()). It was seen once in about a day on an
>> IPQ8074 AP whose stations are dumped periodically by a monitoring agent.
>>
>> Copy the rate under base_lock and report from the copy, as ath12k reads
>> its peer rate info under its DP lock.
>>
>> The change and this message were written with Claude, an AI coding
>> assistant.
>>
>> Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.9.0.1-02146-QCAHKSWPL_SILICONZ-1
>> Tested-on: QCN9074 hw1.0 PCI WLAN.HK.2.5.r4-00683-QCAHKSWPL_SILICONZ-1
>> Tested-on: IPQ6018 hw1.0 AHB WLAN.HK.2.5.0.1-03982-QCAHKSWPL_SILICONZ-3
>>
>> Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices")
>> Signed-off-by: Christopher Griffin <christophergriffin05@gmail.com>
>> ---
>> Found on an Arista C-360 (IPQ8074 + QCN9074) running OpenWrt, from a
>> warning in its kernel log; the cause was found by reading the code.
>> ath12k already reads its peer rate info under its DP lock.
>> ---
>> drivers/net/wireless/ath/ath11k/mac.c | 26 ++++++++++++++++----------
>> 1 file changed, 16 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
>> index 1a237adaa37d1..d76eeb1ca0019 100644
>> --- a/drivers/net/wireless/ath/ath11k/mac.c
>> +++ b/drivers/net/wireless/ath/ath11k/mac.c
>> @@ -9425,6 +9425,7 @@ static void ath11k_mac_op_sta_statistics(struct ieee80211_hw *hw,
>> {
>> struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta);
>> struct ath11k *ar = arsta->arvif->ar;
>> + struct rate_info txrate;
>> s8 signal;
>> bool db2dbm = test_bit(WMI_TLV_SERVICE_HW_DB2DBM_CONVERSION_SUPPORT,
>> ar->ab->wmi_ab.svc_map);
>> @@ -9435,18 +9436,23 @@ static void ath11k_mac_op_sta_statistics(struct ieee80211_hw *hw,
>> sinfo->tx_duration = arsta->tx_duration;
>
> arsta->rx_duration and arsta->tx_duration are u64 and are also only updated under
> ab->base_lock, so on 32-bit they can tear the same way. Since the lock is taken here
> anyway, moving those two reads into the same critical section would cost nothing, and is what
> ath12k_mac_op_link_sta_statistics() does under dp_lock.
>
> Not a blocker, fine to leave it for a separate patch.
I'll incorporate this suggestion into the patch in my pending branch
next prev parent reply other threads:[~2026-11-16 15:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-14 14:34 Christopher Griffin via B4 Relay
2026-11-16 3:03 ` Baochen Qiang
2026-11-16 15:00 ` Jeff Johnson [this message]
2026-11-16 9:10 ` Rameshkumar Sundaram
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=f7ecb009-4c95-4ef2-b569-3b2069298c41@oss.qualcomm.com \
--to=jeff.johnson@oss.qualcomm.com \
--cc=ath11k@lists.infradead.org \
--cc=baochen.qiang@oss.qualcomm.com \
--cc=christophergriffin05@gmail.com \
--cc=jjohnson@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
/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®