Linux Power Management development
 help / color / mirror / Atom feed
From: Randy Dunlap <rdunlap@infradead.org>
To: Zihuan Zhang <zhangzihuan@kylinos.cn>,
	corbet@lwn.net, rafael@kernel.org, len.brown@intel.com,
	pavel@kernel.org, akpm@linux-foundation.org, paulmck@kernel.org,
	rostedt@goodmis.org, thuth@redhat.com, bp@alien8.de,
	ardb@kernel.org, gregkh@linuxfoundation.org
Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-pm@vger.kernel.org
Subject: Re: [PATCH v3] PM / sleep: add configurable delay for pm_test
Date: Wed, 7 May 2025 08:49:20 -0700	[thread overview]
Message-ID: <06bcea82-11d5-4dcf-8331-c073e6d9078f@infradead.org> (raw)
In-Reply-To: <20250507063520.419635-1-zhangzihuan@kylinos.cn>



On 5/6/25 11:35 PM, Zihuan Zhang wrote:
> This patch turns this 5 second delay into a configurable module
> parameter, so users can determine how long to wait in this
> pseudo-hibernate state before resuming the system.
> 
> The configurable delay parameter has been added to suspend and
> synchronized to hibernation.
> 
> Example (wait 30 seconds);
> 
>   # echo 30 > /sys/module/hibernate/parameters/pm_test_delay
>   # echo core > /sys/power/pm_test
> 
> Signed-off-by: Zihuan Zhang <zhangzihuan@kylinos.cn>

Looks good. Thanks.

Reviewed-by: Randy Dunlap <rdunlap@infradead.org>

> ---
> v3:
>  - Fix the location of the hibernate.pm_test_delay parameter in
>    kernel-parameters.txt.
>  - Update ‘[hibernate]’ to ‘[HIBERNATION]’
> v2:
>  - Fix typos.
> ---
>  Documentation/admin-guide/kernel-parameters.txt | 7 +++++++
>  kernel/power/hibernate.c                        | 9 +++++++--
>  2 files changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
> index d9fd26b95b34..a110cbb37f20 100644
> --- a/Documentation/admin-guide/kernel-parameters.txt
> +++ b/Documentation/admin-guide/kernel-parameters.txt
> @@ -1828,6 +1828,13 @@
>  				lz4: Select LZ4 compression algorithm to
>  				compress/decompress hibernation image.
>  
> +	hibernate.pm_test_delay=
> +			[HIBERNATION]
> +			Sets the number of seconds to remain in a hibernation test
> +			mode before resuming the system (see
> +			/sys/power/pm_test). Only available when CONFIG_PM_DEBUG
> +			is set. Default value is 5.
> +
>  	highmem=nn[KMG]	[KNL,BOOT,EARLY] forces the highmem zone to have an exact
>  			size of <nn>. This works even on boxes that have no
>  			highmem otherwise. This also works to reduce highmem
> diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
> index 23c0f4e6cb2f..485133af884d 100644
> --- a/kernel/power/hibernate.c
> +++ b/kernel/power/hibernate.c
> @@ -133,10 +133,15 @@ bool system_entering_hibernation(void)
>  EXPORT_SYMBOL(system_entering_hibernation);
>  
>  #ifdef CONFIG_PM_DEBUG
> +static unsigned int pm_test_delay = 5;
> +module_param(pm_test_delay, uint, 0644);
> +MODULE_PARM_DESC(pm_test_delay,
> +		 "Number of seconds to wait before resuming from hibernation test");
>  static void hibernation_debug_sleep(void)
>  {
> -	pr_info("debug: Waiting for 5 seconds.\n");
> -	mdelay(5000);
> +	pr_info("hibernation debug: Waiting for %d second(s).\n",
> +		pm_test_delay);
> +	mdelay(pm_test_delay * 1000);
>  }
>  
>  static int hibernation_test(int level)

-- 
~Randy

  reply	other threads:[~2025-05-07 15:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-07  6:35 [PATCH v3] PM / sleep: add configurable delay for pm_test Zihuan Zhang
2025-05-07 15:49 ` Randy Dunlap [this message]
2025-05-09 14:01   ` Rafael J. Wysocki
  -- strict thread matches above, loose matches on Subject: below --
2014-09-03 23:55 [PATCH] " Brian Norris
2015-02-22  8:26 ` [PATCH v2] " Brian Norris
2015-02-23  5:16   ` [PATCH v3] " Brian Norris

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=06bcea82-11d5-4dcf-8331-c073e6d9078f@infradead.org \
    --to=rdunlap@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=ardb@kernel.org \
    --cc=bp@alien8.de \
    --cc=corbet@lwn.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=len.brown@intel.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=paulmck@kernel.org \
    --cc=pavel@kernel.org \
    --cc=rafael@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=thuth@redhat.com \
    --cc=zhangzihuan@kylinos.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox