Re: [PATCH v3 10/18] cpufreq/amd-pstate-ut: Run on all of the correct CPUs
From: Gautham R. Shenoy
Date: Wed Feb 19 2025 - 00:27:09 EST
On Mon, Feb 17, 2025 at 04:06:59PM -0600, Mario Limonciello wrote:
> From: Mario Limonciello <mario.limonciello@xxxxxxx>
>
> 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.
>
> Signed-off-by: Mario Limonciello <mario.limonciello@xxxxxxx>
LGTM
Reviewed-by: Gautham R. Shenoy <gautham.shenoy@xxxxxxx>
--
Thanks and Regards
gautham.
> ---
> v3:
> * Only check online CPUs
> * Update commit message
> ---
> drivers/cpufreq/amd-pstate-ut.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/cpufreq/amd-pstate-ut.c b/drivers/cpufreq/amd-pstate-ut.c
> index 028527a0019ca..3a541780f374f 100644
> --- a/drivers/cpufreq/amd-pstate-ut.c
> +++ b/drivers/cpufreq/amd-pstate-ut.c
> @@ -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) &&
> --
> 2.43.0
>