Skip to contentSkip to conversation

PM: dpm_show_time changes to suspend/resume dmesg prints

PATCH In review Todd Brandt 4 participants 4 messages Aug 31 – Sep 21

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 PM: dpm_show_time changes to suspend/resume dmesg prints

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

v2 change: replace error variable with NULL in dpm_complete

---
 drivers/base/power/main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/base/power/main.c +3 -1
index e130da428141..7496f76bf9f8 100644
@@ -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, NULL, "complete");
 	trace_suspend_resume(TPS("dpm_complete"), state.event, false);
 }
 
@@ -2352,6 +2354,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 {
@@ -2359,7 +2362,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);
Signature · 1 line
2.34.1
#1 lore raw
kernel test robot noticed the following build errors:

Hi Todd,

kernel test robot noticed the following build errors:

[auto build test ERROR on rafael-pm/linux-next]
[also build test ERROR on rafael-pm/bleeding-edge amd-pstate/linux-next amd-pstate/bleeding-edge linus/master v7.3-rc1 next-20260902] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Todd-Brandt/PM-dpm_show_time-changes-to-suspend-resume-dmesg-prints/20260831-152926
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
patch link:    https://lore.kernel.org/r/20260831222926.34698-1-todd.e.brandt%40linux.intel.com
patch subject: [PATCH v2] PM: dpm_show_time changes to suspend/resume dmesg prints
config: mips-allyesconfig (https://download.01.org/0day-ci/archive/20260903/[email protected]/config)
compiler: mips-linux-gcc (GCC) 16.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260903/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

In file included from include/uapi/linux/posix_types.h:5,
from include/uapi/linux/types.h:14, from include/linux/types.h:5,
from include/linux/kasan-checks.h:5, from include/asm-generic/rwonce.h:26, from ./arch/mips/include/generated/asm/rwonce.h:1, from include/linux/compiler.h:369,
from include/linux/dev_printk.h:14, from include/linux/device.h:15,
from drivers/base/power/main.c:21:
drivers/base/power/main.c: In function 'dpm_complete':

>> include/linux/stddef.h:8:14: error: passing argument 3 of 'dpm_show_time' makes integer from pointer without a cast [-Wint-conversion]
       8 | #define NULL ((void *)0)
         |              ^~~~~~~~~~~
         |              |
         |              void *
   drivers/base/power/main.c:1362:41: note: in expansion of macro 'NULL'
    1362 |         dpm_show_time(starttime, state, NULL, "complete");
         |                                         ^~~~

drivers/base/power/main.c:480:70: note: expected 'int' but argument is of type 'void *'
480 | static void dpm_show_time(ktime_t starttime, pm_message_t state, int error,
| ~~~~^~~~~

vim +/dpm_show_time +8 include/linux/stddef.h

^1da177e4c3f415 Linus Torvalds   2005-04-16  6  
^1da177e4c3f415 Linus Torvalds   2005-04-16  7  #undef NULL
^1da177e4c3f415 Linus Torvalds   2005-04-16 @8  #define NULL ((void *)0)

6e2182874324727 Richard Knutsson 2006-09-30 9

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

#2 lore raw
In reply to Todd Brandt
Quoted 40 lines · Todd Brandt

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

v2 change: replace error variable with NULL in dpm_complete

---
 drivers/base/power/main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/base/power/main.c +1 -0
index e130da428141..7496f76bf9f8 100644
@@ -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);
 

drivers/base/power/main.c void dpm_complete(pm_message_t state) · line 1362

Quoted 4 lines
drivers/base/power/main.c +1 -0
@@ -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, NULL, "complete");

Integer 0 should be passed to the above, not NULL.

Quoted 23 lines
drivers/base/power/main.c +1 -2
        trace_suspend_resume(TPS("dpm_complete"), state.event, false);
 }
 
@@ -2352,6 +2354,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 {
@@ -2359,7 +2362,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

#3 lore raw
Quoted 53 lines · Rafael J. Wysocki (Intel)
Quoted 51 lines · Todd Brandt

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

v2 change: replace error variable with NULL in dpm_complete

---
 drivers/base/power/main.c | 4 +++-

 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/base/power/main.c +1 -0
index e130da428141..7496f76bf9f8 100644
@@ -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);

Quoted 9 lines
Quoted 6 lines
drivers/base/power/main.c +0 -0
@@ -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, NULL, "complete");

Integer 0 should be passed to the above, not NULL.

Understood. I'll push a v3 once I've done more testing. I want to be sure that the prepare and complete phases accurately show the whole of dpm_prepare and dpm_complete so I may make a few more changes.

Quoted 24 lines
Quoted 24 lines

        trace_suspend_resume(TPS("dpm_complete"), state.event, false);
 }

drivers/base/power/main.c +1 -2
@@ -2352,6 +2354,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 {
@@ -2359,7 +2362,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