linux/drivers/net/wireless/intel/iwlwifi
Rafael J. Wysocki e528be3c87 thermal: core: Allow thermal zones to tell the core to ignore them
The iwlwifi wireless driver registers a thermal zone that is only needed
when the network interface handled by it is up and it wants that thermal
zone to be effectively ignored by the core otherwise.

Before commit a8a2617744 ("thermal: core: Call monitor_thermal_zone()
if zone temperature is invalid") that could be achieved by returning
an error code from the thermal zone's .get_temp() callback because the
core did not really handle errors returned by it almost at all.
However, commit a8a2617744 made the core attempt to recover from the
situation in which the temperature of a thermal zone cannot be
determined due to errors returned by its .get_temp() and is always
invalid from the core's perspective.

That was done because there are thermal zones in which .get_temp()
returns errors to start with due to some difficulties related to the
initialization ordering, but then it will start to produce valid
temperature values at one point.

Unfortunately, the simple approach taken by commit a8a2617744,
which is to poll the thermal zone periodically until its .get_temp()
callback starts to return valid temperature values, is at odds with
the special thermal zone in iwlwifi in which .get_temp() may always
return an error because its network interface may always be down.  If
that happens, every attempt to invoke the thermal zone's .get_temp()
callback resulting in an error causes the thermal core to print a
dev_warn() message to the kernel log which is super-noisy.

To address this problem, make the core handle the case in which
.get_temp() returns 0, but the temperature value returned by it
is not actually valid, in a special way.  Namely, make the core
completely ignore the invalid temperature value coming from
.get_temp() in that case, which requires folding in
update_temperature() into its caller and a few related changes.

On the iwlwifi side, modify iwl_mvm_tzone_get_temp() to return 0
and put THERMAL_TEMP_INVALID into the temperature return memory
location instead of returning an error when the firmware is not
running or it is not of the right type.

Also, to clearly separate the handling of invalid temperature
values from the thermal zone initialization, introduce a special
THERMAL_TEMP_INIT value specifically for the latter purpose.

Fixes: a8a2617744 ("thermal: core: Call monitor_thermal_zone() if zone temperature is invalid")
Closes: https://lore.kernel.org/linux-pm/20240715044527.GA1544@sol.localdomain/
Reported-by: Eric Biggers <ebiggers@kernel.org>
Reported-by: Stefan Lippers-Hollmann <s.l-h@gmx.de>
Link: https://bugzilla.kernel.org/show_bug.cgi?id=201761
Tested-by: Oleksandr Natalenko <oleksandr@natalenko.name>
Tested-by: Stefan Lippers-Hollmann <s.l-h@gmx.de>
Cc: 6.10+ <stable@vger.kernel.org> # 6.10+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Link: https://patch.msgid.link/4950004.31r3eYUQgx@rjwysocki.net
[ rjw: Rebased on top of the current mainline ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2024-07-18 13:35:55 +02:00
..
cfg wifi: iwlwifi: bump FW API to 92 for BZ/SC devices 2024-06-26 10:28:49 +02:00
dvm wifi: iwlwifi: dvm: fix kernel-doc warnings 2024-06-26 10:35:14 +02:00
fw wifi: iwlwifi: Add support for LARI_CONFIG_CHANGE_CMD v12 2024-07-04 13:50:06 +02:00
mei wifi: iwlwifi: mei: clarify iwl_mei_pldr_req() docs 2024-06-26 10:28:50 +02:00
mvm thermal: core: Allow thermal zones to tell the core to ignore them 2024-07-18 13:35:55 +02:00
pcie wifi: iwlwifi: correctly reference TSO page information 2024-07-10 12:35:32 +02:00
tests Kbuild updates for v6.10 2024-05-18 12:39:20 -07:00
Kconfig
Makefile wifi: iwlwifi: pcie: integrate TX queue code 2024-06-12 13:04:27 +02:00
iwl-agn-hw.h
iwl-config.h wifi: iwlwifi: fix prototype mismatch kernel-doc warnings 2024-06-26 10:35:15 +02:00
iwl-context-info-gen3.h wifi: iwlwifi: Force SCU_ACTIVE for specific platforms 2024-05-06 16:33:26 +02:00
iwl-context-info.h
iwl-csr.h wifi: iwlwifi: fix remaining mistagged kernel-doc comments 2024-06-26 10:35:15 +02:00
iwl-dbg-tlv.c wifi: iwlwifi: Remove debug message 2024-07-04 13:50:06 +02:00
iwl-dbg-tlv.h
iwl-debug.c
iwl-debug.h
iwl-devtrace-data.h wifi: iwlwifi: simplify TX tracing 2024-05-23 10:53:03 +02:00
iwl-devtrace-io.h
iwl-devtrace-iwlwifi.h wifi: iwlwifi: simplify TX tracing 2024-05-23 10:53:03 +02:00
iwl-devtrace-msg.h tracing/treewide: Remove second parameter of __assign_str() 2024-05-22 20:14:47 -04:00
iwl-devtrace-ucode.h
iwl-devtrace.c
iwl-devtrace.h tracing/treewide: Remove second parameter of __assign_str() 2024-05-22 20:14:47 -04:00
iwl-drv.c wifi: iwlwifi: remove struct iwl_trans_ops 2024-06-12 13:04:27 +02:00
iwl-drv.h
iwl-fh.h wifi: iwlwifi: fix kernel-doc in iwl-fh.h 2024-06-26 10:35:15 +02:00
iwl-io.c wifi: iwlwifi: pcie: fix a few legacy register accesses for new devices 2024-06-26 10:28:21 +02:00
iwl-io.h
iwl-modparams.h wifi: iwlwifi: move amsdu_size parsing to iwlwifi 2024-05-29 10:34:07 +02:00
iwl-nvm-parse.c wifi: iwlwifi: mvm: don't limit VLP/AFC to UATS-enabled 2024-06-26 10:28:51 +02:00
iwl-nvm-parse.h wifi: iwlwifi: fix prototype mismatch kernel-doc warnings 2024-06-26 10:35:15 +02:00
iwl-nvm-utils.c wifi: iwlwifi: move code from iwl-eeprom-parse to dvm 2024-05-23 10:53:04 +02:00
iwl-nvm-utils.h wifi: iwlwifi: move code from iwl-eeprom-parse to dvm 2024-05-23 10:53:04 +02:00
iwl-op-mode.h wifi: iwlwifi: don't assume op_mode_nic_config exists 2024-06-26 10:28:49 +02:00
iwl-phy-db.c
iwl-phy-db.h
iwl-prph.h wifi: iwlwifi: fix remaining mistagged kernel-doc comments 2024-06-26 10:35:15 +02:00
iwl-scd.h
iwl-trans.c wifi: iwlwifi: trans: make bad state warnings 2024-06-26 10:35:14 +02:00
iwl-trans.h wifi: iwlwifi: release TXQ lock during reclaim 2024-07-04 13:50:05 +02:00