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] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 5 Oct 2023 13:35:13 +0200
From:   "Rafael J. Wysocki" <rafael@...nel.org>
To:     Ingo Molnar <mingo@...nel.org>
Cc:     Xuewen Yan <xuewen.yan@...soc.com>, rafael@...nel.org,
        viresh.kumar@...aro.org, mingo@...hat.com, peterz@...radead.org,
        vincent.guittot@...aro.org, dietmar.eggemann@....com,
        rostedt@...dmis.org, bsegall@...gle.com, mgorman@...e.de,
        bristot@...hat.com, vschneid@...hat.com, guohua.yan@...soc.com,
        qyousef@...alina.io, linux-pm@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] cpufreq: schedutil: next_freq need update when
 cpufreq_limits changed

On Thu, Oct 5, 2023 at 1:26 PM Ingo Molnar <mingo@...nel.org> wrote:
>
>
> * Xuewen Yan <xuewen.yan@...soc.com> wrote:
>
> > When cpufreq's policy is single, there is a scenario that will
> > cause sg_policy's next_freq to be unable to update.
> >
> > When the cpu's util is always max, the cpufreq will be max,
> > and then if we change the policy's scaling_max_freq to be a
> > lower freq, indeed, the sg_policy's next_freq need change to
> > be the lower freq, however, because the cpu_is_busy, the next_freq
> > would keep the max_freq.
> >
> > For example:
> > The cpu7 is single cpu:
> >
> > unisoc:/sys/devices/system/cpu/cpufreq/policy7 # while true;do done&
> > [1] 4737
> > unisoc:/sys/devices/system/cpu/cpufreq/policy7 # taskset -p 80 4737
> > pid 4737's current affinity mask: ff
> > pid 4737's new affinity mask: 80
> > unisoc:/sys/devices/system/cpu/cpufreq/policy7 # cat scaling_max_freq
> > 2301000
> > unisoc:/sys/devices/system/cpu/cpufreq/policy7 # cat scaling_cur_freq
> > 2301000
> > unisoc:/sys/devices/system/cpu/cpufreq/policy7 # echo 2171000 > scaling_max_freq
> > unisoc:/sys/devices/system/cpu/cpufreq/policy7 # cat scaling_max_freq
> > 2171000
> >
> > At this time, the sg_policy's next_freq would keep 2301000.
> >
> > To prevent the case happen, add the judgment of the need_freq_update flag.
> >
> > Signed-off-by: Xuewen Yan <xuewen.yan@...soc.com>
> > Co-developed-by: Guohua Yan <guohua.yan@...soc.com>
> > Signed-off-by: Guohua Yan <guohua.yan@...soc.com>
> > ---
> >  kernel/sched/cpufreq_schedutil.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
> > index 4492608b7d7f..458d359f5991 100644
> > --- a/kernel/sched/cpufreq_schedutil.c
> > +++ b/kernel/sched/cpufreq_schedutil.c
> > @@ -350,7 +350,8 @@ static void sugov_update_single_freq(struct update_util_data *hook, u64 time,
> >        * Except when the rq is capped by uclamp_max.
> >        */
> >       if (!uclamp_rq_is_capped(cpu_rq(sg_cpu->cpu)) &&
> > -         sugov_cpu_is_busy(sg_cpu) && next_f < sg_policy->next_freq) {
> > +         sugov_cpu_is_busy(sg_cpu) && next_f < sg_policy->next_freq &&
> > +         !sg_policy->need_freq_update) {
> >               next_f = sg_policy->next_freq;
> >
> >               /* Restore cached freq as next_freq has changed */
>
> Just wondering about the status of this fix - is it pending in
> some tree, or should we apply it to the scheduler tree?

I have not queued it up yet, so it can be applied to the scheduler tree.

Thanks!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ