Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 019526d1 authored by Archana Sathyakumar's avatar Archana Sathyakumar
Browse files

lpm-levels: Fix cpu idle trace and stats event



In the event that the cpu needs to be rescheduled for another task
before it enters psci sleep, the stats and trace exit events are
considered without the enter events. Fix this issue by moving enter
events before the cpu gets scheduled.

Change-Id: I8e477c434d218960b48aab4e61cacf99476b607f
Signed-off-by: default avatarArchana Sathyakumar <asathyak@codeaurora.org>
parent 50239ba4
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -1002,6 +1002,9 @@ static int lpm_cpuidle_enter(struct cpuidle_device *dev,
	int64_t start_time = ktime_to_ns(ktime_get()), end_time;
	struct power_params *pwr_params;

	if (idx < 0)
		return -EINVAL;

	pwr_params = &cluster->cpu->levels[idx].pwr;
	sched_set_cpu_cstate(smp_processor_id(), idx + 1,
		pwr_params->energy_overhead, pwr_params->latency_us);
@@ -1009,12 +1012,12 @@ static int lpm_cpuidle_enter(struct cpuidle_device *dev,
	cpu_prepare(cluster, idx, true);
	cluster_prepare(cluster, cpumask, idx, true, ktime_to_ns(ktime_get()));

	if (need_resched() || (idx < 0))
		goto exit;

	trace_cpu_idle_enter(idx);
	lpm_stats_cpu_enter(idx, start_time);

	if (need_resched())
		goto exit;

	if (!use_psci) {
		if (idx > 0)
			update_debug_pc_event(CPU_ENTER, idx, 0xdeaffeed,