Skip to content

Commit f3db6de

Browse files
committed
Merge branch 'pm-cpufreq'
* pm-cpufreq: cpufreq: intel_pstate: Implement passive mode with HWP enabled
2 parents f6235eb + f6ebbcf commit f3db6de

File tree

4 files changed

+229
-113
lines changed

4 files changed

+229
-113
lines changed

Documentation/admin-guide/pm/intel_pstate.rst

Lines changed: 43 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,13 @@ registered (see `below <status_attr_>`_).
5454
Operation Modes
5555
===============
5656

57-
``intel_pstate`` can operate in three different modes: in the active mode with
58-
or without hardware-managed P-states support and in the passive mode. Which of
59-
them will be in effect depends on what kernel command line options are used and
60-
on the capabilities of the processor.
57+
``intel_pstate`` can operate in two different modes, active or passive. In the
58+
active mode, it uses its own internal performance scaling governor algorithm or
59+
allows the hardware to do preformance scaling by itself, while in the passive
60+
mode it responds to requests made by a generic ``CPUFreq`` governor implementing
61+
a certain performance scaling algorithm. Which of them will be in effect
62+
depends on what kernel command line options are used and on the capabilities of
63+
the processor.
6164

6265
Active Mode
6366
-----------
@@ -194,10 +197,11 @@ This is the default operation mode of ``intel_pstate`` for processors without
194197
hardware-managed P-states (HWP) support. It is always used if the
195198
``intel_pstate=passive`` argument is passed to the kernel in the command line
196199
regardless of whether or not the given processor supports HWP. [Note that the
197-
``intel_pstate=no_hwp`` setting implies ``intel_pstate=passive`` if it is used
198-
without ``intel_pstate=active``.] Like in the active mode without HWP support,
199-
in this mode ``intel_pstate`` may refuse to work with processors that are not
200-
recognized by it.
200+
``intel_pstate=no_hwp`` setting causes the driver to start in the passive mode
201+
if it is not combined with ``intel_pstate=active``.] Like in the active mode
202+
without HWP support, in this mode ``intel_pstate`` may refuse to work with
203+
processors that are not recognized by it if HWP is prevented from being enabled
204+
through the kernel command line.
201205

202206
If the driver works in this mode, the ``scaling_driver`` policy attribute in
203207
``sysfs`` for all ``CPUFreq`` policies contains the string "intel_cpufreq".
@@ -318,10 +322,9 @@ manuals need to be consulted to get to it too.
318322

319323
For this reason, there is a list of supported processors in ``intel_pstate`` and
320324
the driver initialization will fail if the detected processor is not in that
321-
list, unless it supports the `HWP feature <Active Mode_>`_. [The interface to
322-
obtain all of the information listed above is the same for all of the processors
323-
supporting the HWP feature, which is why they all are supported by
324-
``intel_pstate``.]
325+
list, unless it supports the HWP feature. [The interface to obtain all of the
326+
information listed above is the same for all of the processors supporting the
327+
HWP feature, which is why ``intel_pstate`` works with all of them.]
325328

326329

327330
User Space Interface in ``sysfs``
@@ -425,22 +428,16 @@ argument is passed to the kernel in the command line.
425428
as well as the per-policy ones) are then reset to their default
426429
values, possibly depending on the target operation mode.]
427430

428-
That only is supported in some configurations, though (for example, if
429-
the `HWP feature is enabled in the processor <Active Mode With HWP_>`_,
430-
the operation mode of the driver cannot be changed), and if it is not
431-
supported in the current configuration, writes to this attribute will
432-
fail with an appropriate error.
433-
434431
``energy_efficiency``
435-
This attribute is only present on platforms, which have CPUs matching
436-
Kaby Lake or Coffee Lake desktop CPU model. By default
437-
energy efficiency optimizations are disabled on these CPU models in HWP
438-
mode by this driver. Enabling energy efficiency may limit maximum
439-
operating frequency in both HWP and non HWP mode. In non HWP mode,
440-
optimizations are done only in the turbo frequency range. In HWP mode,
441-
optimizations are done in the entire frequency range. Setting this
442-
attribute to "1" enables energy efficiency optimizations and setting
443-
to "0" disables energy efficiency optimizations.
432+
This attribute is only present on platforms with CPUs matching the Kaby
433+
Lake or Coffee Lake desktop CPU model. By default, energy-efficiency
434+
optimizations are disabled on these CPU models if HWP is enabled.
435+
Enabling energy-efficiency optimizations may limit maximum operating
436+
frequency with or without the HWP feature. With HWP enabled, the
437+
optimizations are done only in the turbo frequency range. Without it,
438+
they are done in the entire available frequency range. Setting this
439+
attribute to "1" enables the energy-efficiency optimizations and setting
440+
to "0" disables them.
444441

445442
Interpretation of Policy Attributes
446443
-----------------------------------
@@ -484,8 +481,8 @@ Next, the following policy attributes have special meaning if
484481
policy for the time interval between the last two invocations of the
485482
driver's utilization update callback by the CPU scheduler for that CPU.
486483

487-
One more policy attribute is present if the `HWP feature is enabled in the
488-
processor <Active Mode With HWP_>`_:
484+
One more policy attribute is present if the HWP feature is enabled in the
485+
processor:
489486

490487
``base_frequency``
491488
Shows the base frequency of the CPU. Any frequency above this will be
@@ -526,11 +523,11 @@ on the following rules, regardless of the current operation mode of the driver:
526523

527524
3. The global and per-policy limits can be set independently.
528525

529-
If the `HWP feature is enabled in the processor <Active Mode With HWP_>`_, the
530-
resulting effective values are written into its registers whenever the limits
531-
change in order to request its internal P-state selection logic to always set
532-
P-states within these limits. Otherwise, the limits are taken into account by
533-
scaling governors (in the `passive mode <Passive Mode_>`_) and by the driver
526+
In the `active mode with the HWP feature enabled <Active Mode With HWP_>`_, the
527+
resulting effective values are written into hardware registers whenever the
528+
limits change in order to request its internal P-state selection logic to always
529+
set P-states within these limits. Otherwise, the limits are taken into account
530+
by scaling governors (in the `passive mode <Passive Mode_>`_) and by the driver
534531
every time before setting a new P-state for a CPU.
535532

536533
Additionally, if the ``intel_pstate=per_cpu_perf_limits`` command line argument
@@ -541,12 +538,11 @@ at all and the only way to set the limits is by using the policy attributes.
541538
Energy vs Performance Hints
542539
---------------------------
543540

544-
If ``intel_pstate`` works in the `active mode with the HWP feature enabled
545-
<Active Mode With HWP_>`_ in the processor, additional attributes are present
546-
in every ``CPUFreq`` policy directory in ``sysfs``. They are intended to allow
547-
user space to help ``intel_pstate`` to adjust the processor's internal P-state
548-
selection logic by focusing it on performance or on energy-efficiency, or
549-
somewhere between the two extremes:
541+
If the hardware-managed P-states (HWP) is enabled in the processor, additional
542+
attributes, intended to allow user space to help ``intel_pstate`` to adjust the
543+
processor's internal P-state selection logic by focusing it on performance or on
544+
energy-efficiency, or somewhere between the two extremes, are present in every
545+
``CPUFreq`` policy directory in ``sysfs``. They are :
550546

551547
``energy_performance_preference``
552548
Current value of the energy vs performance hint for the given policy
@@ -650,12 +646,14 @@ of them have to be prepended with the ``intel_pstate=`` prefix.
650646
Do not register ``intel_pstate`` as the scaling driver even if the
651647
processor is supported by it.
652648

649+
``active``
650+
Register ``intel_pstate`` in the `active mode <Active Mode_>`_ to start
651+
with.
652+
653653
``passive``
654654
Register ``intel_pstate`` in the `passive mode <Passive Mode_>`_ to
655655
start with.
656656

657-
This option implies the ``no_hwp`` one described below.
658-
659657
``force``
660658
Register ``intel_pstate`` as the scaling driver instead of
661659
``acpi-cpufreq`` even if the latter is preferred on the given system.
@@ -670,13 +668,12 @@ of them have to be prepended with the ``intel_pstate=`` prefix.
670668
driver is used instead of ``acpi-cpufreq``.
671669

672670
``no_hwp``
673-
Do not enable the `hardware-managed P-states (HWP) feature
674-
<Active Mode With HWP_>`_ even if it is supported by the processor.
671+
Do not enable the hardware-managed P-states (HWP) feature even if it is
672+
supported by the processor.
675673

676674
``hwp_only``
677675
Register ``intel_pstate`` as the scaling driver only if the
678-
`hardware-managed P-states (HWP) feature <Active Mode With HWP_>`_ is
679-
supported by the processor.
676+
hardware-managed P-states (HWP) feature is supported by the processor.
680677

681678
``support_acpi_ppc``
682679
Take ACPI ``_PPC`` performance limits into account.

drivers/cpufreq/cpufreq.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,6 @@ static inline bool has_target(void)
7373
static unsigned int __cpufreq_get(struct cpufreq_policy *policy);
7474
static int cpufreq_init_governor(struct cpufreq_policy *policy);
7575
static void cpufreq_exit_governor(struct cpufreq_policy *policy);
76-
static int cpufreq_start_governor(struct cpufreq_policy *policy);
77-
static void cpufreq_stop_governor(struct cpufreq_policy *policy);
7876
static void cpufreq_governor_limits(struct cpufreq_policy *policy);
7977
static int cpufreq_set_policy(struct cpufreq_policy *policy,
8078
struct cpufreq_governor *new_gov,
@@ -2266,7 +2264,7 @@ static void cpufreq_exit_governor(struct cpufreq_policy *policy)
22662264
module_put(policy->governor->owner);
22672265
}
22682266

2269-
static int cpufreq_start_governor(struct cpufreq_policy *policy)
2267+
int cpufreq_start_governor(struct cpufreq_policy *policy)
22702268
{
22712269
int ret;
22722270

@@ -2293,7 +2291,7 @@ static int cpufreq_start_governor(struct cpufreq_policy *policy)
22932291
return 0;
22942292
}
22952293

2296-
static void cpufreq_stop_governor(struct cpufreq_policy *policy)
2294+
void cpufreq_stop_governor(struct cpufreq_policy *policy)
22972295
{
22982296
if (cpufreq_suspended || !policy->governor)
22992297
return;

0 commit comments

Comments
 (0)