From: Dhananjay Ugwekar <Dhananjay.Ugwekar@amd.com>
To: <gautham.shenoy@amd.com>, <mario.limonciello@amd.com>,
<perry.yuan@amd.com>, <ray.huang@amd.com>, <rafael@kernel.org>,
<viresh.kumar@linaro.org>
Cc: <linux-pm@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
"Dhananjay Ugwekar" <Dhananjay.Ugwekar@amd.com>
Subject: [PATCH 0/3] cpufreq/amd-pstate: Set initial min_freq to lowest_nonlinear_freq
Date: Thu, 3 Oct 2024 08:39:50 +0000 [thread overview]
Message-ID: <20241003083952.3186-1-Dhananjay.Ugwekar@amd.com> (raw)
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.
Our objective here is to update the initial lower frequency limit to
lowest_nonlinear_freq, while allowing the user to later update the lower
limit to anywhere between lowest_freq to highest_freq for the platform.
Currently, amd-pstate driver sets the cpudata->req[0] qos_request (lets
call it amd_pstate_req) to the lowest_freq value at init time, and
cpufreq.c sets the min_freq_req to 0 (which also gets resolved to the
lowest_freq eventually). Writing to scaling_min_freq, only updates
min_freq_req qos_request, while the amd_pstate_req always stays same as the
initial value. This leads to the amd_pstate_req becoming the hard lower
limit (due to the nature of priority lists used to manage the min_freq
requests). Hence, if we update the amd_pstate_req to lowest_nonlinear_freq
from amd-pstate driver code, user will never be able to set
scaling_min_freq to a value lower than that.
This problem is occurring due to the existence of two different sources
of lower frequency limits, i.e. cpufreq.c and amd-pstate.c. Removing the
cpudata->req[0], and updating the min_freq_req itself from amd-pstate
driver at init time fixes this issue and gives flexibility to the driver
code as well as allows the user to independently update the lower limit
later on.
So, add a callback in cpufreq_driver to update the min_freq_req from
cpufreq drivers and use it to set the initial min_freq to
lowest_nonlinear_freq for amd-pstate driver (active, passive and guided
modes) and cleanup the old min_freq qos request code.
Link: https://www.amd.com/content/dam/amd/en/documents/processor-tech-docs/programmer-references/24593.pdf [1]
Dhananjay Ugwekar (3):
cpufreq: Add a callback to update the min_freq_req from drivers
cpufreq/amd-pstate: Set the initial min_freq to lowest_nonlinear_freq
cpufreq/amd-pstate: Cleanup the old min_freq qos request remnants
drivers/cpufreq/amd-pstate.c | 35 +++++++++++++++++------------------
drivers/cpufreq/amd-pstate.h | 4 ++--
drivers/cpufreq/cpufreq.c | 6 +++++-
include/linux/cpufreq.h | 6 ++++++
4 files changed, 30 insertions(+), 21 deletions(-)
--
2.34.1
next reply other threads:[~2024-10-03 8:42 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-03 8:39 Dhananjay Ugwekar [this message]
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
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=20241003083952.3186-1-Dhananjay.Ugwekar@amd.com \
--to=dhananjay.ugwekar@amd.com \
--cc=gautham.shenoy@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
all inboxes | Powered by JetHome®