Commit a10ad1b1 authored by Riwen Lu's avatar Riwen Lu Committed by Rafael J. Wysocki
Browse files

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: default avatarxiongxin <xiongxin@kylinos.cn>
Signed-off-by: default avatarxiongxin <xiongxin@kylinos.cn>
Signed-off-by: default avatarRiwen Lu <luriwen@kylinos.cn>
[ rjw: Changelog edits ]
Link: https://patch.msgid.link/20251113012638.1362013-1-luriwen@kylinos.cn


Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 7b9725b3
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -344,10 +344,14 @@ MODULE_PARM_DESC(pm_test_delay,
static int suspend_test(int level)
{
#ifdef CONFIG_PM_DEBUG
	int i;

	if (pm_test_level == level) {
		pr_info("suspend debug: Waiting for %d second(s).\n",
				pm_test_delay);
		mdelay(pm_test_delay * 1000);
		for (i = 0; i < pm_test_delay && !pm_wakeup_pending(); i++)
			msleep(1000);

		return 1;
	}
#endif /* !CONFIG_PM_DEBUG */