mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Gautham R.Shenoy <gautham.shenoy@amd.com>
To: Mario Limonciello <mario.limonciello@amd.com>
Cc: Meng Li <li.meng@amd.com>, Perry Yuan <perry.yuan@amd.com>,
	"open list:AMD PSTATE DRIVER" <linux-pm@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>,
	Dhananjay Ugwekar <Dhananjay.Ugwekar@amd.com>,
	Mario Limonciello <mario.limonciello@amd.com>
Subject: Re: [PATCH 2/2] cpufreq/amd-pstate-ut: Don't fail boost test case if CPB isn't supported
Date: Wed, 3 Jul 2024 14:28:20 +0530	[thread overview]
Message-ID: <87jzi2rgwj.fsf@BLR-5CG11610CF.amd.com> (raw)
In-Reply-To: <20240702171515.6780-2-mario.limonciello@amd.com>

Hello Mario,

Mario Limonciello <mario.limonciello@amd.com> writes:

> 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@amd.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)) {

Writing a different value into
/sys/devices/system/cpu/cpuX/cpufreq/scaling_max_freq, updates the
policy->max for cpuX.

So if a user runs this test case after someone has changed the
scaling_max_freq, the test case will fail. While this is not due to your
patch, I wonder if this is valid test-case.

>  				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
--
Thanks and Regards
gautham.

  reply	other threads:[~2024-07-03  8:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-02 17:15 [PATCH 1/2] cpufreq/amd-pstate-ut: Don't check for highest perf matching on prefcore Mario Limonciello
2024-07-02 17:15 ` [PATCH 2/2] cpufreq/amd-pstate-ut: Don't fail boost test case if CPB isn't supported Mario Limonciello
2024-07-03  8:58   ` Gautham R.Shenoy [this message]
2024-07-03  8:59 ` [PATCH 1/2] cpufreq/amd-pstate-ut: Don't check for highest perf matching on prefcore Gautham R.Shenoy

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=87jzi2rgwj.fsf@BLR-5CG11610CF.amd.com \
    --to=gautham.shenoy@amd.com \
    --cc=Dhananjay.Ugwekar@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 \
    /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®