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: <CAJZ5v0j257Pomf0_gPdUfdgmxo6H9oV+jrp+_y_UC4G9kf1cNg@mail.gmail.com>
Date: Mon, 29 Dec 2025 14:32:09 +0100
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: luriwen <luriwen@...inos.cn>
Cc: "Rafael J. Wysocki" <rafael@...nel.org>, Linux PM <linux-pm@...r.kernel.org>, 
	LKML <linux-kernel@...r.kernel.org>, 
	Sebastian Reichel <sebastian.reichel@...labora.com>
Subject: Re: [PATCH v1] PM: sleep: Fix suspend_test() at the TEST_CORE level

On Mon, Dec 29, 2025 at 3:31 AM luriwen <luriwen@...inos.cn> wrote:
>
> 在 2025/12/26 21:50, Rafael J. Wysocki 写道:
> > From: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> >
> > 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@...labora.com>
> > Closes: https://lore.kernel.org/linux-pm/aUsAk0k1N9hw8IkY@venus/
> > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> > ---
> >   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);
> > +             }
>
> Maybe this can be rewritten as follows
>
>                 for (i = 0; i < pm_test_delay && !pm_wakeup_pending(); i++)
>                         level == TEST_CORE ? mdelay(1000) : msleep(1000);

Not really, the current trend is to avoid the ternary operator.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ