diff mbox series

[v2] PM / sleep: Add pm_debug_messages boot command control

Message ID 20200329144640.20536-1-yu.c.chen@intel.com (mailing list archive)
State Changes Requested, archived
Headers show
Series [v2] PM / sleep: Add pm_debug_messages boot command control | expand

Commit Message

Chen Yu March 29, 2020, 2:46 p.m. UTC
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_message'.

Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Len Brown <lenb@kernel.org>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Chen Yu <yu.c.chen@intel.com>
---
v2: According to Randy's suggestion, add the command line
    option to Documentation/admin-guide/kernel-parameters.txt
---
 Documentation/admin-guide/kernel-parameters.txt | 3 +++
 kernel/power/main.c                             | 7 +++++++
 2 files changed, 10 insertions(+)

Comments

Rafael J. Wysocki April 1, 2020, 9:43 a.m. UTC | #1
On Sun, Mar 29, 2020 at 4:48 PM Chen Yu <yu.c.chen@intel.com> wrote:
>
> 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_message'.
>
> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
> Cc: Len Brown <lenb@kernel.org>
> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Cc: Randy Dunlap <rdunlap@infradead.org>
> Signed-off-by: Chen Yu <yu.c.chen@intel.com>
> ---
> v2: According to Randy's suggestion, add the command line
>     option to Documentation/admin-guide/kernel-parameters.txt
> ---
>  Documentation/admin-guide/kernel-parameters.txt | 3 +++
>  kernel/power/main.c                             | 7 +++++++
>  2 files changed, 10 insertions(+)
>
> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
> index c07815d230bc..105ec73743d7 100644
> --- a/Documentation/admin-guide/kernel-parameters.txt
> +++ b/Documentation/admin-guide/kernel-parameters.txt
> @@ -3698,6 +3698,9 @@
>                         Override pmtimer IOPort with a hex value.
>                         e.g. pmtmr=0x508
>
> +       pm_debug_message        [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
> diff --git a/kernel/power/main.c b/kernel/power/main.c
> index 69b7a8aeca3b..1da3d7c15e03 100644
> --- a/kernel/power/main.c
> +++ b/kernel/power/main.c
> @@ -535,6 +535,13 @@ static ssize_t pm_debug_messages_store(struct kobject *kobj,
>
>  power_attr(pm_debug_messages);
>
> +static int __init pm_debug_message_setup(char *str)
> +{
> +       pm_debug_messages_on = true;
> +       return 1;
> +}
> +__setup("pm_debug_message", pm_debug_message_setup);

I'd call this "pm_debug_messages" (just like the sysfs knob) and
rename the rest accordingly.

> +
>  /**
>   * __pm_pr_dbg - Print a suspend debug message to the kernel log.
>   * @defer: Whether or not to use printk_deferred() to print the message.
> --
Chen Yu April 2, 2020, 6:10 a.m. UTC | #2
Hi Rafael,
On Wed, Apr 01, 2020 at 11:43:51AM +0200, Rafael J. Wysocki wrote:
> On Sun, Mar 29, 2020 at 4:48 PM Chen Yu <yu.c.chen@intel.com> wrote:
> > +__setup("pm_debug_message", pm_debug_message_setup);
> 
> I'd call this "pm_debug_messages" (just like the sysfs knob) and
> rename the rest accordingly.
Okay, I'll do in next version.

Thanks,
Chenyu
Pavel Machek April 6, 2020, 8:58 a.m. UTC | #3
On Sun 2020-03-29 22:46:40, Chen Yu wrote:
> 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_message'.
> 
> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
> Cc: Len Brown <lenb@kernel.org>
> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Cc: Randy Dunlap <rdunlap@infradead.org>
> Signed-off-by: Chen Yu <yu.c.chen@intel.com>
> ---
> v2: According to Randy's suggestion, add the command line
>     option to Documentation/admin-guide/kernel-parameters.txt
> ---
>  Documentation/admin-guide/kernel-parameters.txt | 3 +++
>  kernel/power/main.c                             | 7 +++++++
>  2 files changed, 10 insertions(+)
> 
> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
> index c07815d230bc..105ec73743d7 100644
> --- a/Documentation/admin-guide/kernel-parameters.txt
> +++ b/Documentation/admin-guide/kernel-parameters.txt
> @@ -3698,6 +3698,9 @@
>  			Override pmtimer IOPort with a hex value.
>  			e.g. pmtmr=0x508
>  
> +	pm_debug_message	[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

See?

So this should be pm.debug=1 for consistency?

									Pavel
diff mbox series

Patch

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index c07815d230bc..105ec73743d7 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -3698,6 +3698,9 @@ 
 			Override pmtimer IOPort with a hex value.
 			e.g. pmtmr=0x508
 
+	pm_debug_message	[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
diff --git a/kernel/power/main.c b/kernel/power/main.c
index 69b7a8aeca3b..1da3d7c15e03 100644
--- a/kernel/power/main.c
+++ b/kernel/power/main.c
@@ -535,6 +535,13 @@  static ssize_t pm_debug_messages_store(struct kobject *kobj,
 
 power_attr(pm_debug_messages);
 
+static int __init pm_debug_message_setup(char *str)
+{
+	pm_debug_messages_on = true;
+	return 1;
+}
+__setup("pm_debug_message", pm_debug_message_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.