Skip to content

Commit a10ad1b

Browse files
Riwen Lurafaeljw
authored andcommitted
PM: suspend: Make pm_test delay interruptible by wakeup events
Modify the suspend_test() function to allow the test delay to be interrupted by wakeup events. This improves the responsiveness of the system during suspend testing when wakeup events occur, allowing the suspend process to proceed without waiting for the full test delay to complete when wakeup events are detected. Additionally, using msleep() instead of mdelay() avoids potential soft lockup "CPU stuck" issues when long test delays are configured. Co-developed-by: xiongxin <xiongxin@kylinos.cn> Signed-off-by: xiongxin <xiongxin@kylinos.cn> Signed-off-by: Riwen Lu <luriwen@kylinos.cn> [ rjw: Changelog edits ] Link: https://patch.msgid.link/20251113012638.1362013-1-luriwen@kylinos.cn Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 7b9725b commit a10ad1b

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

kernel/power/suspend.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,10 +344,14 @@ MODULE_PARM_DESC(pm_test_delay,
344344
static int suspend_test(int level)
345345
{
346346
#ifdef CONFIG_PM_DEBUG
347+
int i;
348+
347349
if (pm_test_level == level) {
348350
pr_info("suspend debug: Waiting for %d second(s).\n",
349351
pm_test_delay);
350-
mdelay(pm_test_delay * 1000);
352+
for (i = 0; i < pm_test_delay && !pm_wakeup_pending(); i++)
353+
msleep(1000);
354+
351355
return 1;
352356
}
353357
#endif /* !CONFIG_PM_DEBUG */

0 commit comments

Comments
 (0)