Re: [RFC/RFT] [PATCH v2 3/6] cpufreq: intel_pstate: Add update_util_hook for HWP

From: Srinivas Pandruvada
Date: Tue May 29 2018 - 18:20:46 EST


On Tue, 2018-05-29 at 09:37 +0200, Rafael J. Wysocki wrote:
> On Thu, May 24, 2018 at 3:47 AM, Srinivas Pandruvada
> <srinivas.pandruvada@xxxxxxxxxxxxxxx> wrote:
> > When HWP dynamic boost is active then set the HWP specific update
> > util
> > hook.
> >
> > Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@xxxxxxxxxxx
> > .com>
>
> Splitting this patch out of the next one is sort of artificial.
I will merge to the patch where the hwp_boost is getting used.

Thanks,
Srinivas

>
> > ---
> > Âdrivers/cpufreq/intel_pstate.c | 21 +++++++++++++++++----
> > Â1 file changed, 17 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/cpufreq/intel_pstate.c
> > b/drivers/cpufreq/intel_pstate.c
> > index 6ad46e07cad6..382160570b5f 100644
> > --- a/drivers/cpufreq/intel_pstate.c
> > +++ b/drivers/cpufreq/intel_pstate.c
> > @@ -291,6 +291,7 @@ static struct pstate_funcs pstate_funcs
> > __read_mostly;
> >
> > Âstatic int hwp_active __read_mostly;
> > Âstatic bool per_cpu_limits __read_mostly;
> > +static bool hwp_boost __read_mostly;
>
> Because of this, among other things.
>
> >
> > Âstatic struct cpufreq_driver *intel_pstate_driver __read_mostly;
> >
> > @@ -1461,6 +1462,11 @@ static inline bool
> > intel_pstate_hwp_boost_down(struct cpudata *cpu)
> > ÂÂÂÂÂÂÂÂreturn false;
> > Â}
> >
> > +static inline void intel_pstate_update_util_hwp(struct
> > update_util_data *data,
> > +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂu64 time, unsigned
> > int flags)
> > +{
> > +}
> > +
> > Âstatic inline void intel_pstate_calc_avg_perf(struct cpudata *cpu)
> > Â{
> > ÂÂÂÂÂÂÂÂstruct sample *sample = &cpu->sample;
> > @@ -1764,7 +1770,7 @@ static void
> > intel_pstate_set_update_util_hook(unsigned int cpu_num)
> > Â{
> > ÂÂÂÂÂÂÂÂstruct cpudata *cpu = all_cpu_data[cpu_num];
> >
> > -ÂÂÂÂÂÂÂif (hwp_active)
> > +ÂÂÂÂÂÂÂif (hwp_active && !hwp_boost)
> > ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂreturn;
> >
> > ÂÂÂÂÂÂÂÂif (cpu->update_util_set)
> > @@ -1772,8 +1778,12 @@ static void
> > intel_pstate_set_update_util_hook(unsigned int cpu_num)
> >
> > ÂÂÂÂÂÂÂÂ/* Prevent intel_pstate_update_util() from using stale
> > data. */
> > ÂÂÂÂÂÂÂÂcpu->sample.time = 0;
> > -ÂÂÂÂÂÂÂcpufreq_add_update_util_hook(cpu_num, &cpu->update_util,
> > -ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂintel_pstate_update_util);
> > +ÂÂÂÂÂÂÂif (hwp_active)
> > +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂcpufreq_add_update_util_hook(cpu_num, &cpu-
> > >update_util,
> > +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂintel_pstate_update_ut
> > il_hwp);
> > +ÂÂÂÂÂÂÂelse
> > +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂcpufreq_add_update_util_hook(cpu_num, &cpu-
> > >update_util,
> > +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂintel_pstate_update_ut
> > il);
> > ÂÂÂÂÂÂÂÂcpu->update_util_set = true;
> > Â}
> >
> > @@ -1885,8 +1895,11 @@ static int intel_pstate_set_policy(struct
> > cpufreq_policy *policy)
> > ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂintel_pstate_set_update_util_hook(policy->cpu);
> > ÂÂÂÂÂÂÂÂ}
> >
> > -ÂÂÂÂÂÂÂif (hwp_active)
> > +ÂÂÂÂÂÂÂif (hwp_active) {
> > +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂif (!hwp_boost)
> > +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂintel_pstate_clear_update_util_hook(policy-
> > >cpu);
> > ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂintel_pstate_hwp_set(policy->cpu);
> > +ÂÂÂÂÂÂÂ}
> >
> > ÂÂÂÂÂÂÂÂmutex_unlock(&intel_pstate_limits_lock);
> >
> > --
> > 2.13.6
> >