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: <CAJZ5v0iVPDY5wvz0KY7aHJXnX=7ZCMbqi1G5mWTYdYsi2xf9+g@mail.gmail.com>
Date: Fri, 23 Jan 2026 21:46:14 +0100
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Christian Loehle <christian.loehle@....com>
Cc: "Rafael J. Wysocki" <rafael@...nel.org>, Linux PM <linux-pm@...r.kernel.org>, 
	LKML <linux-kernel@...r.kernel.org>, Doug Smythies <dsmythies@...us.net>
Subject: Re: [PATCH v1 1/5] cpuidle: governors: teo: Avoid selecting states
 with zero-size bins

On Wed, Jan 21, 2026 at 2:10 PM Christian Loehle
<christian.loehle@....com> wrote:
>
> On 1/14/26 19:44, Rafael J. Wysocki wrote:
> > From: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> >
> > If the last two enabled idle states have the same target residency which
> > is at least equal to TICK_NSET, teo may select the next-to-last one even
>
> s/TICK_NSET/TICK_NSEC

Yup, thanks!

> > though the size of that state's bin is 0, which is confusing.
> >
> > Prevent that from happening by adding a target residency check to the
> > relevant code path.
> >
> > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> > ---
> >  drivers/cpuidle/governors/teo.c |   10 ++++++++++
> >  1 file changed, 10 insertions(+)
> >
> > --- a/drivers/cpuidle/governors/teo.c
> > +++ b/drivers/cpuidle/governors/teo.c
> > @@ -388,6 +388,15 @@ static int teo_select(struct cpuidle_dri
> >                       while (min_idx < idx &&
> >                              drv->states[min_idx].target_residency_ns < TICK_NSEC)
> >                               min_idx++;
> > +
> > +                     /*
> > +                      * Avoid selecting a state with a lower index, but with
> > +                      * the same target residency as the current candidate
> > +                      * one.
> > +                      */
> > +                     if (drv->states[min_idx].target_residency_ns ==
> > +                                     drv->states[idx].target_residency_ns)
>
> We need to check that min_idx isn't disabled though, otherwise we now skip a
> potential (enabled) idx==1 if min_idx==2 and min_idx is disabled.

Not really because idx is the current candidate state and it is
enabled.  We'll use idx if this check is true, not min_idx.

So I think I only need to fix the typo above.

> Other than that LGTM and with that check and the nit above:
>
> Reviewed-by: Christian Loehle <christian.loehle@....com>

Thanks!

> > +                             goto constraint;
> >               }
> >
> >               /*
> > @@ -410,6 +419,7 @@ static int teo_select(struct cpuidle_dri
> >               }
> >       }
> >
> > +constraint:
> >       /*
> >        * If there is a latency constraint, it may be necessary to select an
> >        * idle state shallower than the current candidate one.
> >
> >
> >
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ