Commit 1a5d9dbb authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'pm-5.9-rc1-3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull one more power management update from Rafael Wysocki:
 "Modify the intel_pstate driver to allow it to work in the passive mode
  with hardware-managed P-states (HWP) enabled"

* tag 'pm-5.9-rc1-3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  cpufreq: intel_pstate: Implement passive mode with HWP enabled
parents 884e0d3d f3db6de5
...@@ -54,10 +54,13 @@ registered (see `below <status_attr_>`_). ...@@ -54,10 +54,13 @@ registered (see `below <status_attr_>`_).
Operation Modes Operation Modes
=============== ===============
``intel_pstate`` can operate in three different modes: in the active mode with ``intel_pstate`` can operate in two different modes, active or passive. In the
or without hardware-managed P-states support and in the passive mode. Which of active mode, it uses its own internal performance scaling governor algorithm or
them will be in effect depends on what kernel command line options are used and allows the hardware to do preformance scaling by itself, while in the passive
on the capabilities of the processor. mode it responds to requests made by a generic ``CPUFreq`` governor implementing
a certain performance scaling algorithm. Which of them will be in effect
depends on what kernel command line options are used and on the capabilities of
the processor.
Active Mode Active Mode
----------- -----------
...@@ -194,10 +197,11 @@ This is the default operation mode of ``intel_pstate`` for processors without ...@@ -194,10 +197,11 @@ This is the default operation mode of ``intel_pstate`` for processors without
hardware-managed P-states (HWP) support. It is always used if the hardware-managed P-states (HWP) support. It is always used if the
``intel_pstate=passive`` argument is passed to the kernel in the command line ``intel_pstate=passive`` argument is passed to the kernel in the command line
regardless of whether or not the given processor supports HWP. [Note that the regardless of whether or not the given processor supports HWP. [Note that the
``intel_pstate=no_hwp`` setting implies ``intel_pstate=passive`` if it is used ``intel_pstate=no_hwp`` setting causes the driver to start in the passive mode
without ``intel_pstate=active``.] Like in the active mode without HWP support, if it is not combined with ``intel_pstate=active``.] Like in the active mode
in this mode ``intel_pstate`` may refuse to work with processors that are not without HWP support, in this mode ``intel_pstate`` may refuse to work with
recognized by it. processors that are not recognized by it if HWP is prevented from being enabled
through the kernel command line.
If the driver works in this mode, the ``scaling_driver`` policy attribute in If the driver works in this mode, the ``scaling_driver`` policy attribute in
``sysfs`` for all ``CPUFreq`` policies contains the string "intel_cpufreq". ``sysfs`` for all ``CPUFreq`` policies contains the string "intel_cpufreq".
...@@ -318,10 +322,9 @@ manuals need to be consulted to get to it too. ...@@ -318,10 +322,9 @@ manuals need to be consulted to get to it too.
For this reason, there is a list of supported processors in ``intel_pstate`` and For this reason, there is a list of supported processors in ``intel_pstate`` and
the driver initialization will fail if the detected processor is not in that the driver initialization will fail if the detected processor is not in that
list, unless it supports the `HWP feature <Active Mode_>`_. [The interface to list, unless it supports the HWP feature. [The interface to obtain all of the
obtain all of the information listed above is the same for all of the processors information listed above is the same for all of the processors supporting the
supporting the HWP feature, which is why they all are supported by HWP feature, which is why ``intel_pstate`` works with all of them.]
``intel_pstate``.]
User Space Interface in ``sysfs`` User Space Interface in ``sysfs``
...@@ -425,22 +428,16 @@ argument is passed to the kernel in the command line. ...@@ -425,22 +428,16 @@ argument is passed to the kernel in the command line.
as well as the per-policy ones) are then reset to their default as well as the per-policy ones) are then reset to their default
values, possibly depending on the target operation mode.] values, possibly depending on the target operation mode.]
That only is supported in some configurations, though (for example, if
the `HWP feature is enabled in the processor <Active Mode With HWP_>`_,
the operation mode of the driver cannot be changed), and if it is not
supported in the current configuration, writes to this attribute will
fail with an appropriate error.
``energy_efficiency`` ``energy_efficiency``
This attribute is only present on platforms, which have CPUs matching This attribute is only present on platforms with CPUs matching the Kaby
Kaby Lake or Coffee Lake desktop CPU model. By default Lake or Coffee Lake desktop CPU model. By default, energy-efficiency
energy efficiency optimizations are disabled on these CPU models in HWP optimizations are disabled on these CPU models if HWP is enabled.
mode by this driver. Enabling energy efficiency may limit maximum Enabling energy-efficiency optimizations may limit maximum operating
operating frequency in both HWP and non HWP mode. In non HWP mode, frequency with or without the HWP feature. With HWP enabled, the
optimizations are done only in the turbo frequency range. In HWP mode, optimizations are done only in the turbo frequency range. Without it,
optimizations are done in the entire frequency range. Setting this they are done in the entire available frequency range. Setting this
attribute to "1" enables energy efficiency optimizations and setting attribute to "1" enables the energy-efficiency optimizations and setting
to "0" disables energy efficiency optimizations. to "0" disables them.
Interpretation of Policy Attributes Interpretation of Policy Attributes
----------------------------------- -----------------------------------
...@@ -484,8 +481,8 @@ Next, the following policy attributes have special meaning if ...@@ -484,8 +481,8 @@ Next, the following policy attributes have special meaning if
policy for the time interval between the last two invocations of the policy for the time interval between the last two invocations of the
driver's utilization update callback by the CPU scheduler for that CPU. driver's utilization update callback by the CPU scheduler for that CPU.
One more policy attribute is present if the `HWP feature is enabled in the One more policy attribute is present if the HWP feature is enabled in the
processor <Active Mode With HWP_>`_: processor:
``base_frequency`` ``base_frequency``
Shows the base frequency of the CPU. Any frequency above this will be 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: ...@@ -526,11 +523,11 @@ on the following rules, regardless of the current operation mode of the driver:
3. The global and per-policy limits can be set independently. 3. The global and per-policy limits can be set independently.
If the `HWP feature is enabled in the processor <Active Mode With HWP_>`_, the In the `active mode with the HWP feature enabled <Active Mode With HWP_>`_, the
resulting effective values are written into its registers whenever the limits resulting effective values are written into hardware registers whenever the
change in order to request its internal P-state selection logic to always set limits change in order to request its internal P-state selection logic to always
P-states within these limits. Otherwise, the limits are taken into account by set P-states within these limits. Otherwise, the limits are taken into account
scaling governors (in the `passive mode <Passive Mode_>`_) and by the driver by scaling governors (in the `passive mode <Passive Mode_>`_) and by the driver
every time before setting a new P-state for a CPU. every time before setting a new P-state for a CPU.
Additionally, if the ``intel_pstate=per_cpu_perf_limits`` command line argument 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. ...@@ -541,12 +538,11 @@ at all and the only way to set the limits is by using the policy attributes.
Energy vs Performance Hints Energy vs Performance Hints
--------------------------- ---------------------------
If ``intel_pstate`` works in the `active mode with the HWP feature enabled If the hardware-managed P-states (HWP) is enabled in the processor, additional
<Active Mode With HWP_>`_ in the processor, additional attributes are present attributes, intended to allow user space to help ``intel_pstate`` to adjust the
in every ``CPUFreq`` policy directory in ``sysfs``. They are intended to allow processor's internal P-state selection logic by focusing it on performance or on
user space to help ``intel_pstate`` to adjust the processor's internal P-state energy-efficiency, or somewhere between the two extremes, are present in every
selection logic by focusing it on performance or on energy-efficiency, or ``CPUFreq`` policy directory in ``sysfs``. They are :
somewhere between the two extremes:
``energy_performance_preference`` ``energy_performance_preference``
Current value of the energy vs performance hint for the given policy 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. ...@@ -650,12 +646,14 @@ of them have to be prepended with the ``intel_pstate=`` prefix.
Do not register ``intel_pstate`` as the scaling driver even if the Do not register ``intel_pstate`` as the scaling driver even if the
processor is supported by it. processor is supported by it.
``active``
Register ``intel_pstate`` in the `active mode <Active Mode_>`_ to start
with.
``passive`` ``passive``
Register ``intel_pstate`` in the `passive mode <Passive Mode_>`_ to Register ``intel_pstate`` in the `passive mode <Passive Mode_>`_ to
start with. start with.
This option implies the ``no_hwp`` one described below.
``force`` ``force``
Register ``intel_pstate`` as the scaling driver instead of Register ``intel_pstate`` as the scaling driver instead of
``acpi-cpufreq`` even if the latter is preferred on the given system. ``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. ...@@ -670,13 +668,12 @@ of them have to be prepended with the ``intel_pstate=`` prefix.
driver is used instead of ``acpi-cpufreq``. driver is used instead of ``acpi-cpufreq``.
``no_hwp`` ``no_hwp``
Do not enable the `hardware-managed P-states (HWP) feature Do not enable the hardware-managed P-states (HWP) feature even if it is
<Active Mode With HWP_>`_ even if it is supported by the processor. supported by the processor.
``hwp_only`` ``hwp_only``
Register ``intel_pstate`` as the scaling driver only if the Register ``intel_pstate`` as the scaling driver only if the
`hardware-managed P-states (HWP) feature <Active Mode With HWP_>`_ is hardware-managed P-states (HWP) feature is supported by the processor.
supported by the processor.
``support_acpi_ppc`` ``support_acpi_ppc``
Take ACPI ``_PPC`` performance limits into account. Take ACPI ``_PPC`` performance limits into account.
......
...@@ -73,8 +73,6 @@ static inline bool has_target(void) ...@@ -73,8 +73,6 @@ static inline bool has_target(void)
static unsigned int __cpufreq_get(struct cpufreq_policy *policy); static unsigned int __cpufreq_get(struct cpufreq_policy *policy);
static int cpufreq_init_governor(struct cpufreq_policy *policy); static int cpufreq_init_governor(struct cpufreq_policy *policy);
static void cpufreq_exit_governor(struct cpufreq_policy *policy); static void cpufreq_exit_governor(struct cpufreq_policy *policy);
static int cpufreq_start_governor(struct cpufreq_policy *policy);
static void cpufreq_stop_governor(struct cpufreq_policy *policy);
static void cpufreq_governor_limits(struct cpufreq_policy *policy); static void cpufreq_governor_limits(struct cpufreq_policy *policy);
static int cpufreq_set_policy(struct cpufreq_policy *policy, static int cpufreq_set_policy(struct cpufreq_policy *policy,
struct cpufreq_governor *new_gov, struct cpufreq_governor *new_gov,
...@@ -2266,7 +2264,7 @@ static void cpufreq_exit_governor(struct cpufreq_policy *policy) ...@@ -2266,7 +2264,7 @@ static void cpufreq_exit_governor(struct cpufreq_policy *policy)
module_put(policy->governor->owner); module_put(policy->governor->owner);
} }
static int cpufreq_start_governor(struct cpufreq_policy *policy) int cpufreq_start_governor(struct cpufreq_policy *policy)
{ {
int ret; int ret;
...@@ -2293,7 +2291,7 @@ static int cpufreq_start_governor(struct cpufreq_policy *policy) ...@@ -2293,7 +2291,7 @@ static int cpufreq_start_governor(struct cpufreq_policy *policy)
return 0; return 0;
} }
static void cpufreq_stop_governor(struct cpufreq_policy *policy) void cpufreq_stop_governor(struct cpufreq_policy *policy)
{ {
if (cpufreq_suspended || !policy->governor) if (cpufreq_suspended || !policy->governor)
return; return;
......
This diff is collapsed.
...@@ -576,6 +576,8 @@ unsigned int cpufreq_driver_resolve_freq(struct cpufreq_policy *policy, ...@@ -576,6 +576,8 @@ unsigned int cpufreq_driver_resolve_freq(struct cpufreq_policy *policy,
unsigned int cpufreq_policy_transition_delay_us(struct cpufreq_policy *policy); unsigned int cpufreq_policy_transition_delay_us(struct cpufreq_policy *policy);
int cpufreq_register_governor(struct cpufreq_governor *governor); int cpufreq_register_governor(struct cpufreq_governor *governor);
void cpufreq_unregister_governor(struct cpufreq_governor *governor); void cpufreq_unregister_governor(struct cpufreq_governor *governor);
int cpufreq_start_governor(struct cpufreq_policy *policy);
void cpufreq_stop_governor(struct cpufreq_policy *policy);
#define cpufreq_governor_init(__governor) \ #define cpufreq_governor_init(__governor) \
static int __init __governor##_init(void) \ static int __init __governor##_init(void) \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment