From: Francisco Jerez <currojerez@riseup.net>
To: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
linux-pm@vger.kernel.org
Cc: "Rafael J . Wysocki" <rafael.j.wysocki@intel.com>,
Caleb Callaway <caleb.callaway@intel.com>
Subject: Re: [PATCH] cpufreq: intel_pstate: Fix intel_pstate_get_hwp_max() for turbo disabled cases.
Date: Tue, 01 Sep 2020 11:19:22 -0700 [thread overview]
Message-ID: <87k0xdwead.fsf@riseup.net> (raw)
In-Reply-To: <81b98c58eab0bf075d9ded2154a7a88020628c80.camel@linux.intel.com>
[-- Attachment #1.1: Type: text/plain, Size: 2520 bytes --]
Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> writes:
> On Mon, 2020-08-31 at 20:02 -0700, Francisco Jerez wrote:
>> This fixes the behavior of the scaling_max_freq and scaling_min_freq
>> sysfs files in systems which had turbo disabled by the BIOS.
>>
>> Caleb noticed that the HWP is programmed to operate in the wrong
>> P-state range on his system when the CPUFREQ policy min/max frequency
>> is set via sysfs. This seems to be because in his system
>> intel_pstate_get_hwp_max() is returning the maximum turbo P-state
>> even
>> though turbo was disabled by the BIOS, which causes intel_pstate to
>> scale kHz frequencies incorrectly e.g. setting the maximum turbo
>> frequency whenever the maximum guaranteed frequency is requested via
>> sysfs.
>
> When turbo is disabled via MSR_IA32_MISC_ENABLE_TURBO_DISABLE (From
> BIOS), then no matter what we write to HWP. max, the hardware will clip
> to HWP_GUARANTEED_PERF.
>
> But it looks like this is some issue on properly disabling turbo from
> BIOS, since you observe turbo frequencies (via aperf, mperf) not just
> sysfs display issue.
>
Caleb should be able to confirm that, but my understanding is that his
system was still clocking up to the max turbo frequency despite turbo
being disabled in the BIOS and the maximum guaranteed frequency having
been specified in scaling_max_freq.
However there is a bug even in systems where the clipping you describe
is working correctly, the conversion from kHz frequency to P-state uses
a bogus scaling factor without this patch applied.
>
>
>>
>> Tested-by: Caleb Callaway <caleb.callaway@intel.com>
>> Signed-off-by: Francisco Jerez <currojerez@riseup.net>
> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
>
Thanks!
>> ---
>> drivers/cpufreq/intel_pstate.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/cpufreq/intel_pstate.c
>> b/drivers/cpufreq/intel_pstate.c
>> index e0220a6fbc69..7eb7b62bd5c4 100644
>> --- a/drivers/cpufreq/intel_pstate.c
>> +++ b/drivers/cpufreq/intel_pstate.c
>> @@ -825,7 +825,7 @@ static void intel_pstate_get_hwp_max(unsigned int
>> cpu, int *phy_max,
>>
>> rdmsrl_on_cpu(cpu, MSR_HWP_CAPABILITIES, &cap);
>> WRITE_ONCE(all_cpu_data[cpu]->hwp_cap_cached, cap);
>> - if (global.no_turbo)
>> + if (global.no_turbo || global.turbo_disabled)
>> *current_max = HWP_GUARANTEED_PERF(cap);
>> else
>> *current_max = HWP_HIGHEST_PERF(cap);
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]
next prev parent reply other threads:[~2020-09-01 18:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-01 3:02 [PATCH] cpufreq: intel_pstate: Fix intel_pstate_get_hwp_max() for turbo disabled cases Francisco Jerez
2020-09-01 15:48 ` Srinivas Pandruvada
2020-09-01 17:59 ` Rafael J. Wysocki
2020-09-01 18:19 ` Francisco Jerez [this message]
2020-09-01 18:56 ` Callaway, Caleb
2020-09-01 19:30 ` Srinivas Pandruvada
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=87k0xdwead.fsf@riseup.net \
--to=currojerez@riseup.net \
--cc=caleb.callaway@intel.com \
--cc=linux-pm@vger.kernel.org \
--cc=rafael.j.wysocki@intel.com \
--cc=srinivas.pandruvada@linux.intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.