Skip to contentSkip to conversation

PM / sleep: Add pm_debug_messages boot command control

PATCH In review Chen Yu 3 participants 4 messages Apr 2, 2020 – Apr 6, 2020

Subsystems (3)
lore
Share & tools
lore

Chen Yu

author
#0 lore raw

PATCH v3 1/1 PM / sleep: Add pm_debug_messages boot command control

Debug messages from the system suspend/hibernation infrastructure is disabled by default, and can only be enabled after the system has boot up via /sys/power/pm_debug_messages. This makes the hibernation resume hard to track as it involves system boot up across hibernation. There's no chance for software_resume() to track the resume process, eg.

Turning on the pm_debug_messages during boot up by appending 'pm_debug_messages'.

Cc "Rafael J. Wysocki" <[email protected]>
Cc Len Brown <[email protected]>
Cc Andy Shevchenko <[email protected]>
Cc Randy Dunlap <[email protected]>

---
v2: According to Randy's suggestion, add the command line
option to Documentation/admin-guide/kernel-parameters.txt

v3: According to Rafael's suggestion, rename the boot command
to pm_debug_messages

---
 Documentation/admin-guide/kernel-parameters.txt | 3 +++
 kernel/power/main.c                             | 7 +++++++
 2 files changed, 10 insertions(+)
Documentation/admin-guide/kernel-parameters.txt +3 -0
index ed73df5f1369..3fb9cbee8d28 100644
@@ -3720,6 +3720,9 @@
 			Override pmtimer IOPort with a hex value.
 			e.g. pmtmr=0x508
 
+	pm_debug_messages	[SUSPEND,KNL]
+			Enable suspend/resume debug messages during boot up.
+
 	pnp.debug=1	[PNP]
 			Enable PNP debug messages (depends on the
 			CONFIG_PNP_DEBUG_MESSAGES option).  Change at run-time
kernel/power/main.c +7 -0
index 69b7a8aeca3b..40f86ec4ab30 100644
@@ -535,6 +535,13 @@ static ssize_t pm_debug_messages_store(struct kobject *kobj,
 
 power_attr(pm_debug_messages);
 
+static int __init pm_debug_messages_setup(char *str)
+{
+	pm_debug_messages_on = true;
+	return 1;
+}
+__setup("pm_debug_messages", pm_debug_messages_setup);
+
 /**
  * __pm_pr_dbg - Print a suspend debug message to the kernel log.
  * @defer: Whether or not to use printk_deferred() to print the message.
Signature · 1 line
2.17.1
#1 lore raw
Quoted 50 lines · Chen Yu

Debug messages from the system suspend/hibernation infrastructure is disabled by default, and can only be enabled after the system has boot up via /sys/power/pm_debug_messages. This makes the hibernation resume hard to track as it involves system boot up across hibernation. There's no chance for software_resume() to track the resume process, eg.

Turning on the pm_debug_messages during boot up by appending 'pm_debug_messages'.

Cc "Rafael J. Wysocki" <[email protected]>
Cc Len Brown <[email protected]>
Cc Andy Shevchenko <[email protected]>
Cc Randy Dunlap <[email protected]>

---
v2: According to Randy's suggestion, add the command line
option to Documentation/admin-guide/kernel-parameters.txt

v3: According to Rafael's suggestion, rename the boot command
to pm_debug_messages

---
 Documentation/admin-guide/kernel-parameters.txt | 3 +++
 kernel/power/main.c                             | 7 +++++++
 2 files changed, 10 insertions(+)
Documentation/admin-guide/kernel-parameters.txt +3 -0
index ed73df5f1369..3fb9cbee8d28 100644
@@ -3720,6 +3720,9 @@
                        Override pmtimer IOPort with a hex value.
                        e.g. pmtmr=0x508
 
+       pm_debug_messages       [SUSPEND,KNL]
+                       Enable suspend/resume debug messages during boot up.
+
        pnp.debug=1     [PNP]
                        Enable PNP debug messages (depends on the
                        CONFIG_PNP_DEBUG_MESSAGES option).  Change at run-time
kernel/power/main.c +1 -0
index 69b7a8aeca3b..40f86ec4ab30 100644
@@ -535,6 +535,13 @@ static ssize_t pm_debug_messages_store(struct kobject *kobj,
 
 power_attr(pm_debug_messages);
 
+static int __init pm_debug_messages_setup(char *str)

kernel/power/main.c static ssize_t pm_debug_messages_store(struct kobject *kobj,

Quoted 10 lines
kernel/power/main.c +6 -1
+{
+       pm_debug_messages_on = true;
+       return 1;
+}
+__setup("pm_debug_messages", pm_debug_messages_setup);
+
 /**
  * __pm_pr_dbg - Print a suspend debug message to the kernel log.
  * @defer: Whether or not to use printk_deferred() to print the message.
--

Applied (as 5.7-rc material) with modified subject and changelog, thanks!

#2 lore raw

Hi!

Quoted 8 lines
Quoted 8 lines
Documentation/admin-guide/kernel-parameters.txt +0 -0
index ed73df5f1369..3fb9cbee8d28 100644
@@ -3720,6 +3720,9 @@
                        Override pmtimer IOPort with a hex value.
                        e.g. pmtmr=0x508
 
Quoted 8 lines

Documentation/admin-guide/kernel-parameters.txt line 3728

Quoted 6 lines
Documentation/admin-guide/kernel-parameters.txt +3 -0
+       pm_debug_messages       [SUSPEND,KNL]
+                       Enable suspend/resume debug messages during boot up.
+
        pnp.debug=1     [PNP]
                        Enable PNP debug messages (depends on the
                        CONFIG_PNP_DEBUG_MESSAGES option).  Change at run-time

Applied (as 5.7-rc material) with modified subject and changelog,

thanks!

Please don't.

We have pnp.debug, i8042.debug, acpi.debug_*, lsm.debug... It makes sense to do pm.debug... we want to have some consistency.

Thanks,
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
author
#3 lore raw

Hi Pavel,
thanks for review.

Quoted 18 lines · Pavel Machek

Hi!

Quoted 8 lines
Quoted 8 lines
Documentation/admin-guide/kernel-parameters.txt +0 -0
index ed73df5f1369..3fb9cbee8d28 100644
@@ -3720,6 +3720,9 @@
                        Override pmtimer IOPort with a hex value.
                        e.g. pmtmr=0x508
 
Quoted 8 lines

Documentation/admin-guide/kernel-parameters.txt line 3728

Quoted 6 lines
Documentation/admin-guide/kernel-parameters.txt +3 -0
+       pm_debug_messages       [SUSPEND,KNL]
+                       Enable suspend/resume debug messages during boot up.
+
        pnp.debug=1     [PNP]
                        Enable PNP debug messages (depends on the
                        CONFIG_PNP_DEBUG_MESSAGES option).  Change at run-time

Applied (as 5.7-rc material) with modified subject and changelog,

Quoted 7 lines

thanks!

Please don't.

We have pnp.debug, i8042.debug, acpi.debug_*, lsm.debug... It makes sense to do pm.debug... we want to have some consistency.

We also have initcall_debug. It looks like the 'dot' indicates that it is a module(or driver) parameter, and have multiple options for user to choose from, but it looks like this is not the case for pm_debug_messages.

Thanks,
Chenyu

Quoted 5 lines

Thanks,
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html