From: Gautham R.Shenoy <gautham.shenoy@amd.com>
To: Mario Limonciello <mario.limonciello@amd.com>,
Borislav Petkov <bp@alien8.de>, Perry Yuan <perry.yuan@amd.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>,
"Dave Hansen" <dave.hansen@linux.intel.com>,
"maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)"
<x86@kernel.org>, "H . Peter Anvin" <hpa@zytor.com>,
Huang Rui <ray.huang@amd.com>,
"Rafael J . Wysocki" <rafael@kernel.org>,
Viresh Kumar <viresh.kumar@linaro.org>,
Nikolay Borisov <nik.borisov@suse.com>,
"Peter Zijlstra" <peterz@infradead.org>,
"open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)"
<linux-kernel@vger.kernel.org>,
"open list:AMD PSTATE DRIVER" <linux-pm@vger.kernel.org>
Subject: Re: [PATCH 2/2] cpufreq: amd-pstate: Use amd_get_highest_perf() to lookup perf values
Date: Thu, 27 Jun 2024 20:17:58 +0530 [thread overview]
Message-ID: <87frsymogx.fsf@BLR-5CG11610CF.amd.com> (raw)
In-Reply-To: <b0682b62-a690-4776-b2bf-444b6838cb05@amd.com>
Mario Limonciello <mario.limonciello@amd.com> writes:
> On 6/27/2024 00:12, Gautham R.Shenoy wrote:
[..snip..]
>>
>>> - return CPPC_HIGHEST_PERF_MAX;
>>> + /*
>>> + * For AMD CPUs with Family ID 19H and Model ID range 0x70 to 0x7f,
>>> + * the highest performance level is set to 196.
>>> + * https://bugzilla.kernel.org/show_bug.cgi?id=218759
>>> + */
>>> + if (cpu_feature_enabled(X86_FEATURE_ZEN4)) {
>>> + switch (c->x86_model) {
>>> + case 0x70 ... 0x7f:
>>> + return CPPC_HIGHEST_PERF_PERFORMANCE;
>>> + default:
>>> + return CPPC_HIGHEST_PERF_DEFAULT;
>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>> Should this be CPPC_HIGHEST_PERF_MAX ?
>>
>> Without this patchset, this function returns 255 on Genoa (0x10-0x1f)
>> and Bergamo (0xa0-0xaf) systems. This patchset changes the return value
>> to 166.
>>
>> The acpi-cpufreq driver computes the max frequency based on the
>> boost-ratio, which is the ratio of the highest_perf (returned by this
>> function) to the nominal_perf.
>>
>> So assuming a nominal_freq of 2000Mhz, nominal_perf of 159.
>>
>> Previously the max_perf = (2000*255/159) ~ 3200Mhz
>> With this patch max_perf = (2000*166/159) ~ 2100Mhz.
>>
>> Am I missing something ?
>
> Yeah; this is exactly what I'm worried about.
>
> How does Bergamo handle amd-pstate? It should probably explode there
> too.
So amd-pstate driver calls amd_pstate_highest_perf_set() only when
hw_prefcore is set.
Thus for Genoa and Bergamo, since hw_prefcore is false, the highest_perf
is extracted from the MSR_AMD_CPPC_CAP1. See this fragment in
pstate_init_perf()
/* For platforms that do not support the preferred core feature, the
* highest_pef may be configured with 166 or 255, to avoid max frequency
* calculated wrongly. we take the AMD_CPPC_HIGHEST_PERF(cap1) value as
* the default max perf.
*/
if (cpudata->hw_prefcore)
highest_perf = amd_pstate_highest_perf_set(cpudata);
else
highest_perf = AMD_CPPC_HIGHEST_PERF(cap1);
Hence it doesn't blow up on amd-pstate. So it looks like it would be
better if the prefcore check is in the amd_get_highest_perf() function
so that it can be invoked from both acpi-cpufreq and amd-pstate drivers.
--
Thanks and Regards
gautham.
next prev parent reply other threads:[~2024-06-27 14:48 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-26 4:20 [PATCH 0/2] Fixes for wrong performance levels in acpi-cpufreq Mario Limonciello
2024-06-26 4:20 ` [PATCH 1/2] x86/cpu/amd: Clarify amd_get_highest_perf() Mario Limonciello
2024-06-26 17:14 ` Borislav Petkov
2024-06-26 18:18 ` Mario Limonciello
2024-06-27 3:00 ` Borislav Petkov
2024-06-26 4:20 ` [PATCH 2/2] cpufreq: amd-pstate: Use amd_get_highest_perf() to lookup perf values Mario Limonciello
2024-06-26 17:18 ` Borislav Petkov
2024-06-26 18:19 ` Mario Limonciello
2024-06-27 3:02 ` Borislav Petkov
2024-06-27 5:12 ` Gautham R.Shenoy
2024-06-27 5:16 ` Mario Limonciello
2024-06-27 14:47 ` Gautham R.Shenoy [this message]
2024-06-27 15:12 ` 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=87frsymogx.fsf@BLR-5CG11610CF.amd.com \
--to=gautham.shenoy@amd.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mario.limonciello@amd.com \
--cc=mingo@redhat.com \
--cc=nik.borisov@suse.com \
--cc=perry.yuan@amd.com \
--cc=peterz@infradead.org \
--cc=rafael@kernel.org \
--cc=ray.huang@amd.com \
--cc=tglx@linutronix.de \
--cc=viresh.kumar@linaro.org \
--cc=x86@kernel.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