lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAJZ5v0h9hz51=wa0DvdyUti4GtQ0UaBorFfDRh_yisSpeYMMkA@mail.gmail.com>
Date: Wed, 29 Oct 2025 13:52:13 +0100
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Riwen Lu <luriwen@...inos.cn>
Cc: rafael@...nel.org, pavel@...nel.org, lenb@...nel.org, 
	linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org, 
	xiongxin <xiongxin@...inos.cn>
Subject: Re: [PATCH v1] PM: suspend: Make pm_test delay interruptible by
 wakeup events

On Fri, Oct 17, 2025 at 11:53 AM Riwen Lu <luriwen@...inos.cn> wrote:
>
> 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 complte when wakeup events
> are detected.
>
> Additionally, using msleep() instead of mdelay() avoids potential soft
> lockup "CPU stuck" issues when long test delays are configured.
>
> Signed-off-by: Riwen Lu <luriwen@...inos.cn>
> Signed-off-by: xiongxin <xiongxin@...inos.cn>
> ---
>  kernel/power/suspend.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
> index 4bb4686c1c08..8f022d279635 100644
> --- a/kernel/power/suspend.c
> +++ b/kernel/power/suspend.c
> @@ -344,10 +344,18 @@ 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",

The message need not be changed, it is still valid in the absence of
wakeup events.

> +               for (i = 0; i < pm_test_delay; i++) {
> +                       if (pm_wakeup_pending())
> +                               break;
> +                       msleep(1000);
> +               }

This can be rewritten as follows

              for (i = 0; i < pm_test_delay && !pm_wakeup_pending(); i++)
                      msleep(1000);

> +               if (i == pm_test_delay)
> +                       pr_info("suspend debug: Already wait %d second(s).\n",

And this isn't necessary.

>                                 pm_test_delay);
> -               mdelay(pm_test_delay * 1000);
> +
>                 return 1;
>         }
>  #endif /* !CONFIG_PM_DEBUG */
> --

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ