lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240702171515.6780-2-mario.limonciello@amd.com>
Date: Tue, 2 Jul 2024 12:15:15 -0500
From: Mario Limonciello <mario.limonciello@....com>
To: "Gautham R . Shenoy" <gautham.shenoy@....com>
CC: Meng Li <li.meng@....com>, Perry Yuan <perry.yuan@....com>, "open list:AMD
 PSTATE DRIVER" <linux-pm@...r.kernel.org>, open list
	<linux-kernel@...r.kernel.org>, Dhananjay Ugwekar
	<Dhananjay.Ugwekar@....com>, Mario Limonciello <mario.limonciello@....com>
Subject: [PATCH 2/2] cpufreq/amd-pstate-ut: Don't fail boost test case if CPB isn't supported

cpudata->boost_supported will only be configured when a CPU actually
supports core performance boost. Add an extra guard into the check
to ensure it only runs when CPB is present.

Fixes: 14eb1c96e3a3 ("cpufreq: amd-pstate: Add test module for amd-pstate driver")
Signed-off-by: Mario Limonciello <mario.limonciello@....com>
---
 drivers/cpufreq/amd-pstate-ut.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/cpufreq/amd-pstate-ut.c b/drivers/cpufreq/amd-pstate-ut.c
index b7318669485e..b011c729fcba 100644
--- a/drivers/cpufreq/amd-pstate-ut.c
+++ b/drivers/cpufreq/amd-pstate-ut.c
@@ -232,21 +232,21 @@ static void amd_pstate_ut_check_freq(u32 index)
 			goto skip_test;
 		}
 
-		if (cpudata->boost_supported) {
-			if ((policy->max == cpudata->max_freq) ||
-					(policy->max == nominal_freq_khz))
-				amd_pstate_ut_cases[index].result = AMD_PSTATE_UT_RESULT_PASS;
-			else {
+		if (cpu_feature_enabled(X86_FEATURE_CPB)) {
+			if (!cpudata->boost_supported) {
+				amd_pstate_ut_cases[index].result = AMD_PSTATE_UT_RESULT_FAIL;
+				pr_err("%s cpu%d must support boost!\n", __func__, cpu);
+				goto skip_test;
+			}
+			if ((policy->max != cpudata->max_freq) &&
+			    (policy->max != nominal_freq_khz)) {
 				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,
 					nominal_freq_khz);
 				goto skip_test;
 			}
-		} else {
-			amd_pstate_ut_cases[index].result = AMD_PSTATE_UT_RESULT_FAIL;
-			pr_err("%s cpu%d must support boost!\n", __func__, cpu);
-			goto skip_test;
+			amd_pstate_ut_cases[index].result = AMD_PSTATE_UT_RESULT_PASS;
 		}
 		cpufreq_cpu_put(policy);
 	}
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ