[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<CYYPR12MB8655A83FF260ADB55F40EEFD9C462@CYYPR12MB8655.namprd12.prod.outlook.com>
Date: Wed, 16 Oct 2024 04:38:10 +0000
From: "Yuan, Perry" <Perry.Yuan@....com>
To: "Limonciello, Mario" <Mario.Limonciello@....com>, "Shenoy, Gautham Ranjal"
<gautham.shenoy@....com>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-pm@...r.kernel.org" <linux-pm@...r.kernel.org>, "Ugwekar, Dhananjay"
<Dhananjay.Ugwekar@....com>
Subject: RE: [PATCH 3/4] cpufreq/amd-pstate: Use
amd_pstate_update_min_max_limit() for EPP limits
[Public]
Hi Mario,
> -----Original Message-----
> From: Limonciello, Mario <Mario.Limonciello@....com>
> Sent: Sunday, October 13, 2024 1:45 AM
> To: Shenoy, Gautham Ranjal <gautham.shenoy@....com>
> Cc: Yuan, Perry <Perry.Yuan@....com>; linux-kernel@...r.kernel.org; linux-
> pm@...r.kernel.org; Ugwekar, Dhananjay <Dhananjay.Ugwekar@....com>;
> Limonciello, Mario <Mario.Limonciello@....com>
> Subject: [PATCH 3/4] cpufreq/amd-pstate: Use
> amd_pstate_update_min_max_limit() for EPP limits
>
> When the EPP updates are set the maximum capable frequency for the CPU is
> used to set the upper limit instead of that of the policy.
>
> Adjust amd_pstate_epp_update_limit() to reuse policy calculation code from
> amd_pstate_update_min_max_limit().
>
> Signed-off-by: Mario Limonciello <mario.limonciello@....com>
> ---
> drivers/cpufreq/amd-pstate.c | 19 +++----------------
> 1 file changed, 3 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c index
> 13dec8b1e7a8..8d2541f2c74b 100644
> --- a/drivers/cpufreq/amd-pstate.c
> +++ b/drivers/cpufreq/amd-pstate.c
> @@ -1485,26 +1485,13 @@ static void amd_pstate_epp_cpu_exit(struct
> cpufreq_policy *policy) static int amd_pstate_epp_update_limit(struct
> cpufreq_policy *policy) {
> struct amd_cpudata *cpudata = policy->driver_data;
> - u32 max_perf, min_perf, min_limit_perf, max_limit_perf;
> + u32 max_perf, min_perf;
> u64 value;
> s16 epp;
>
> - if (cpudata->boost_supported && !policy->boost_enabled)
> - max_perf = READ_ONCE(cpudata->nominal_perf);
> - else
> - max_perf = READ_ONCE(cpudata->highest_perf);
> + max_perf = READ_ONCE(cpudata->highest_perf);
> min_perf = READ_ONCE(cpudata->lowest_perf);
> - max_limit_perf = div_u64(policy->max * max_perf, policy-
> >cpuinfo.max_freq);
> - min_limit_perf = div_u64(policy->min * max_perf, policy->cpuinfo.max_freq);
> -
> - if (min_limit_perf < min_perf)
> - min_limit_perf = min_perf;
> -
> - if (max_limit_perf < min_limit_perf)
> - max_limit_perf = min_limit_perf;
> -
> - WRITE_ONCE(cpudata->max_limit_perf, max_limit_perf);
> - WRITE_ONCE(cpudata->min_limit_perf, min_limit_perf);
> + amd_pstate_update_min_max_limit(policy);
>
> max_perf = clamp_t(unsigned long, max_perf, cpudata->min_limit_perf,
> cpudata->max_limit_perf);
> --
> 2.43.0
LGTM, thanks for the optimization.
Reviewed-by: Perry Yuan <perry.yuan@....com>
Best Regards.
Perry.
Powered by blists - more mailing lists