cpuidle: governors: qcom-lpm: Misc Fixes

This change fixes below items

  1. Update cluster governors's now time stamp if CPU is of same cluster
  2. Remove unnecessary condition from CPU idle state select
  3. Skip updating cpu prediction history when sleep is disabled

Change-Id: I3f2870adf0b4005ca8cd02f2d355647a9c4ecd1a
Signed-off-by: Maulik Shah <quic_mkshah@quicinc.com>
This commit is contained in:
Maulik Shah 2022-11-21 15:47:34 +05:30
parent 7dcee2dc40
commit 35ce1503cf
2 changed files with 7 additions and 5 deletions

View File

@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
*/
#include <linux/cpu.h>
@ -390,14 +391,14 @@ void update_cluster_select(struct lpm_cpu *cpu_gov)
if (!cluster_gov->initialized)
continue;
spin_lock(&cluster_gov->lock);
cluster_gov->now = cpu_gov->now;
genpd = cluster_gov->genpd;
if (cpumask_test_cpu(cpu, genpd->cpus)) {
spin_lock(&cluster_gov->lock);
cluster_gov->now = cpu_gov->now;
cluster_gov->cpu_next_wakeup[cpu] = cpu_gov->next_wakeup;
update_cluster_next_wakeup(cluster_gov);
spin_unlock(&cluster_gov->lock);
}
spin_unlock(&cluster_gov->lock);
}
}

View File

@ -345,7 +345,8 @@ static void update_cpu_history(struct lpm_cpu *cpu_gov)
u64 measured_us = ktime_to_us(cpu_gov->dev->last_residency_ns);
struct cpuidle_state *target;
if (prediction_disabled || idx < 0 || idx > cpu_gov->drv->state_count - 1)
if (sleep_disabled || prediction_disabled || idx < 0 ||
idx > cpu_gov->drv->state_count - 1)
return;
target = &cpu_gov->drv->states[idx];
@ -568,7 +569,7 @@ static int lpm_select(struct cpuidle_driver *drv, struct cpuidle_device *dev,
for (i = drv->state_count - 1; i > 0; i--) {
struct cpuidle_state *s = &drv->states[i];
if (i && dev->states_usage[i].disable) {
if (dev->states_usage[i].disable) {
reason |= UPDATE_REASON(i, LPM_SELECT_STATE_DISABLED);
continue;
}