]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
PM: sleep: Fix suspend_test() at the TEST_CORE level
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 26 Dec 2025 13:50:57 +0000 (14:50 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Sun, 28 Dec 2025 12:01:39 +0000 (13:01 +0100)
Commit a10ad1b10402 ("PM: suspend: Make pm_test delay interruptible by
wakeup events") replaced mdelay() in suspend_test() with msleep() which
does not work at the TEST_CORE test level that calls suspend_test()
while running on one CPU with interrupts off.

Address this by making suspend_test() check if the test level is
suitable for using msleep() and use mdelay() otherwise.

Fixes: a10ad1b10402 ("PM: suspend: Make pm_test delay interruptible by wakeup events")
Reported-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Closes: https://lore.kernel.org/linux-pm/aUsAk0k1N9hw8IkY@venus/
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Tested-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Link: https://patch.msgid.link/6251576.lOV4Wx5bFT@rafael.j.wysocki
kernel/power/suspend.c

index 2da4482bb6eb8da488722334b8fd3a1d02feb661..57c44268698f7fa02fa20feb47abb5bfb49906b5 100644 (file)
@@ -349,9 +349,12 @@ static int suspend_test(int level)
        if (pm_test_level == level) {
                pr_info("suspend debug: Waiting for %d second(s).\n",
                                pm_test_delay);
-               for (i = 0; i < pm_test_delay && !pm_wakeup_pending(); i++)
-                       msleep(1000);
-
+               for (i = 0; i < pm_test_delay && !pm_wakeup_pending(); i++) {
+                       if (level > TEST_CORE)
+                               msleep(1000);
+                       else
+                               mdelay(1000);
+               }
                return 1;
        }
 #endif /* !CONFIG_PM_DEBUG */