Re: [PATCH v4 03/19] cpufreq/amd-pstate: Drop min and max cached frequencies

Dhananjay Ugwekar
2025-02-24T04:51:58Z

On 2/20/2025 2:32 AM, Mario Limonciello wrote:
> From: Mario Limonciello <mario.limonciello@amd.com>
>
> Use the perf_to_freq helpers to calculate this on the fly.
> As the members are no longer cached add an extra check into
> amd_pstate_update_min_max_limit().

Actually, we are adding the check in "amd_pstate_epp_update_limit"
and we are adding it to avoid unnecessary calls to
"amd_pstate_update_min_max_limit" if the cached limits are up to date.

Apart from that the patch looks good to me,

Reviewed-by: Dhananjay Ugwekar <dhananjay.ugwekar@amd.com>

Thanks,
Dhananjay

>
> Reviewed-by: Gautham R. Shenoy <gautham.shenoy@amd.com>
> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
> ---
> v4:
> * Avoid some unnecessary changes to amd_pstate_init_freq()
> * Add tag
> v3:
> * Fix calc error for min_freq
> v2:
> * Keep cached limits
> ---
> drivers/cpufreq/amd-pstate-ut.c | 14 +++++------
> drivers/cpufreq/amd-pstate.c | 43 +++++++++------------------------
> drivers/cpufreq/amd-pstate.h | 9 ++-----
> 3 files changed, 20 insertions(+), 46 deletions(-)
>
[Snip]> @@ -1550,7 +1528,8 @@ static int amd_pstate_epp_update_limit(struct cpufreq_policy *policy)
> struct amd_cpudata *cpudata = policy->driver_data;
> u8 epp;
>
> - amd_pstate_update_min_max_limit(policy);
> + if (policy->min != cpudata->min_limit_freq || policy->max != cpudata->max_limit_freq)
> + amd_pstate_update_min_max_limit(policy);
>
> if (cpudata->policy == CPUFREQ_POLICY_PERFORMANCE)
> epp = 0;
[Snip]