FAILED: patch "[PATCH] thermal: core: Allow thermal zones to tell the core to ignore" failed to apply to 6.10-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 6.10-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.10.y
git checkout FETCH_HEAD
git cherry-pick -x e528be3c87be953b73e7826a2d7e4b837cbad39d
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2024072302-policy-spleen-3156@gregkh' --subject-prefix 'PATCH 6.10.y' HEAD^..
Possible dependencies:
e528be3c87be ("thermal: core: Allow thermal zones to tell the core to ignore them") 7c8267275de6 ("Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net")
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From e528be3c87be953b73e7826a2d7e4b837cbad39d Mon Sep 17 00:00:00 2001
From: "Rafael J. Wysocki" <[email protected]>
Date: Wed, 17 Jul 2024 21:45:02 +0200
Subject: [PATCH] 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 a8a261774466 ("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 a8a261774466 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 a8a261774466, 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.
drivers/net/wireless/intel/iwlwifi/mvm/tt.c +8 -2
@@ -621,8 +621,14 @@ static int iwl_mvm_tzone_get_temp(struct thermal_zone_device *device,guard (mvm)(mvm);if (!iwl_mvm_firmware_running (mvm) || - mvm->fwrt.cur_fw_img !=IWL_UCODE_REGULAR ) -return -ENODATA ; + mvm->fwrt.cur_fw_img !=IWL_UCODE_REGULAR ) { +/* +* Tell the core that there is no valid temperature value to +* return, but it need not worry about this. +*/ + *temperature =THERMAL_TEMP_INVALID ; +return 0 ; + } ret =iwl_mvm_get_temp (mvm, &temp);if (ret)
drivers/thermal/thermal_core.c +24 -27
89 lines not on this page · raw message
drivers/thermal/thermal_core.h +3 -0
@@ -133,6 +133,9 @@ struct thermal_zone_device { struct thermal_trip_desc trips[] __counted_by(num_trips); }; +/* Initial thermal zone temperature. */ +#define THERMAL_TEMP_INIT INT_MIN +/* * Default delay after a failing thermal zone temperature check before * attempting to check it again.
drivers/thermal/thermal_helpers.c +2 -0
@@ -163,6 +163,8 @@ int thermal_zone_get_temp(struct thermal_zone_device *tz, int *temp) } ret =__thermal_zone_get_temp (tz, temp); +if (!ret && *temp <=THERMAL_TEMP_INVALID ) + ret = -ENODATA ; unlock:mutex_unlock (&tz->lock);
Greg KH
maintainerQuoted 15 lines · On Tue, Jul 23, 2024 at 02:17:02PM +0200, [email protected] wrote:
The patch below does not apply to the 6.10-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.10.y
git checkoutFETCH_HEAD
git cherry-pick -xe528be3c87be953b73e7826a2d7e4b837cbad39d
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2024072302-policy-spleen-3156@gregkh' --subject-prefix 'PATCH 6.10.y' HEAD^..
Quoted 4 lines
Possible dependencies:
e528be3c87be("thermal: core: Allow thermal zones to tell the core to ignore them")7c8267275de6("Mergegit://git.kernel.org/pub/scm/linux/kernel/git/netdev/net")
Nevermind, I fixed this up by hand.
greg k-h