Skip to content

Commit a51afb1

Browse files
vireshkdlezcano
authored andcommitted
thermal: cpufreq_cooling: freq_qos_update_request() returns < 0 on error
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+ <[email protected]> # v5.7+ Reported-by: Thara Gopinath <[email protected]> Fixes: f12e4f6 ("thermal/cpu-cooling: Update thermal pressure in case of a maximum frequency capping") Signed-off-by: Viresh Kumar <[email protected]> Reviewed-by: Lukasz Luba <[email protected]> Tested-by: Lukasz Luba <[email protected]> Reviewed-by: Rafael J. Wysocki <[email protected]> Tested-by: Thara Gopinath<[email protected]> Signed-off-by: Daniel Lezcano <[email protected]> Link: https://lore.kernel.org/r/b2b7e84944937390256669df5a48ce5abba0c1ef.1613540713.git.viresh.kumar@linaro.org
1 parent 74369d0 commit a51afb1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/thermal/cpufreq_cooling.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ static int cpufreq_set_cur_state(struct thermal_cooling_device *cdev,
441441
frequency = get_state_freq(cpufreq_cdev, state);
442442

443443
ret = freq_qos_update_request(&cpufreq_cdev->qos_req, frequency);
444-
if (ret > 0) {
444+
if (ret >= 0) {
445445
cpufreq_cdev->cpufreq_state = state;
446446
cpus = cpufreq_cdev->policy->cpus;
447447
max_capacity = arch_scale_cpu_capacity(cpumask_first(cpus));

0 commit comments

Comments
 (0)