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

Commit 27b09f38 authored by Archana Sathyakumar's avatar Archana Sathyakumar
Browse files

lpm-levels: Check for need_resched just before entering PSCI



LPM driver checks for the need_resched flag to bail out in case of a
task waiting on the cpu. This currently happens at a very early state
even before the cpu and cluster prepare/config. Move this check to after
cpu and cluster prepare/config happens.

Change-Id: Id7cbd73dec1ba3a2dc822ed50f29b5af6d081511
Signed-off-by: default avatarArchana Sathyakumar <asathyak@codeaurora.org>
parent c952020e
Loading
Loading
Loading
Loading
+4 −7
Original line number Diff line number Diff line
@@ -805,11 +805,6 @@ static int lpm_cpuidle_enter(struct cpuidle_device *dev,

	trace_cpu_idle_rcuidle(idx, dev->cpu);

	if (need_resched()) {
		dev->last_residency = 0;
		goto exit;
	}

	pwr_params = &cluster->cpu->levels[idx].pwr;
	sched_set_cpu_cstate(smp_processor_id(), idx + 1,
		pwr_params->energy_overhead, pwr_params->latency_us);
@@ -820,6 +815,9 @@ static int lpm_cpuidle_enter(struct cpuidle_device *dev,
	cluster_prepare(cluster, cpumask, idx, true);
	lpm_stats_cpu_enter(idx);

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

	if (idx > 0 && !use_psci) {
		update_debug_pc_event(CPU_ENTER, idx, 0xdeaffeed, 0xdeaffeed,
					true);
@@ -831,6 +829,7 @@ static int lpm_cpuidle_enter(struct cpuidle_device *dev,
		success = psci_enter_sleep(cluster, idx, true);
	}

exit:
	lpm_stats_cpu_exit(idx, success);
	cluster_unprepare(cluster, cpumask, idx, true);
	cpu_unprepare(cluster, idx, true);
@@ -841,8 +840,6 @@ static int lpm_cpuidle_enter(struct cpuidle_device *dev,
	do_div(time, 1000);
	dev->last_residency = (int)time;
	trace_cpu_idle_exit(idx, success);

exit:
	trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, dev->cpu);
	local_irq_enable();
	return idx;