From: Dhananjay Ugwekar <Dhananjay.Ugwekar@amd.com>
To: <rafael@kernel.org>, <viresh.kumar@linaro.org>,
<gautham.shenoy@amd.com>, <mario.limonciello@amd.com>,
<perry.yuan@amd.com>, <skhan@linuxfoundation.org>,
<li.meng@amd.com>, <ray.huang@amd.com>
Cc: <linux-pm@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
"Dhananjay Ugwekar" <Dhananjay.Ugwekar@amd.com>,
David Arcari <darcari@redhat.com>
Subject: [PATCH v2 1/2] cpufreq/amd-pstate-ut: Convert nominal_freq to khz during comparisons
Date: Tue, 2 Jul 2024 08:14:13 +0000 [thread overview]
Message-ID: <20240702081413.5688-2-Dhananjay.Ugwekar@amd.com> (raw)
In-Reply-To: <20240702081413.5688-1-Dhananjay.Ugwekar@amd.com>
cpudata->nominal_freq being in MHz whereas other frequencies being in
KHz breaks the amd-pstate-ut frequency sanity check. This fixes it.
Fixes: e4731baaf294 ("cpufreq: amd-pstate: Fix the inconsistency in max frequency units")
Reported-by: David Arcari <darcari@redhat.com>
Signed-off-by: Dhananjay Ugwekar <Dhananjay.Ugwekar@amd.com>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Gautham R. Shenoy <gautham.shenoy@amd.com>
---
drivers/cpufreq/amd-pstate-ut.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/cpufreq/amd-pstate-ut.c b/drivers/cpufreq/amd-pstate-ut.c
index fc275d41d51e..66b73c308ce6 100644
--- a/drivers/cpufreq/amd-pstate-ut.c
+++ b/drivers/cpufreq/amd-pstate-ut.c
@@ -202,6 +202,7 @@ static void amd_pstate_ut_check_freq(u32 index)
int cpu = 0;
struct cpufreq_policy *policy = NULL;
struct amd_cpudata *cpudata = NULL;
+ u32 nominal_freq_khz;
for_each_possible_cpu(cpu) {
policy = cpufreq_cpu_get(cpu);
@@ -209,13 +210,14 @@ static void amd_pstate_ut_check_freq(u32 index)
break;
cpudata = policy->driver_data;
- if (!((cpudata->max_freq >= cpudata->nominal_freq) &&
- (cpudata->nominal_freq > cpudata->lowest_nonlinear_freq) &&
+ nominal_freq_khz = cpudata->nominal_freq*1000;
+ if (!((cpudata->max_freq >= nominal_freq_khz) &&
+ (nominal_freq_khz > cpudata->lowest_nonlinear_freq) &&
(cpudata->lowest_nonlinear_freq > cpudata->min_freq) &&
(cpudata->min_freq > 0))) {
amd_pstate_ut_cases[index].result = AMD_PSTATE_UT_RESULT_FAIL;
pr_err("%s cpu%d max=%d >= nominal=%d > lowest_nonlinear=%d > min=%d > 0, the formula is incorrect!\n",
- __func__, cpu, cpudata->max_freq, cpudata->nominal_freq,
+ __func__, cpu, cpudata->max_freq, nominal_freq_khz,
cpudata->lowest_nonlinear_freq, cpudata->min_freq);
goto skip_test;
}
@@ -229,13 +231,13 @@ static void amd_pstate_ut_check_freq(u32 index)
if (cpudata->boost_supported) {
if ((policy->max == cpudata->max_freq) ||
- (policy->max == cpudata->nominal_freq))
+ (policy->max == nominal_freq_khz))
amd_pstate_ut_cases[index].result = AMD_PSTATE_UT_RESULT_PASS;
else {
amd_pstate_ut_cases[index].result = AMD_PSTATE_UT_RESULT_FAIL;
pr_err("%s cpu%d policy_max=%d should be equal cpu_max=%d or cpu_nominal=%d !\n",
__func__, cpu, policy->max, cpudata->max_freq,
- cpudata->nominal_freq);
+ nominal_freq_khz);
goto skip_test;
}
} else {
--
2.34.1
next prev parent reply other threads:[~2024-07-02 8:15 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-02 8:14 [PATCH v2 0/2] AMD Pstate driver fixes Dhananjay Ugwekar
2024-07-02 8:14 ` Dhananjay Ugwekar [this message]
2024-07-02 8:14 ` [PATCH v2 2/2] cpufreq/amd-pstate: Fix the scaling_max_freq setting on shared memory CPPC systems Dhananjay Ugwekar
2024-07-02 17:49 ` Mario Limonciello
2024-09-03 17:51 ` Jones, Morgan
2024-09-03 17:54 ` Mario Limonciello
2024-09-03 20:07 ` [EXTERNAL] " Jones, Morgan
2024-09-03 20:09 ` Mario Limonciello
2024-09-03 20:51 ` Mario Limonciello
2024-09-03 20:52 ` Jones, Morgan
2024-09-03 22:21 ` Jones, Morgan
2024-09-03 22:24 ` Jones, Morgan
2024-09-04 13:57 ` Mario Limonciello
2024-09-05 15:11 ` Mario Limonciello
2024-09-05 21:09 ` Jones, Morgan
2024-09-05 21:14 ` linux-6.6.y regression on amd-pstate Mario Limonciello
2024-09-08 14:05 ` Greg Kroah-Hartman
2024-09-08 14:12 ` Christian Heusel
2024-09-08 14:29 ` Greg Kroah-Hartman
2025-07-31 20:44 ` [EXTERNAL] " Jones, Morgan
2025-08-01 12:32 ` Mario Limonciello
2024-09-03 20:52 ` [EXTERNAL] Re: [PATCH v2 2/2] cpufreq/amd-pstate: Fix the scaling_max_freq setting on shared memory CPPC systems Jones, Morgan
2024-07-03 5:46 ` Gautham R.Shenoy
2024-07-02 8:24 ` [PATCH v2 0/2] AMD Pstate driver fixes Dhananjay Ugwekar
2024-07-02 17:54 ` 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=20240702081413.5688-2-Dhananjay.Ugwekar@amd.com \
--to=dhananjay.ugwekar@amd.com \
--cc=darcari@redhat.com \
--cc=gautham.shenoy@amd.com \
--cc=li.meng@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=skhan@linuxfoundation.org \
--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®