[PATCH] PM: dpm_show_time changes to suspend/resume dmesg prints

Todd Brandt <[email protected]>
Newsgroups org.kernel.vger.linux-pm
Message-ID <[email protected]>
Organize the optional dpm_show_time prints to focus on the 8 possible
suspend/resume callbacks devices can use and their associated phases
when they're called in suspend:

Remove "start suspend" as it is currently a combination of "suspend" and
"suspend prepare". Replace it with "prepare suspend" as a separate print.
Add "complete resume" over the dpm_complete call. For example:

[   66.680479] PM: suspend entry (s2idle)
[   66.826646] PM: prepare suspend of devices complete after 114.081 msecs
[   67.119306] PM: suspend of devices complete after 292.639 msecs
[   67.121309] PM: late suspend of devices complete after 1.983 msecs
[   67.190184] PM: noirq suspend of devices complete after 68.309 msecs
[   81.227706] PM: noirq resume of devices complete after 49.196 msecs
[   81.230847] PM: early resume of devices complete after 2.922 msecs
[   82.444735] PM: resume of devices complete after 1213.869 msecs
[   82.447943] PM: complete resume of devices complete after 2.850 msecs
[   82.457131] PM: suspend exit

Signed-off-by: Todd Brandt <[email protected]>
---
 drivers/base/power/main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index 184dc4b3b938..2597ef0e89e3 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -1329,6 +1329,7 @@ static void device_complete(struct device *dev, pm_message_t state)
 void dpm_complete(pm_message_t state)
 {
 	struct list_head list;
+	ktime_t starttime = ktime_get();
 
 	trace_suspend_resume(TPS("dpm_complete"), state.event, true);
 
@@ -1358,6 +1359,7 @@ void dpm_complete(pm_message_t state)
 	thermal_pm_complete();
 	/* Allow device probing and trigger re-probing of deferred devices */
 	device_unblock_probing();
+	dpm_show_time(starttime, state, error, "complete");
 	trace_suspend_resume(TPS("dpm_complete"), state.event, false);
 }
 
@@ -2351,6 +2353,7 @@ int dpm_suspend_start(pm_message_t state)
 	int error;
 
 	error = dpm_prepare(state);
+	dpm_show_time(starttime, state, error, "prepare");
 	if (error)
 		dpm_save_failed_step(SUSPEND_PREPARE);
 	else {
@@ -2358,7 +2361,6 @@ int dpm_suspend_start(pm_message_t state)
 		error = dpm_suspend(state);
 	}
 
-	dpm_show_time(starttime, state, error, "start");
 	return error;
 }
 EXPORT_SYMBOL_GPL(dpm_suspend_start);
-- 
2.34.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.