]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
cpufreq/amd-pstate-ut: Run on all of the correct CPUs
authorMario Limonciello <mario.limonciello@amd.com>
Fri, 14 Feb 2025 22:33:12 +0000 (16:33 -0600)
committerMario Limonciello <mario.limonciello@amd.com>
Thu, 6 Mar 2025 19:01:25 +0000 (13:01 -0600)
If a CPU is missing a policy or one has been offlined then the unit test
is skipped for the rest of the CPUs on the system.

Instead; iterate online CPUs and skip any missing policies to allow
continuing to test the rest of them.

Reviewed-by: Gautham R. Shenoy <gautham.shenoy@amd.com>
Reviewed-by: Dhananjay Ugwekar <dhananjay.ugwekar@amd.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
drivers/cpufreq/amd-pstate-ut.c

index cd9a472e8dc3c9e86f6066ebae64135562e49456..2ab3017d7a0bbd7f05c8caaed4d1507b6916a1c3 100644 (file)
@@ -116,12 +116,12 @@ static int amd_pstate_ut_check_perf(u32 index)
        struct amd_cpudata *cpudata = NULL;
        union perf_cached cur_perf;
 
-       for_each_possible_cpu(cpu) {
+       for_each_online_cpu(cpu) {
                struct cpufreq_policy *policy __free(put_cpufreq_policy) = NULL;
 
                policy = cpufreq_cpu_get(cpu);
                if (!policy)
-                       break;
+                       continue;
                cpudata = policy->driver_data;
 
                if (get_shared_mem()) {
@@ -188,12 +188,12 @@ static int amd_pstate_ut_check_freq(u32 index)
        int cpu = 0;
        struct amd_cpudata *cpudata = NULL;
 
-       for_each_possible_cpu(cpu) {
+       for_each_online_cpu(cpu) {
                struct cpufreq_policy *policy __free(put_cpufreq_policy) = NULL;
 
                policy = cpufreq_cpu_get(cpu);
                if (!policy)
-                       break;
+                       continue;
                cpudata = policy->driver_data;
 
                if (!((policy->cpuinfo.max_freq >= cpudata->nominal_freq) &&