Skip to content

Commit 8915aa2

Browse files
committed
PM / sleep: Mark suspend/hibernation start and finish
Regardless of whether or not debug messages from the core system suspend/hibernation code are enabled, it is useful to know when system-wide transitions start and finish (or fail), so print "info" messages at these points. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Mark Salyzyn <salyzyn@android.com>
1 parent 8d8b244 commit 8915aa2

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

‎kernel/power/hibernate.c‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,7 @@ int hibernate(void)
692692
goto Unlock;
693693
}
694694

695+
pr_info("hibernation entry\n");
695696
pm_prepare_console();
696697
error = __pm_notifier_call_chain(PM_HIBERNATION_PREPARE, -1, &nr_calls);
697698
if (error) {
@@ -762,6 +763,8 @@ int hibernate(void)
762763
atomic_inc(&snapshot_device_available);
763764
Unlock:
764765
unlock_system_sleep();
766+
pr_info("hibernation exit\n");
767+
765768
return error;
766769
}
767770

@@ -868,6 +871,7 @@ static int software_resume(void)
868871
goto Unlock;
869872
}
870873

874+
pr_info("resume from hibernation\n");
871875
pm_prepare_console();
872876
error = __pm_notifier_call_chain(PM_RESTORE_PREPARE, -1, &nr_calls);
873877
if (error) {
@@ -884,6 +888,7 @@ static int software_resume(void)
884888
Finish:
885889
__pm_notifier_call_chain(PM_POST_RESTORE, nr_calls, NULL);
886890
pm_restore_console();
891+
pr_info("resume from hibernation failed (%d)\n", error);
887892
atomic_inc(&snapshot_device_available);
888893
/* For success case, the suspend path will release the lock */
889894
Unlock:

‎kernel/power/suspend.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,13 +584,15 @@ int pm_suspend(suspend_state_t state)
584584
if (state <= PM_SUSPEND_ON || state >= PM_SUSPEND_MAX)
585585
return -EINVAL;
586586

587+
pr_info("PM: suspend entry (%s)\n", pm_states[state]);
587588
error = enter_state(state);
588589
if (error) {
589590
suspend_stats.fail++;
590591
dpm_save_failed_errno(error);
591592
} else {
592593
suspend_stats.success++;
593594
}
595+
pr_info("PM: suspend exit\n");
594596
return error;
595597
}
596598
EXPORT_SYMBOL(pm_suspend);

0 commit comments

Comments
 (0)