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: Archana Sathyakumar <asathyak@codeaurora.org>
This commit is contained in:
Archana Sathyakumar 2016-06-24 16:19:37 -06:00 committed by Kyle Yan
parent b378543680
commit 226509c1ee

View file

@ -1026,12 +1026,13 @@ 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()));
trace_cpu_idle_enter(idx);
lpm_stats_cpu_enter(idx, start_time);
if (need_resched() || (idx < 0))
goto exit;
BUG_ON(!use_psci);
trace_cpu_idle_enter(idx);
lpm_stats_cpu_enter(idx, start_time);
success = psci_enter_sleep(cluster, idx, true);
exit: