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:   Sat, 16 Sep 2023 20:25:26 +0100
From:   Qais Yousef <qyousef@...alina.io>
To:     Dietmar Eggemann <dietmar.eggemann@....com>
Cc:     Vincent Guittot <vincent.guittot@...aro.org>,
        "Rafael J. Wysocki" <rafael@...nel.org>,
        Viresh Kumar <viresh.kumar@...aro.org>,
        Ingo Molnar <mingo@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        linux-kernel@...r.kernel.org, linux-pm@...r.kernel.org,
        Lukasz Luba <lukasz.luba@....com>
Subject: Re: [PATCH 2/4] sched: cpufreq: Fix apply_dvfs_headroom() escaping
 uclamp constraints

On 09/12/23 15:40, Dietmar Eggemann wrote:
> On 10/09/2023 19:46, Qais Yousef wrote:
> > On 09/08/23 16:30, Vincent Guittot wrote:
> > 
> 
> [...]
> 
> >>>> above 512 whatever the current (720)  formula or your proposal (608).
> >>>> In the case of uclamp, it should be applied after having been scaled
> >>>> by irq time.
> >>>
> >>> I lost you a bit here. I'm not sure how you reached the 720 and 608 numbers.
> >>
> >> My bad, I finally decided to use an irq pressure of 128 in my
> >> calculation but forgot to change the value in my email
> >>
> >>>
> >>> So the way I'm proposing it here
> >>>
> >>>         util = cfs + rt + dvfs_headroom(cfs+rt) = 800 + 0.25 * 800 = 1000
> >>>         util = uclamp_rq_util_with(rq, util, NULL) = 512
> >>>         util = scale_rq_capacity(512, 256, 1024) = 0.75 * 512 = 384
> >>>         util += dvfs_headroom(irq) = 384 + 256 + 0.25 * 256 = 704
> >>>         util += dvfs_headroom(dl_bw) = 704
> >>>
> >>>>
> >>>> So we should have reported utilization of 720 with a bandwidth
> >>>> requirement of 512 and then cpufreq can applies its headroom if needed
> >>>
> >>> The key part I'm changing is this
> >>>
> >>>         util = cfs + rt + dvfs_headroom(cfs+rt) = 800 + 0.25 * 800 = 1000
> >>>         util = uclamp_rq_util_with(rq, util, NULL) = 512
> >>>
> >>> Before we had (assume irq, rt and dl are 0 for simplicity and a single task is
> >>> running)
> >>>
> >>>         util = cfs = 800
> >>>         util = uclamp_rq_util_with(rq, util, NULL) = 512
> >>>         util = dvfs_headroom(util) = 512 * 0.25 * 512 = 640
> >>>
> >>> So we are running higher than we are allowed to. So applying the headroom
> >>> after taking uclamp constraints into account is the problem.
> 
> I'm not sure I understood all the example math in this thread correctly:
> 
> Examples:
> 
> irq = 128 or 256
> 
> util = 800 uclamp = 512
> 
> 
> --- current code:
> 
> ((util_cfs + util_rt) * ((max - irq) / max) + irq + dl_bw) * scale
> 
> <- uclamped(cfs+rt) ->
> 
> <--               scale_irq_capacity()                  -->|<-- map_util_perf() 
>                                                                / (headroom())  
> 
> irq = 128: (512 * (1024 - 128) / 1024 + 128 + 0) * 1.25 = 576 * 1.25 = 720
> 
> irq = 256: (512 * (1024 - 256) / 1024 + 256 + 0) * 1.25 = 640 * 1.25 = 800
> 
> 
> --- new approach:
> 
> irq = 128: (512 * (1024 - 128) / 1024 + 128 + 0.25 * 128)            = 608
> 
> irq = 256: (512 * (1024 - 256) / 1024 + 256 + 0.25 * 256)            = 704
> 
>             <->
>             uclamped(cfs+rt+headroom(cfs+rt))
> 
>             <- scale_irq_capacity() ->
> 
>             <--               headroom(irq) ?        -->
> 
> 
> Is the correct?

Yes, this is my understanding too. But I'm not sure anymore as it seems I'm
missing something from what Vincent is saying.


Thanks!

--
Qais Yousef

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ