diff mbox

[v2,2/3] PM / sleep: Mark suspend/hibernation start and finish

Message ID 21457958.U8q3irAeUz@aspire.rjw.lan (mailing list archive)
State Mainlined
Delegated to: Rafael Wysocki
Headers show

Commit Message

Rafael J. Wysocki July 20, 2017, 1:38 a.m. UTC
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

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>
---

-> v2: Smiplified the messages as suggested by Mark.

---
 kernel/power/hibernate.c |    5 +++++
 kernel/power/suspend.c   |    2 ++
 2 files changed, 7 insertions(+)

Comments

Mark Salyzyn July 20, 2017, 5:49 p.m. UTC | #1
On 07/19/2017 06:38 PM, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> 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>
> ---
>
> -> v2: Smiplified the messages as suggested by Mark.
>
> ---
>   kernel/power/hibernate.c |    5 +++++
>   kernel/power/suspend.c   |    2 ++
>   2 files changed, 7 insertions(+)
>
> Index: linux-pm/kernel/power/hibernate.c
> ===================================================================
> --- linux-pm.orig/kernel/power/hibernate.c
> +++ linux-pm/kernel/power/hibernate.c
> @@ -692,6 +692,7 @@ int hibernate(void)
>   		goto Unlock;
>   	}
>   
> +	pr_info("hibernation entry\n");
nit (minor): Many of the logs report a PM: prefix. Flipping coin that 
the 3 characters provides any real gain is in your hands. My WAG is it 
would be nice to be able to do dmesg | grep PM:

Ack
Rafael J. Wysocki July 20, 2017, 9:05 p.m. UTC | #2
On Thu, Jul 20, 2017 at 7:49 PM, Mark Salyzyn <salyzyn@android.com> wrote:
> On 07/19/2017 06:38 PM, Rafael J. Wysocki wrote:
>>
>> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>>
>> 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>
>> ---
>>
>> -> v2: Smiplified the messages as suggested by Mark.
>>
>> ---
>>   kernel/power/hibernate.c |    5 +++++
>>   kernel/power/suspend.c   |    2 ++
>>   2 files changed, 7 insertions(+)
>>
>> Index: linux-pm/kernel/power/hibernate.c
>> ===================================================================
>> --- linux-pm.orig/kernel/power/hibernate.c
>> +++ linux-pm/kernel/power/hibernate.c
>> @@ -692,6 +692,7 @@ int hibernate(void)
>>                 goto Unlock;
>>         }
>>   +     pr_info("hibernation entry\n");
>
> nit (minor): Many of the logs report a PM: prefix. Flipping coin that the 3
> characters provides any real gain is in your hands. My WAG is it would be
> nice to be able to do dmesg | grep PM:

Yeah, that's why pr_fmt() is defined in hibernate.c.  It is missing in
suspend.c ATM, though, hence the difference (but will be added there
too).

Thanks,
Rafael
diff mbox

Patch

Index: linux-pm/kernel/power/hibernate.c
===================================================================
--- linux-pm.orig/kernel/power/hibernate.c
+++ linux-pm/kernel/power/hibernate.c
@@ -692,6 +692,7 @@  int hibernate(void)
 		goto Unlock;
 	}
 
+	pr_info("hibernation entry\n");
 	pm_prepare_console();
 	error = __pm_notifier_call_chain(PM_HIBERNATION_PREPARE, -1, &nr_calls);
 	if (error) {
@@ -762,6 +763,8 @@  int hibernate(void)
 	atomic_inc(&snapshot_device_available);
  Unlock:
 	unlock_system_sleep();
+	pr_info("hibernation exit\n");
+
 	return error;
 }
 
@@ -868,6 +871,7 @@  static int software_resume(void)
 		goto Unlock;
 	}
 
+	pr_info("resume from hibernation\n");
 	pm_prepare_console();
 	error = __pm_notifier_call_chain(PM_RESTORE_PREPARE, -1, &nr_calls);
 	if (error) {
@@ -884,6 +888,7 @@  static int software_resume(void)
  Finish:
 	__pm_notifier_call_chain(PM_POST_RESTORE, nr_calls, NULL);
 	pm_restore_console();
+	pr_info("resume from hibernation failed (%d)\n", error);
 	atomic_inc(&snapshot_device_available);
 	/* For success case, the suspend path will release the lock */
  Unlock:
Index: linux-pm/kernel/power/suspend.c
===================================================================
--- linux-pm.orig/kernel/power/suspend.c
+++ linux-pm/kernel/power/suspend.c
@@ -579,6 +579,7 @@  int pm_suspend(suspend_state_t state)
 	if (state <= PM_SUSPEND_ON || state >= PM_SUSPEND_MAX)
 		return -EINVAL;
 
+	pr_info("PM: suspend entry (%s)\n", pm_states[state]);
 	error = enter_state(state);
 	if (error) {
 		suspend_stats.fail++;
@@ -586,6 +587,7 @@  int pm_suspend(suspend_state_t state)
 	} else {
 		suspend_stats.success++;
 	}
+	pr_info("PM: suspend exit\n");
 	return error;
 }
 EXPORT_SYMBOL(pm_suspend);