This is a note to let you know that I've just added the patch titled thermal: cpufreq_cooling: freq_qos_update_request() returns < 0 on error to the 5.11-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: thermal-cpufreq_cooling-freq_qos_update_request-returns-0-on-error.patch and it can be found in the queue-5.11 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From a51afb13311cd85b2f638c691b2734622277d8f5 Mon Sep 17 00:00:00 2001 From: Viresh Kumar <viresh.kumar@xxxxxxxxxx> Date: Wed, 17 Feb 2021 11:18:58 +0530 Subject: thermal: cpufreq_cooling: freq_qos_update_request() returns < 0 on error From: Viresh Kumar <viresh.kumar@xxxxxxxxxx> commit a51afb13311cd85b2f638c691b2734622277d8f5 upstream. freq_qos_update_request() returns 1 if the effective constraint value has changed, 0 if the effective constraint value has not changed, or a negative error code on failures. The frequency constraints for CPUs can be set by different parts of the kernel. If the maximum frequency constraint set by other parts of the kernel are set at a lower value than the one corresponding to cooling state 0, then we will never be able to cool down the system as freq_qos_update_request() will keep on returning 0 and we will skip updating cpufreq_state and thermal pressure. Fix that by doing the updates even in the case where freq_qos_update_request() returns 0, as we have effectively set the constraint to a new value even if the consolidated value of the actual constraint is unchanged because of external factors. Cc: v5.7+ <stable@xxxxxxxxxxxxxxx> # v5.7+ Reported-by: Thara Gopinath <thara.gopinath@xxxxxxxxxx> Fixes: f12e4f66ab6a ("thermal/cpu-cooling: Update thermal pressure in case of a maximum frequency capping") Signed-off-by: Viresh Kumar <viresh.kumar@xxxxxxxxxx> Reviewed-by: Lukasz Luba <lukasz.luba@xxxxxxx> Tested-by: Lukasz Luba <lukasz.luba@xxxxxxx> Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx> Tested-by: Thara Gopinath<thara.gopinath@xxxxxxxxxx> Signed-off-by: Daniel Lezcano <daniel.lezcano@xxxxxxxxxx> Link: https://lore.kernel.org/r/b2b7e84944937390256669df5a48ce5abba0c1ef.1613540713.git.viresh.kumar@xxxxxxxxxx Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/thermal/cpufreq_cooling.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/thermal/cpufreq_cooling.c +++ b/drivers/thermal/cpufreq_cooling.c @@ -441,7 +441,7 @@ static int cpufreq_set_cur_state(struct frequency = get_state_freq(cpufreq_cdev, state); ret = freq_qos_update_request(&cpufreq_cdev->qos_req, frequency); - if (ret > 0) { + if (ret >= 0) { cpufreq_cdev->cpufreq_state = state; cpus = cpufreq_cdev->policy->cpus; max_capacity = arch_scale_cpu_capacity(cpumask_first(cpus)); Patches currently in stable-queue which might be from viresh.kumar@xxxxxxxxxx are queue-5.11/opp-correct-debug-message-in-_opp_add_static_v2.patch queue-5.11/cpufreq-brcmstb-avs-cpufreq-free-resources-in-error-.patch queue-5.11/thermal-cpufreq_cooling-freq_qos_update_request-returns-0-on-error.patch queue-5.11/cpufreq-brcmstb-avs-cpufreq-fix-resource-leaks-in-re.patch queue-5.11/mailbox-arm_mhuv2-skip-calling-kfree-with-invalid-pointer.patch