From 0c86f63b8e2c90cd3400b33468346f1331c50dee Mon Sep 17 00:00:00 2001 From: Ram Chandrasekar Date: Wed, 8 Feb 2017 12:05:32 -0700 Subject: 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 --- drivers/thermal/msm_thermal.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'drivers/thermal') diff --git a/drivers/thermal/msm_thermal.c b/drivers/thermal/msm_thermal.c index 7c75f740a204..cc232ff9be9a 100644 --- a/drivers/thermal/msm_thermal.c +++ b/drivers/thermal/msm_thermal.c @@ -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)); -- cgit v1.2.3