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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAB8ipk8uFReNvm2bYtegN_Nq3qqvW9X9M0xY7uEed=isrms_JQ@mail.gmail.com>
Date: Thu, 10 Apr 2025 10:55:08 +0800
From: Xuewen Yan <xuewen.yan94@...il.com>
To: Sultan Alsawaf <sultan@...neltoast.com>
Cc: Stephan Gerhold <stephan.gerhold@...aro.org>, "Rafael J. Wysocki" <rafael@...nel.org>, 
	Viresh Kumar <viresh.kumar@...aro.org>, Ingo Molnar <mingo@...hat.com>, 
	Peter Zijlstra <peterz@...radead.org>, Juri Lelli <juri.lelli@...hat.com>, 
	Vincent Guittot <vincent.guittot@...aro.org>, Dietmar Eggemann <dietmar.eggemann@....com>, 
	Steven Rostedt <rostedt@...dmis.org>, Ben Segall <bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>, 
	Valentin Schneider <vschneid@...hat.com>, Christian Loehle <christian.loehle@....com>, linux-pm@...r.kernel.org, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] cpufreq: schedutil: Don't ignore limit changes when util
 is unchanged

Hi Sultan,

On Thu, Apr 10, 2025 at 10:46 AM Sultan Alsawaf <sultan@...neltoast.com> wrote:
>
> From: Sultan Alsawaf <sultan@...neltoast.com>
>
> When utilization is unchanged, a policy limits update is ignored unless
> CPUFREQ_NEED_UPDATE_LIMITS is set. This occurs because limits_changed
> depends on the old broken behavior of need_freq_update to trigger a call
> into cpufreq_driver_resolve_freq() to evaluate the changed policy limits.
>
> After fixing need_freq_update, limit changes are ignored without
> CPUFREQ_NEED_UPDATE_LIMITS, at least until utilization changes enough to
> make map_util_freq() return something different.
>
> Fix the ignored limit changes by preserving the value of limits_changed
> until get_next_freq() is called, so limits_changed can trigger a call to
> cpufreq_driver_resolve_freq().
>
> Reported-and-tested-by: Stephan Gerhold <stephan.gerhold@...aro.org>
> Link: https://lore.kernel.org/lkml/Z_Tlc6Qs-tYpxWYb@linaro.org
> Fixes: 8e461a1cb43d6 ("cpufreq: schedutil: Fix superfluous updates caused by need_freq_update")
> Signed-off-by: Sultan Alsawaf <sultan@...neltoast.com>
> ---
>  kernel/sched/cpufreq_schedutil.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
> index 1a19d69b91ed3..f37b999854d52 100644
> --- a/kernel/sched/cpufreq_schedutil.c
> +++ b/kernel/sched/cpufreq_schedutil.c
> @@ -82,7 +82,6 @@ static bool sugov_should_update_freq(struct sugov_policy *sg_policy, u64 time)
>                 return false;
>
>         if (unlikely(sg_policy->limits_changed)) {
> -               sg_policy->limits_changed = false;
>                 sg_policy->need_freq_update = cpufreq_driver_test_flags(CPUFREQ_NEED_UPDATE_LIMITS);
>                 return true;
>         }
> @@ -171,9 +170,11 @@ static unsigned int get_next_freq(struct sugov_policy *sg_policy,
>         freq = get_capacity_ref_freq(policy);
>         freq = map_util_freq(util, freq, max);
>
> -       if (freq == sg_policy->cached_raw_freq && !sg_policy->need_freq_update)
> +       if (freq == sg_policy->cached_raw_freq && !sg_policy->limits_changed &&
> +           !sg_policy->need_freq_update)

As said in:https://lore.kernel.org/all/CAB8ipk8ARRdR8UPgLqJ3EcAzuE4KNEO=cmLNJLk6thTxdBSHWw@mail.gmail.com/

We also should add the limits_changed in the sugov_update_single_freq().

Thanks!

>                 return sg_policy->next_freq;
>
> +       sg_policy->limits_changed = false;
>         sg_policy->cached_raw_freq = freq;
>         return cpufreq_driver_resolve_freq(policy, freq);
>  }
> --
> 2.49.0
>
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ