Linux Power Management development
 help / color / mirror / Atom feed
* [PATCH v3] PM: suspend: Make pm_test delay interruptible by wakeup events
@ 2025-11-13  1:26 Riwen Lu
  2025-11-14 16:11 ` Rafael J. Wysocki
  0 siblings, 1 reply; 5+ messages in thread
From: Riwen Lu @ 2025-11-13  1:26 UTC (permalink / raw)
  To: rafael, pavel, lenb; +Cc: linux-pm, linux-kernel, Riwen Lu, xiongxin

Modify the suspend_test() function to make the test delay can 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>
---
 kernel/power/suspend.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
index b4ca17c2fecf..1c2f777da367 100644
--- a/kernel/power/suspend.c
+++ b/kernel/power/suspend.c
@@ -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 */
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-12-25  9:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-13  1:26 [PATCH v3] PM: suspend: Make pm_test delay interruptible by wakeup events Riwen Lu
2025-11-14 16:11 ` Rafael J. Wysocki
2025-12-23 21:08   ` [REGRESSION] " Sebastian Reichel
2025-12-24 11:44     ` Rafael J. Wysocki
2025-12-25  9:33       ` luriwen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox