From: "Gautham R. Shenoy" <gautham.shenoy@amd.com>
To: Dhananjay Ugwekar <Dhananjay.Ugwekar@amd.com>
Cc: mario.limonciello@amd.com, perry.yuan@amd.com, ray.huang@amd.com,
rafael@kernel.org, viresh.kumar@linaro.org,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] cpufreq/amd-pstate: Set the initial min_freq to lowest_nonlinear_freq
Date: Fri, 4 Oct 2024 14:17:48 +0530 [thread overview]
Message-ID: <Zv+rtIi5NMkWzayg@BLRRASHENOY1.amd.com> (raw)
In-Reply-To: <20241003083952.3186-3-Dhananjay.Ugwekar@amd.com>
On Thu, Oct 03, 2024 at 08:39:54AM +0000, Dhananjay Ugwekar wrote:
> According to the AMD architectural programmer's manual volume 2 [1], in
> section "17.6.4.1 CPPC_CAPABILITY_1" lowest_nonlinear_perf is described
> as "Reports the most energy efficient performance level (in terms of
> performance per watt). Above this threshold, lower performance levels
> generally result in increased energy efficiency. Reducing performance
> below this threshold does not result in total energy savings for a given
> computation, although it reduces instantaneous power consumption". So
> lowest_nonlinear_perf is the most power efficient performance level, and
> going below that would lead to a worse performance/watt.
>
> Also, setting the minimum frequency to lowest_nonlinear_freq (instead of
> lowest_freq) allows the CPU to idle at a higher frequency which leads
> to more time being spent in a deeper idle state (as trivial idle tasks
> are completed sooner). This has shown a power benefit in some systems,
> in other systems, power consumption has increased but so has the
> throughput/watt.
>
> Use the get_init_min_freq() callback to set the initial lower limit for
> amd-pstate driver to lowest_nonlinear_freq instead of lowest_freq.
>
> Link: https://www.amd.com/content/dam/amd/en/documents/processor-tech-docs/programmer-references/24593.pdf [1]
It is good enough to quote "AMD64 Architecture Programmer's Manual,
Volume 2, Revision 3.42" instead of providing a link.
Other than that,
Reviewed-by: Gautham R. Shenoy <gautham.shenoy@amd.com>
>
> Signed-off-by: Dhananjay Ugwekar <Dhananjay.Ugwekar@amd.com>
--
Thanks and Regards
gautham.
> ---
> drivers/cpufreq/amd-pstate.c | 16 +++++++++-------
> 1 file changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
> index b7a17a3ef122..f8abae9a0156 100644
> --- a/drivers/cpufreq/amd-pstate.c
> +++ b/drivers/cpufreq/amd-pstate.c
> @@ -995,13 +995,6 @@ static int amd_pstate_cpu_init(struct cpufreq_policy *policy)
> if (cpu_feature_enabled(X86_FEATURE_CPPC))
> policy->fast_switch_possible = true;
>
> - ret = freq_qos_add_request(&policy->constraints, &cpudata->req[0],
> - FREQ_QOS_MIN, policy->cpuinfo.min_freq);
> - if (ret < 0) {
> - dev_err(dev, "Failed to add min-freq constraint (%d)\n", ret);
> - goto free_cpudata1;
> - }
> -
> ret = freq_qos_add_request(&policy->constraints, &cpudata->req[1],
> FREQ_QOS_MAX, policy->cpuinfo.max_freq);
> if (ret < 0) {
> @@ -1706,6 +1699,13 @@ static int amd_pstate_epp_resume(struct cpufreq_policy *policy)
> return 0;
> }
>
> +static int amd_pstate_get_init_min_freq(struct cpufreq_policy *policy)
> +{
> + struct amd_cpudata *cpudata = policy->driver_data;
> +
> + return READ_ONCE(cpudata->lowest_nonlinear_freq);
> +}
> +
> static struct cpufreq_driver amd_pstate_driver = {
> .flags = CPUFREQ_CONST_LOOPS | CPUFREQ_NEED_UPDATE_LIMITS,
> .verify = amd_pstate_verify,
> @@ -1719,6 +1719,7 @@ static struct cpufreq_driver amd_pstate_driver = {
> .update_limits = amd_pstate_update_limits,
> .name = "amd-pstate",
> .attr = amd_pstate_attr,
> + .get_init_min_freq = amd_pstate_get_init_min_freq,
> };
>
> static struct cpufreq_driver amd_pstate_epp_driver = {
> @@ -1735,6 +1736,7 @@ static struct cpufreq_driver amd_pstate_epp_driver = {
> .set_boost = amd_pstate_set_boost,
> .name = "amd-pstate-epp",
> .attr = amd_pstate_epp_attr,
> + .get_init_min_freq = amd_pstate_get_init_min_freq,
> };
>
> static int __init amd_pstate_set_driver(int mode_idx)
> --
> 2.34.1
>
next prev parent reply other threads:[~2024-10-04 8:47 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-03 8:39 [PATCH 0/3] cpufreq/amd-pstate: Set initial min_freq to lowest_nonlinear_freq Dhananjay Ugwekar
2024-10-03 8:39 ` [PATCH 1/3] cpufreq: Add a callback to update the min_freq_req from drivers Dhananjay Ugwekar
2024-10-04 6:41 ` Gautham R. Shenoy
2024-10-04 18:17 ` Rafael J. Wysocki
2024-10-07 4:40 ` Dhananjay Ugwekar
2024-10-07 15:46 ` Rafael J. Wysocki
2024-10-07 15:48 ` Rafael J. Wysocki
2024-10-08 6:32 ` Dhananjay Ugwekar
2024-10-10 17:57 ` Rafael J. Wysocki
2024-10-10 7:35 ` Viresh Kumar
2024-10-10 9:54 ` Dhananjay Ugwekar
2024-10-10 10:07 ` Viresh Kumar
2024-10-03 8:39 ` [PATCH 2/3] cpufreq/amd-pstate: Set the initial min_freq to lowest_nonlinear_freq Dhananjay Ugwekar
2024-10-04 8:47 ` Gautham R. Shenoy [this message]
2024-10-03 8:39 ` [PATCH 3/3] cpufreq/amd-pstate: Cleanup the old min_freq qos request remnants Dhananjay Ugwekar
2024-10-03 19:23 ` [PATCH 0/3] cpufreq/amd-pstate: Set initial min_freq to lowest_nonlinear_freq Mario Limonciello
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Zv+rtIi5NMkWzayg@BLRRASHENOY1.amd.com \
--to=gautham.shenoy@amd.com \
--cc=Dhananjay.Ugwekar@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mario.limonciello@amd.com \
--cc=perry.yuan@amd.com \
--cc=rafael@kernel.org \
--cc=ray.huang@amd.com \
--cc=viresh.kumar@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox