msm: thermal: update LMH DCVSh even when cores are offline

KTM right now won't update the mitigation frequency cap to LMH DCVSh if
all the cores in a cluster are offline. It will notify the LMH DCVSh
when at least one core is online. Due to race condition, there is a
possibility that this update can be missed or cores will be running
unmitigated for a short duration after being online.

LMH DCVSh hardware can accept the frequency cap even when the cores are
offline and apply the cap later when the cores are brought back online.
So in KTM update the LMH DCVSh hardware, even if the cores are offline
to avoid any race condition.

Change-Id: Idc04c35a9c5de66cfd8edb4150106ed65f9f4bf1
Signed-off-by: Ram Chandrasekar <rkumbako@codeaurora.org>
This commit is contained in:
Ram Chandrasekar 2017-02-08 12:05:32 -07:00
parent 2aa89ab3ff
commit 0c86f63b8e

View file

@ -1134,6 +1134,14 @@ static void update_cpu_freq(int cpu, enum freq_limits changed)
if (ret)
pr_err("Unable to update policy for cpu:%d. err:%d\n",
cpu, ret);
} else if (lmh_dcvs_available) {
trace_thermal_pre_frequency_mit(cpu,
cpus[cpu].limited_max_freq,
cpus[cpu].limited_min_freq);
msm_lmh_dcvs_update(cpu);
trace_thermal_post_frequency_mit(cpu,
cpufreq_quick_get_max(cpu),
cpus[cpu].limited_min_freq);
}
}
@ -1621,6 +1629,9 @@ static void update_cluster_freq(void)
changed |= FREQ_LIMIT_MIN;
cluster_ptr->limited_max_freq = max;
cluster_ptr->limited_min_freq = min;
if (online_cpu == -1 && lmh_dcvs_available)
online_cpu = cpumask_first(
&cluster_ptr->cluster_cores);
if (online_cpu != -1)
update_cpu_freq(online_cpu, changed);
}
@ -3646,12 +3657,6 @@ static int __ref msm_thermal_cpu_callback(struct notifier_block *nfb,
switch (action & ~CPU_TASKS_FROZEN) {
case CPU_UP_PREPARE:
/*
* Apply LMH freq cap vote, which was requested when the
* core was offline.
*/
if (lmh_dcvs_available)
msm_lmh_dcvs_update(cpu);
if (!cpumask_test_and_set_cpu(cpu, cpus_previously_online))
pr_debug("Total prev cores online tracked %u\n",
cpumask_weight(cpus_previously_online));