* [PATCH] wifi: ath10k: Stop unanswered temperature reads
@ 2026-10-26 16:36 Filippo Falezza via B4 Relay
2026-10-26 16:51 ` Loic Poulain
0 siblings, 1 reply; 2+ messages in thread
From: Filippo Falezza via B4 Relay @ 2026-10-26 16:36 UTC (permalink / raw)
To: Jeff Johnson
Cc: Kalle Valo, linux-wireless, ath10k, linux-kernel, Filippo Falezza
From: Filippo Falezza <effeffe99@gmail.com>
Reading the ath10k hwmon temperature sends WMI_PDEV_GET_TEMPERATURE and
waits up to 5 s (ATH10K_THERMAL_SYNC_TIMEOUT_HZ) for the reply event,
holding conf_mutex. Not all firmware answers: the WCN3990 firmware
WLAN.HL.3.3.1-00694-QCAHLSWMTPLZ-1 on a Motorola Moto G 5G Plus
codename nairo (SM7250) never sends the event, so every read of
temp1_input stalls for 5 s, logs
ath10k_snoc 18800000.wifi: failed to synchronize thermal read
and returns -ETIMEDOUT. Tools that read all hwmon sensors, such as
lm-sensors, hang for 5 s on every run, and configuration changes of the
interface wait for conf_mutex in the meantime.
Whether the firmware answers cannot be told from the chip: firmware that
answers and firmware that does not both advertise
WMI_SERVICE_THERM_THROT, and WCN3990 firmware differs between devices.
Instead, remember that the running firmware did not answer, and return
-EOPNOTSUPP right away on later reads. Forget it when the firmware
starts, so that a restarted or updated firmware is asked again.
The first read after each firmware start still takes 5 s when the
firmware does not answer. Reads on firmware that answers are unchanged.
This change was written with the help of an AI coding assistant; see
the notes below.
Fixes: e98199a8c27f ("ath10k: enable QCA6174/QCA9377 to read the chip temperature")
Signed-off-by: Filippo Falezza <effeffe99@gmail.com>
---
Notes, not for the changelog:
- Tool: Claude Opus 5.5 in Claude Code wrote the code and this changelog
during an interactive bring-up session for the Moto G 5G Plus. The
request was to fix `sensors` hanging on every run because of ath10k.
A first version disabled the read for all WCN3990 through a hw_params
flag; it was replaced by this one so that it does not assume all
WCN3990 firmware behaves the same, as Loic Poulain asked of another
WCN3990 firmware workaround ("ath10k: WCN3990 firmware workarounds for
WLAN.HL.3.2", March 2026).
- Tested on: Moto G 5G Plus (SM7250, WCN3990, firmware
WLAN.HL.3.3.1-00694-QCAHLSWMTPLZ-1), linux-next next-20261021 plus
device support patches, with this patch in place of a local WCN3990
quirk. First read of temp1_input: 5065 ms, -ETIMEDOUT, one warning;
next reads: 8 ms, -EOPNOTSUPP; a full `sensors` run: 25 ms (5 s or
more before). After switching Wi-Fi off and on, which restarts the
firmware session, the first read waits 5 s again, then -EOPNOTSUPP.
- Not tested: firmware that does answer the request (QCA6174, QCA9377,
other WCN3990 firmware); for them only reads after a timeout change.
Not run: sparse.
- Build: W=1 for arm64, no warnings; checkpatch --strict clean.
Applies to ath-next (cd026e68f).
---
drivers/net/wireless/ath/ath10k/core.c | 1 +
drivers/net/wireless/ath/ath10k/thermal.c | 9 ++++++++-
drivers/net/wireless/ath/ath10k/thermal.h | 2 ++
3 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index 7c2939cbde5f..9467e4c3099a 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -2985,6 +2985,7 @@ int ath10k_core_start(struct ath10k *ar, enum ath10k_firmware_mode mode,
clear_bit(ATH10K_FLAG_CRASH_FLUSH, &ar->dev_flags);
ar->running_fw = fw;
+ ar->thermal.temperature_unanswered = false;
if (!test_bit(ATH10K_FW_FEATURE_NON_BMI,
ar->running_fw->fw_file.fw_features)) {
diff --git a/drivers/net/wireless/ath/ath10k/thermal.c b/drivers/net/wireless/ath/ath10k/thermal.c
index 9bb486f8e920..1079d552cff4 100644
--- a/drivers/net/wireless/ath/ath10k/thermal.c
+++ b/drivers/net/wireless/ath/ath10k/thermal.c
@@ -75,6 +75,12 @@ static ssize_t ath10k_thermal_show_temp(struct device *dev,
goto out;
}
+ /* Don't stall every read on firmware that never answers */
+ if (ar->thermal.temperature_unanswered) {
+ ret = -EOPNOTSUPP;
+ goto out;
+ }
+
reinit_completion(&ar->thermal.wmi_sync);
ret = ath10k_wmi_pdev_get_temperature(ar);
if (ret) {
@@ -90,7 +96,8 @@ static ssize_t ath10k_thermal_show_temp(struct device *dev,
time_left = wait_for_completion_timeout(&ar->thermal.wmi_sync,
ATH10K_THERMAL_SYNC_TIMEOUT_HZ);
if (!time_left) {
- ath10k_warn(ar, "failed to synchronize thermal read\n");
+ ath10k_warn(ar, "failed to synchronize thermal read, not asking again until the firmware restarts\n");
+ ar->thermal.temperature_unanswered = true;
ret = -ETIMEDOUT;
goto out;
}
diff --git a/drivers/net/wireless/ath/ath10k/thermal.h b/drivers/net/wireless/ath/ath10k/thermal.h
index 1f4de9fbf2b3..cb930da5c04a 100644
--- a/drivers/net/wireless/ath/ath10k/thermal.h
+++ b/drivers/net/wireless/ath/ath10k/thermal.h
@@ -19,6 +19,8 @@ struct ath10k_thermal {
/* protected by conf_mutex */
u32 throttle_state;
u32 quiet_period;
+ /* the running firmware did not answer a temperature request */
+ bool temperature_unanswered;
/* temperature value in Celsius degree
* protected by data_lock
*/
---
base-commit: cd026e68fdbf88b9cc522b76c7a9d92c9a41f709
change-id: 20261022-ath10k-temperature-22b119fd615c
Best regards,
--
Filippo Falezza <effeffe99@gmail.com>
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] wifi: ath10k: Stop unanswered temperature reads
2026-10-26 16:36 [PATCH] wifi: ath10k: Stop unanswered temperature reads Filippo Falezza via B4 Relay
@ 2026-10-26 16:51 ` Loic Poulain
0 siblings, 0 replies; 2+ messages in thread
From: Loic Poulain @ 2026-10-26 16:51 UTC (permalink / raw)
To: effeffe99; +Cc: Jeff Johnson, Kalle Valo, linux-wireless, ath10k, linux-kernel
On Mon, Oct 26, 2026 at 5:36 PM Filippo Falezza via B4 Relay
<devnull+effeffe99.gmail.com@kernel.org> wrote:
>
> From: Filippo Falezza <effeffe99@gmail.com>
>
> Reading the ath10k hwmon temperature sends WMI_PDEV_GET_TEMPERATURE and
> waits up to 5 s (ATH10K_THERMAL_SYNC_TIMEOUT_HZ) for the reply event,
> holding conf_mutex. Not all firmware answers: the WCN3990 firmware
> WLAN.HL.3.3.1-00694-QCAHLSWMTPLZ-1 on a Motorola Moto G 5G Plus
> codename nairo (SM7250) never sends the event, so every read of
> temp1_input stalls for 5 s, logs
>
> ath10k_snoc 18800000.wifi: failed to synchronize thermal read
>
> and returns -ETIMEDOUT. Tools that read all hwmon sensors, such as
> lm-sensors, hang for 5 s on every run, and configuration changes of the
> interface wait for conf_mutex in the meantime.
>
> Whether the firmware answers cannot be told from the chip: firmware that
> answers and firmware that does not both advertise
> WMI_SERVICE_THERM_THROT, and WCN3990 firmware differs between devices.
> Instead, remember that the running firmware did not answer, and return
> -EOPNOTSUPP right away on later reads. Forget it when the firmware
> starts, so that a restarted or updated firmware is asked again.
>
> The first read after each firmware start still takes 5 s when the
> firmware does not answer. Reads on firmware that answers are unchanged.
>
> This change was written with the help of an AI coding assistant; see
> the notes below.
>
> Fixes: e98199a8c27f ("ath10k: enable QCA6174/QCA9377 to read the chip temperature")
> Signed-off-by: Filippo Falezza <effeffe99@gmail.com>
> ---
> Notes, not for the changelog:
>
> - Tool: Claude Opus 5.5 in Claude Code wrote the code and this changelog
> during an interactive bring-up session for the Moto G 5G Plus. The
> request was to fix `sensors` hanging on every run because of ath10k.
> A first version disabled the read for all WCN3990 through a hw_params
> flag; it was replaced by this one so that it does not assume all
> WCN3990 firmware behaves the same, as Loic Poulain asked of another
> WCN3990 firmware workaround ("ath10k: WCN3990 firmware workarounds for
> WLAN.HL.3.2", March 2026).
> - Tested on: Moto G 5G Plus (SM7250, WCN3990, firmware
> WLAN.HL.3.3.1-00694-QCAHLSWMTPLZ-1), linux-next next-20261021 plus
> device support patches, with this patch in place of a local WCN3990
> quirk. First read of temp1_input: 5065 ms, -ETIMEDOUT, one warning;
> next reads: 8 ms, -EOPNOTSUPP; a full `sensors` run: 25 ms (5 s or
> more before). After switching Wi-Fi off and on, which restarts the
> firmware session, the first read waits 5 s again, then -EOPNOTSUPP.
> - Not tested: firmware that does answer the request (QCA6174, QCA9377,
> other WCN3990 firmware); for them only reads after a timeout change.
> Not run: sparse.
> - Build: W=1 for arm64, no warnings; checkpatch --strict clean.
> Applies to ath-next (cd026e68f).
> ---
> drivers/net/wireless/ath/ath10k/core.c | 1 +
> drivers/net/wireless/ath/ath10k/thermal.c | 9 ++++++++-
> drivers/net/wireless/ath/ath10k/thermal.h | 2 ++
> 3 files changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
> index 7c2939cbde5f..9467e4c3099a 100644
> --- a/drivers/net/wireless/ath/ath10k/core.c
> +++ b/drivers/net/wireless/ath/ath10k/core.c
> @@ -2985,6 +2985,7 @@ int ath10k_core_start(struct ath10k *ar, enum ath10k_firmware_mode mode,
> clear_bit(ATH10K_FLAG_CRASH_FLUSH, &ar->dev_flags);
>
> ar->running_fw = fw;
> + ar->thermal.temperature_unanswered = false;
>
> if (!test_bit(ATH10K_FW_FEATURE_NON_BMI,
> ar->running_fw->fw_file.fw_features)) {
> diff --git a/drivers/net/wireless/ath/ath10k/thermal.c b/drivers/net/wireless/ath/ath10k/thermal.c
> index 9bb486f8e920..1079d552cff4 100644
> --- a/drivers/net/wireless/ath/ath10k/thermal.c
> +++ b/drivers/net/wireless/ath/ath10k/thermal.c
> @@ -75,6 +75,12 @@ static ssize_t ath10k_thermal_show_temp(struct device *dev,
> goto out;
> }
>
> + /* Don't stall every read on firmware that never answers */
> + if (ar->thermal.temperature_unanswered) {
> + ret = -EOPNOTSUPP;
> + goto out;
> + }
> +
> reinit_completion(&ar->thermal.wmi_sync);
> ret = ath10k_wmi_pdev_get_temperature(ar);
> if (ret) {
> @@ -90,7 +96,8 @@ static ssize_t ath10k_thermal_show_temp(struct device *dev,
> time_left = wait_for_completion_timeout(&ar->thermal.wmi_sync,
> ATH10K_THERMAL_SYNC_TIMEOUT_HZ);
> if (!time_left) {
> - ath10k_warn(ar, "failed to synchronize thermal read\n");
> + ath10k_warn(ar, "failed to synchronize thermal read, not asking again until the firmware restarts\n");
> + ar->thermal.temperature_unanswered = true;
> ret = -ETIMEDOUT;
> goto out;
> }
> diff --git a/drivers/net/wireless/ath/ath10k/thermal.h b/drivers/net/wireless/ath/ath10k/thermal.h
> index 1f4de9fbf2b3..cb930da5c04a 100644
> --- a/drivers/net/wireless/ath/ath10k/thermal.h
> +++ b/drivers/net/wireless/ath/ath10k/thermal.h
> @@ -19,6 +19,8 @@ struct ath10k_thermal {
> /* protected by conf_mutex */
> u32 throttle_state;
> u32 quiet_period;
> + /* the running firmware did not answer a temperature request */
> + bool temperature_unanswered;
Maybe just "bool broken;" or alternatively a new
ATH10K_FLAG_TEMP_BROKEN dev_flag.
> /* temperature value in Celsius degree
> * protected by data_lock
> */
>
> ---
> base-commit: cd026e68fdbf88b9cc522b76c7a9d92c9a41f709
> change-id: 20261022-ath10k-temperature-22b119fd615c
>
> Best regards,
> --
> Filippo Falezza <effeffe99@gmail.com>
>
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-26 16:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-26 16:36 [PATCH] wifi: ath10k: Stop unanswered temperature reads Filippo Falezza via B4 Relay
2026-10-26 16:51 ` Loic Poulain
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®