cpufreq: qcom-hw: clear thermal pressure when thermal condition exits

clear thermal pressure when thermal polling is stopped as throttle
frequency is greater than what scheduler or cpu are set to.

This change prevents throttle loop exiting with stale, non-zero
thermal pressure resulted from race condition of requested frequency
change after throttle_freq condition check in throttle loop.

Change-Id: If9c40e20350c5d33b3ad7a58cfe213eeb5dda74b
Signed-off-by: Vivek Aknurwar <quic_viveka@quicinc.com>
This commit is contained in:
Vivek Aknurwar 2022-07-11 17:26:56 -07:00
parent 633ded3358
commit 5c773b992d

View File

@ -377,18 +377,13 @@ static void qcom_lmh_dcvs_notify(struct qcom_cpufreq_data *data)
if (IS_ERR(opp) && PTR_ERR(opp) == -ERANGE)
opp = dev_pm_opp_find_freq_ceil(dev, &freq_hz);
if (IS_ERR(opp)) {
if (IS_ERR(opp))
dev_warn(dev, "Can't find the OPP for throttling: %pe!\n", opp);
} else {
throttled_freq = freq_hz / HZ_PER_KHZ;
trace_dcvsh_freq(cpu, qcom_cpufreq_hw_get(cpu), throttled_freq);
/* Update thermal pressure (the boost frequencies are accepted) */
arch_update_thermal_pressure(policy->related_cpus, throttled_freq);
else
dev_pm_opp_put(opp);
}
throttled_freq = freq_hz / HZ_PER_KHZ;
trace_dcvsh_freq(cpu, qcom_cpufreq_hw_get(cpu), throttled_freq);
/*
* In the unlikely case policy is unregistered do not enable
@ -403,6 +398,8 @@ static void qcom_lmh_dcvs_notify(struct qcom_cpufreq_data *data)
* for, then stop polling and switch back to interrupt mechanism.
*/
if (throttled_freq >= qcom_cpufreq_hw_get(cpu)) {
throttled_freq = policy->cpuinfo.max_freq;
enable_irq(data->throttle_irq);
trace_dcvsh_throttle(cpu, 0);
} else {
@ -410,6 +407,9 @@ static void qcom_lmh_dcvs_notify(struct qcom_cpufreq_data *data)
msecs_to_jiffies(10));
}
/* Update thermal pressure (the boost frequencies are accepted) */
arch_update_thermal_pressure(policy->related_cpus, throttled_freq);
out:
mutex_unlock(&data->throttle_lock);
}