Skip to content

Commit 50c9bb3

Browse files
Zihuan Zhangrafaeljw
authored andcommitted
PM: hibernate: add configurable delay for pm_test
Turn the default 5 second test delay for hibernation 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 for suspend, so add an analogous one for 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> Reviewed-by: Randy Dunlap <rdunlap@infradead.org> Link: https://patch.msgid.link/20250507063520.419635-1-zhangzihuan@kylinos.cn [ rjw: Subject and changelog edits ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent f0050a3 commit 50c9bb3

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1831,6 +1831,13 @@
18311831
lz4: Select LZ4 compression algorithm to
18321832
compress/decompress hibernation image.
18331833

1834+
hibernate.pm_test_delay=
1835+
[HIBERNATION]
1836+
Sets the number of seconds to remain in a hibernation test
1837+
mode before resuming the system (see
1838+
/sys/power/pm_test). Only available when CONFIG_PM_DEBUG
1839+
is set. Default value is 5.
1840+
18341841
highmem=nn[KMG] [KNL,BOOT,EARLY] forces the highmem zone to have an exact
18351842
size of <nn>. This works even on boxes that have no
18361843
highmem otherwise. This also works to reduce highmem

kernel/power/hibernate.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,15 @@ bool system_entering_hibernation(void)
133133
EXPORT_SYMBOL(system_entering_hibernation);
134134

135135
#ifdef CONFIG_PM_DEBUG
136+
static unsigned int pm_test_delay = 5;
137+
module_param(pm_test_delay, uint, 0644);
138+
MODULE_PARM_DESC(pm_test_delay,
139+
"Number of seconds to wait before resuming from hibernation test");
136140
static void hibernation_debug_sleep(void)
137141
{
138-
pr_info("debug: Waiting for 5 seconds.\n");
139-
mdelay(5000);
142+
pr_info("hibernation debug: Waiting for %d second(s).\n",
143+
pm_test_delay);
144+
mdelay(pm_test_delay * 1000);
140145
}
141146

142147
static int hibernation_test(int level)

0 commit comments

Comments
 (0)