Message ID | 20250205112523.201101-4-dhananjay.ugwekar@amd.com (mailing list archive) |
---|---|
State | New |
Delegated to: | Mario Limonciello |
Headers | show |
Series | cpufreq/amd-pstate: Fixes and optimizations | expand |
On 2/5/2025 05:25, Dhananjay Ugwekar wrote: > Instead of setting a fixed floor at lowest_nonlinear_perf, use the > min_limit_perf value, so that it gives the user the freedom to lower the > floor further. > > There are two minimum frequency/perf limits that we need to consider in > the adjust_perf callback. One provided by schedutil i.e. the sg_cpu->bw_min > value passed in _min_perf arg, another is the effective value of > min_freq_qos request that is updated in cpudata->min_limit_perf. Modify the > code to use the bigger of these two values. > > Signed-off-by: Dhananjay Ugwekar <dhananjay.ugwekar@amd.com> Reviewed-by: Mario Limonciello <mario.limonciello@amd.com> I'll queue this for 6.15. > --- > drivers/cpufreq/amd-pstate.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c > index 9dc3933bc326..a23fb78a442b 100644 > --- a/drivers/cpufreq/amd-pstate.c > +++ b/drivers/cpufreq/amd-pstate.c > @@ -672,7 +672,7 @@ static void amd_pstate_adjust_perf(unsigned int cpu, > unsigned long capacity) > { > unsigned long max_perf, min_perf, des_perf, > - cap_perf, lowest_nonlinear_perf; > + cap_perf, min_limit_perf; > struct cpufreq_policy *policy = cpufreq_cpu_get(cpu); > struct amd_cpudata *cpudata; > > @@ -684,20 +684,20 @@ static void amd_pstate_adjust_perf(unsigned int cpu, > if (policy->min != cpudata->min_limit_freq || policy->max != cpudata->max_limit_freq) > amd_pstate_update_min_max_limit(policy); > > - > cap_perf = READ_ONCE(cpudata->highest_perf); > - lowest_nonlinear_perf = READ_ONCE(cpudata->lowest_nonlinear_perf); > + min_limit_perf = READ_ONCE(cpudata->min_limit_perf); > > des_perf = cap_perf; > if (target_perf < capacity) > des_perf = DIV_ROUND_UP(cap_perf * target_perf, capacity); > > - min_perf = READ_ONCE(cpudata->lowest_perf); > if (_min_perf < capacity) > min_perf = DIV_ROUND_UP(cap_perf * _min_perf, capacity); > + else > + min_perf = cap_perf; > > - if (min_perf < lowest_nonlinear_perf) > - min_perf = lowest_nonlinear_perf; > + if (min_perf < min_limit_perf) > + min_perf = min_limit_perf; > > max_perf = cpudata->max_limit_perf; > if (max_perf < min_perf)
diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index 9dc3933bc326..a23fb78a442b 100644 --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -672,7 +672,7 @@ static void amd_pstate_adjust_perf(unsigned int cpu, unsigned long capacity) { unsigned long max_perf, min_perf, des_perf, - cap_perf, lowest_nonlinear_perf; + cap_perf, min_limit_perf; struct cpufreq_policy *policy = cpufreq_cpu_get(cpu); struct amd_cpudata *cpudata; @@ -684,20 +684,20 @@ static void amd_pstate_adjust_perf(unsigned int cpu, if (policy->min != cpudata->min_limit_freq || policy->max != cpudata->max_limit_freq) amd_pstate_update_min_max_limit(policy); - cap_perf = READ_ONCE(cpudata->highest_perf); - lowest_nonlinear_perf = READ_ONCE(cpudata->lowest_nonlinear_perf); + min_limit_perf = READ_ONCE(cpudata->min_limit_perf); des_perf = cap_perf; if (target_perf < capacity) des_perf = DIV_ROUND_UP(cap_perf * target_perf, capacity); - min_perf = READ_ONCE(cpudata->lowest_perf); if (_min_perf < capacity) min_perf = DIV_ROUND_UP(cap_perf * _min_perf, capacity); + else + min_perf = cap_perf; - if (min_perf < lowest_nonlinear_perf) - min_perf = lowest_nonlinear_perf; + if (min_perf < min_limit_perf) + min_perf = min_limit_perf; max_perf = cpudata->max_limit_perf; if (max_perf < min_perf)
Instead of setting a fixed floor at lowest_nonlinear_perf, use the min_limit_perf value, so that it gives the user the freedom to lower the floor further. There are two minimum frequency/perf limits that we need to consider in the adjust_perf callback. One provided by schedutil i.e. the sg_cpu->bw_min value passed in _min_perf arg, another is the effective value of min_freq_qos request that is updated in cpudata->min_limit_perf. Modify the code to use the bigger of these two values. Signed-off-by: Dhananjay Ugwekar <dhananjay.ugwekar@amd.com> --- drivers/cpufreq/amd-pstate.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)