Skip to content

Commit 8d89835

Browse files
committed
PM: suspend: Do not pause cpuidle in the suspend-to-idle path
It is pointless to pause cpuidle in the suspend-to-idle path, because it is going to be resumed in the same path later and pausing it does not serve any particular purpose in that case. Rework the code to avoid doing that. Signed-off-by: Rafael J. Wysocki <[email protected]> Reviewed-by: Ulf Hansson <[email protected]> Tested-by: Ulf Hansson <[email protected]>
1 parent 928265e commit 8d89835

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

drivers/base/power/main.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -747,8 +747,6 @@ void dpm_resume_noirq(pm_message_t state)
747747

748748
resume_device_irqs();
749749
device_wakeup_disarm_wake_irqs();
750-
751-
cpuidle_resume();
752750
}
753751

754752
/**
@@ -881,6 +879,7 @@ void dpm_resume_early(pm_message_t state)
881879
void dpm_resume_start(pm_message_t state)
882880
{
883881
dpm_resume_noirq(state);
882+
cpuidle_resume();
884883
dpm_resume_early(state);
885884
}
886885
EXPORT_SYMBOL_GPL(dpm_resume_start);
@@ -1337,8 +1336,6 @@ int dpm_suspend_noirq(pm_message_t state)
13371336
{
13381337
int ret;
13391338

1340-
cpuidle_pause();
1341-
13421339
device_wakeup_arm_wake_irqs();
13431340
suspend_device_irqs();
13441341

@@ -1522,9 +1519,13 @@ int dpm_suspend_end(pm_message_t state)
15221519
if (error)
15231520
goto out;
15241521

1522+
cpuidle_pause();
1523+
15251524
error = dpm_suspend_noirq(state);
1526-
if (error)
1525+
if (error) {
1526+
cpuidle_resume();
15271527
dpm_resume_early(resume_event(state));
1528+
}
15281529

15291530
out:
15301531
dpm_show_time(starttime, state, error, "end");

kernel/power/suspend.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,13 @@ static void s2idle_enter(void)
9797
raw_spin_unlock_irq(&s2idle_lock);
9898

9999
cpus_read_lock();
100-
cpuidle_resume();
101100

102101
/* Push all the CPUs into the idle loop. */
103102
wake_up_all_idle_cpus();
104103
/* Make the current CPU wait so it can enter the idle loop too. */
105104
swait_event_exclusive(s2idle_wait_head,
106105
s2idle_state == S2IDLE_STATE_WAKE);
107106

108-
cpuidle_pause();
109107
cpus_read_unlock();
110108

111109
raw_spin_lock_irq(&s2idle_lock);
@@ -405,6 +403,9 @@ static int suspend_enter(suspend_state_t state, bool *wakeup)
405403
if (error)
406404
goto Devices_early_resume;
407405

406+
if (state != PM_SUSPEND_TO_IDLE)
407+
cpuidle_pause();
408+
408409
error = dpm_suspend_noirq(PMSG_SUSPEND);
409410
if (error) {
410411
pr_err("noirq suspend of devices failed\n");
@@ -459,6 +460,9 @@ static int suspend_enter(suspend_state_t state, bool *wakeup)
459460
dpm_resume_noirq(PMSG_RESUME);
460461

461462
Platform_early_resume:
463+
if (state != PM_SUSPEND_TO_IDLE)
464+
cpuidle_resume();
465+
462466
platform_resume_early(state);
463467

464468
Devices_early_resume:

0 commit comments

Comments
 (0)