Re: [PATCH v1] PM: sleep: Fix suspend_test() at the TEST_CORE level

From: Sebastian Reichel
Date: Sat Dec 27 2025 - 09:19:01 EST


Hi,

On Fri, Dec 26, 2025 at 02:50:57PM +0100, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
>
> 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@xxxxxxxxxxxxx>
> Closes: https://lore.kernel.org/linux-pm/aUsAk0k1N9hw8IkY@venus/
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
> ---

I can confirm it fixes the issue I reported, so:

Tested-by: Sebastian Reichel <sebastian.reichel@xxxxxxxxxxxxx>

Greetings,

-- Sebastian

> kernel/power/suspend.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> --- a/kernel/power/suspend.c
> +++ b/kernel/power/suspend.c
> @@ -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 */
>
>
>

Attachment: signature.asc
Description: PGP signature