From: Kalle Valo <kvalo@kernel.org>
To: Baochen Qiang <quic_bqiang@quicinc.com>
Cc: <ath11k@lists.infradead.org>, <linux-wireless@vger.kernel.org>
Subject: Re: [PATCH 1/6] wifi: ath11k: avoid burning CPU in ath11k_debugfs_fw_stats_request()
Date: Wed, 13 Nov 2024 13:12:41 +0200 [thread overview]
Message-ID: <877c972xqu.fsf@kernel.org> (raw)
In-Reply-To: <20241113015631.3105-2-quic_bqiang@quicinc.com> (Baochen Qiang's message of "Wed, 13 Nov 2024 09:56:26 +0800")
Baochen Qiang <quic_bqiang@quicinc.com> writes:
> We get report [1] that CPU is running a hot loop in
> ath11k_debugfs_fw_stats_request():
>
> 94.60% 0.00% i3status [kernel.kallsyms] [k] do_syscall_64
> |
> --94.60%--do_syscall_64
> |
> --94.55%--__sys_sendmsg
> ___sys_sendmsg
> ____sys_sendmsg
> netlink_sendmsg
> netlink_unicast
> genl_rcv
> netlink_rcv_skb
> genl_rcv_msg
> |
> --94.55%--genl_family_rcv_msg_dumpit
> __netlink_dump_start
> netlink_dump
> genl_dumpit
> nl80211_dump_station
> |
> --94.55%--ieee80211_dump_station
> sta_set_sinfo
> |
> --94.55%--ath11k_mac_op_sta_statistics
> ath11k_debugfs_get_fw_stats
> |
> --94.55%--ath11k_debugfs_fw_stats_request
> |
> |--41.73%--_raw_spin_lock_bh
> |
> |--22.74%--__local_bh_enable_ip
> |
> |--9.22%--_raw_spin_unlock_bh
> |
> --6.66%--srso_alias_safe_ret
>
> This is because, if for whatever reason ar->fw_stats_done is not set by
> ath11k_update_stats_event(), ath11k_debugfs_fw_stats_request() won't yield
> CPU before an up to 3s timeout.
>
> Add 100ms sleep to avoid CPU burning.
>
> Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.37
>
> Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices")
> Reported-by: Yury Vostrikov <mon@unformed.ru>
> Closes: https://lore.kernel.org/all/7324ac7a-8b7a-42a5-aa19-de52138ff638@app.fastmail.com/ # [1]
> Signed-off-by: Baochen Qiang <quic_bqiang@quicinc.com>
> ---
> drivers/net/wireless/ath/ath11k/debugfs.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/net/wireless/ath/ath11k/debugfs.c b/drivers/net/wireless/ath/ath11k/debugfs.c
> index 57281a135dd7..a5e0f2092da5 100644
> --- a/drivers/net/wireless/ath/ath11k/debugfs.c
> +++ b/drivers/net/wireless/ath/ath11k/debugfs.c
> @@ -207,6 +207,9 @@ static int ath11k_debugfs_fw_stats_request(struct ath11k *ar,
> break;
> }
> spin_unlock_bh(&ar->data_lock);
> +
> + /* 100ms is empirical, change if required */
> + msleep(100);
> }
> return 0;
> }
Please don't reinvent the wheel. Why not just use completion instead of
this ugly spinning hack?
--
https://patchwork.kernel.org/project/linux-wireless/list/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
next prev parent reply other threads:[~2024-11-13 11:15 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-13 1:56 [PATCH 0/6] wifi: ath11k: fixes and refactor to firmware stats related functions Baochen Qiang
2024-11-13 1:56 ` [PATCH 1/6] wifi: ath11k: avoid burning CPU in ath11k_debugfs_fw_stats_request() Baochen Qiang
2024-11-13 11:12 ` Kalle Valo [this message]
2024-11-14 5:34 ` Baochen Qiang
2024-11-13 1:56 ` [PATCH 2/6] wifi: ath11k: don't use static variables in ath11k_debugfs_fw_stats_process() Baochen Qiang
2024-11-13 11:15 ` Kalle Valo
2024-11-13 1:56 ` [PATCH 3/6] wifi: ath11k: move some firmware stats related functions outside of debugfs Baochen Qiang
2024-11-13 11:14 ` Kalle Valo
2024-11-14 6:05 ` Baochen Qiang
2024-11-14 11:34 ` Kalle Valo
2024-11-15 1:46 ` Baochen Qiang
2024-11-13 1:56 ` [PATCH 4/6] wifi: ath11k: adjust unlock sequence in ath11k_update_stats_event() Baochen Qiang
2024-11-13 11:15 ` Kalle Valo
2024-11-13 1:56 ` [PATCH 5/6] wifi: ath11k: move locking outside of ath11k_mac_get_fw_stats() Baochen Qiang
2024-11-13 1:56 ` [PATCH 6/6] wifi: ath11k: consistently use ath11k_mac_get_fw_stats() Baochen Qiang
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=877c972xqu.fsf@kernel.org \
--to=kvalo@kernel.org \
--cc=ath11k@lists.infradead.org \
--cc=linux-wireless@vger.kernel.org \
--cc=quic_bqiang@quicinc.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.