Skip to content

Commit

Permalink
Merge tag 'pm-5.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/g…
Browse files Browse the repository at this point in the history
…it/rafael/linux-pm

Pull power management updates from Rafael Wysocki:
 "These fix the (Intel-specific) Performance and Energy Bias Hint (EPB)
  handling and expose it to user space via sysfs, fix and clean up
  several cpufreq drivers, add support for two new chips to the qoriq
  cpufreq driver, fix, simplify and clean up the cpufreq core and the
  schedutil governor, add support for "CPU" domains to the generic power
  domains (genpd) framework and provide low-level PSCI firmware support
  for that feature, fix the exynos cpuidle driver and fix a couple of
  issues in the devfreq subsystem and clean it up.

  Specifics:

   - Fix the handling of Performance and Energy Bias Hint (EPB) on Intel
     processors and expose it to user space via sysfs to avoid having to
     access it through the generic MSR I/F (Rafael Wysocki).

   - Improve the handling of global turbo changes made by the platform
     firmware in the intel_pstate driver (Rafael Wysocki).

   - Convert some slow-path static_cpu_has() callers to boot_cpu_has()
     in cpufreq (Borislav Petkov).

   - Fix the frequency calculation loop in the armada-37xx cpufreq
     driver (Gregory CLEMENT).

   - Fix possible object reference leaks in multuple cpufreq drivers
     (Wen Yang).

   - Fix kerneldoc comment in the centrino cpufreq driver (dongjian).

   - Clean up the ACPI and maple cpufreq drivers (Viresh Kumar, Mohan
     Kumar).

   - Add support for lx2160a and ls1028a to the qoriq cpufreq driver
     (Vabhav Sharma, Yuantian Tang).

   - Fix kobject memory leak in the cpufreq core (Viresh Kumar).

   - Simplify the IOwait boosting in the schedutil cpufreq governor and
     rework the TSC cpufreq notifier on x86 (Rafael Wysocki).

   - Clean up the cpufreq core and statistics code (Yue Hu, Kyle Lin).

   - Improve the cpufreq documentation, add SPDX license tags to some PM
     documentation files and unify copyright notices in them (Rafael
     Wysocki).

   - Add support for "CPU" domains to the generic power domains (genpd)
     framework and provide low-level PSCI firmware support for that
     feature (Ulf Hansson).

   - Rearrange the PSCI firmware support code and add support for
     SYSTEM_RESET2 to it (Ulf Hansson, Sudeep Holla).

   - Improve genpd support for devices in multiple power domains (Ulf
     Hansson).

   - Unify target residency for the AFTR and coupled AFTR states in the
     exynos cpuidle driver (Marek Szyprowski).

   - Introduce new helper routine in the operating performance points
     (OPP) framework (Andrew-sh.Cheng).

   - Add support for passing on-die termination (ODT) and auto power
     down parameters from the kernel to Trusted Firmware-A (TF-A) to the
     rk3399_dmc devfreq driver (Enric Balletbo i Serra).

   - Add tracing to devfreq (Lukasz Luba).

   - Make the exynos-bus devfreq driver suspend all devices on system
     shutdown (Marek Szyprowski).

   - Fix a few minor issues in the devfreq subsystem and clean it up
     somewhat (Enric Balletbo i Serra, MyungJoo Ham, Rob Herring,
     Saravana Kannan, Yangtao Li).

   - Improve system wakeup diagnostics (Stephen Boyd).

   - Rework filesystem sync messages emitted during system suspend and
     hibernation (Harry Pan)"

* tag 'pm-5.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (72 commits)
  cpufreq: Fix kobject memleak
  cpufreq: armada-37xx: fix frequency calculation for opp
  cpufreq: centrino: Fix centrino_setpolicy() kerneldoc comment
  cpufreq: qoriq: add support for lx2160a
  x86: tsc: Rework time_cpufreq_notifier()
  PM / Domains: Allow to attach a CPU via genpd_dev_pm_attach_by_id|name()
  PM / Domains: Search for the CPU device outside the genpd lock
  PM / Domains: Drop unused in-parameter to some genpd functions
  PM / Domains: Use the base device for driver_deferred_probe_check_state()
  cpufreq: qoriq: Add ls1028a chip support
  PM / Domains: Enable genpd_dev_pm_attach_by_id|name() for single PM domain
  PM / Domains: Allow OF lookup for multi PM domain case from ->attach_dev()
  PM / Domains: Don't kfree() the virtual device in the error path
  cpufreq: Move ->get callback check outside of __cpufreq_get()
  PM / Domains: remove unnecessary unlikely()
  cpufreq: Remove needless bios_limit check in show_bios_limit()
  drivers/cpufreq/acpi-cpufreq.c: This fixes the following checkpatch warning
  firmware/psci: add support for SYSTEM_RESET2
  PM / devfreq: add tracing for scheduling work
  trace: events: add devfreq trace event file
  ...
  • Loading branch information
torvalds committed May 7, 2019
2 parents 59df1c2 + e07095c commit 8f5e823
Show file tree
Hide file tree
Showing 79 changed files with 1,240 additions and 390 deletions.
18 changes: 18 additions & 0 deletions Documentation/ABI/testing/sysfs-devices-system-cpu
Original file line number Diff line number Diff line change
Expand Up @@ -520,3 +520,21 @@ Description: Control Symetric Multi Threading (SMT)

If control status is "forceoff" or "notsupported" writes
are rejected.

What: /sys/devices/system/cpu/cpu#/power/energy_perf_bias
Date: March 2019
Contact: [email protected]
Description: Intel Energy and Performance Bias Hint (EPB)

EPB for the given CPU in a sliding scale 0 - 15, where a value
of 0 corresponds to a hint preference for highest performance
and a value of 15 corresponds to the maximum energy savings.

In order to change the EPB value for the CPU, write either
a number in the 0 - 15 sliding scale above, or one of the
strings: "performance", "balance-performance", "normal",
"balance-power", "power" (that represent values reflected by
their meaning), to this attribute.

This attribute is present for all online CPUs supporting the
Intel EPB feature.
18 changes: 13 additions & 5 deletions Documentation/admin-guide/pm/cpufreq.rst
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
.. SPDX-License-Identifier: GPL-2.0
.. include:: <isonum.txt>

.. |struct cpufreq_policy| replace:: :c:type:`struct cpufreq_policy <cpufreq_policy>`
.. |intel_pstate| replace:: :doc:`intel_pstate <intel_pstate>`

=======================
CPU Performance Scaling
=======================

::
:Copyright: |copy| 2017 Intel Corporation

:Author: Rafael J. Wysocki <[email protected]>

Copyright (c) 2017 Intel Corp., Rafael J. Wysocki <[email protected]>

The Concept of CPU Performance Scaling
======================================
Expand Down Expand Up @@ -396,8 +400,8 @@ RT or deadline scheduling classes, the governor will increase the frequency to
the allowed maximum (that is, the ``scaling_max_freq`` policy limit). In turn,
if it is invoked by the CFS scheduling class, the governor will use the
Per-Entity Load Tracking (PELT) metric for the root control group of the
given CPU as the CPU utilization estimate (see the `Per-entity load tracking`_
LWN.net article for a description of the PELT mechanism). Then, the new
given CPU as the CPU utilization estimate (see the *Per-entity load tracking*
LWN.net article [1]_ for a description of the PELT mechanism). Then, the new
CPU frequency to apply is computed in accordance with the formula

f = 1.25 * ``f_0`` * ``util`` / ``max``
Expand Down Expand Up @@ -698,4 +702,8 @@ hardware feature (e.g. all Intel ones), even if the
:c:macro:`CONFIG_X86_ACPI_CPUFREQ_CPB` configuration option is set.


.. _Per-entity load tracking: https://lwn.net/Articles/531853/
References
==========

.. [1] Jonathan Corbet, *Per-entity load tracking*,
https://lwn.net/Articles/531853/
8 changes: 6 additions & 2 deletions Documentation/admin-guide/pm/cpuidle.rst
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
.. SPDX-License-Identifier: GPL-2.0
.. include:: <isonum.txt>

.. |struct cpuidle_state| replace:: :c:type:`struct cpuidle_state <cpuidle_state>`
.. |cpufreq| replace:: :doc:`CPU Performance Scaling <cpufreq>`

========================
CPU Idle Time Management
========================

::
:Copyright: |copy| 2018 Intel Corporation

:Author: Rafael J. Wysocki <[email protected]>

Copyright (c) 2018 Intel Corp., Rafael J. Wysocki <[email protected]>

Concepts
========
Expand Down
2 changes: 2 additions & 0 deletions Documentation/admin-guide/pm/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.. SPDX-License-Identifier: GPL-2.0
================
Power Management
================
Expand Down
41 changes: 41 additions & 0 deletions Documentation/admin-guide/pm/intel_epb.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
.. SPDX-License-Identifier: GPL-2.0
.. include:: <isonum.txt>

======================================
Intel Performance and Energy Bias Hint
======================================

:Copyright: |copy| 2019 Intel Corporation

:Author: Rafael J. Wysocki <[email protected]>


.. kernel-doc:: arch/x86/kernel/cpu/intel_epb.c
:doc: overview

Intel Performance and Energy Bias Attribute in ``sysfs``
========================================================

The Intel Performance and Energy Bias Hint (EPB) value for a given (logical) CPU
can be checked or updated through a ``sysfs`` attribute (file) under
:file:`/sys/devices/system/cpu/cpu<N>/power/`, where the CPU number ``<N>``
is allocated at the system initialization time:

``energy_perf_bias``
Shows the current EPB value for the CPU in a sliding scale 0 - 15, where
a value of 0 corresponds to a hint preference for highest performance
and a value of 15 corresponds to the maximum energy savings.

In order to update the EPB value for the CPU, this attribute can be
written to, either with a number in the 0 - 15 sliding scale above, or
with one of the strings: "performance", "balance-performance", "normal",
"balance-power", "power" that represent values reflected by their
meaning.

This attribute is present for all online CPUs supporting the EPB
feature.

Note that while the EPB interface to the processor is defined at the logical CPU
level, the physical register backing it may be shared by multiple CPUs (for
example, SMT siblings or cores in one package). For this reason, updating the
EPB value for one CPU may cause the EPB values for other CPUs to change.
32 changes: 21 additions & 11 deletions Documentation/admin-guide/pm/intel_pstate.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
.. SPDX-License-Identifier: GPL-2.0
.. include:: <isonum.txt>

===============================================
``intel_pstate`` CPU Performance Scaling Driver
===============================================

::
:Copyright: |copy| 2017 Intel Corporation

Copyright (c) 2017 Intel Corp., Rafael J. Wysocki <[email protected]>
:Author: Rafael J. Wysocki <[email protected]>


General Information
Expand All @@ -20,11 +23,10 @@ you have not done that yet.]

For the processors supported by ``intel_pstate``, the P-state concept is broader
than just an operating frequency or an operating performance point (see the
`LinuxCon Europe 2015 presentation by Kristen Accardi <LCEU2015_>`_ for more
LinuxCon Europe 2015 presentation by Kristen Accardi [1]_ for more
information about that). For this reason, the representation of P-states used
by ``intel_pstate`` internally follows the hardware specification (for details
refer to `Intel® 64 and IA-32 Architectures Software Developer’s Manual
Volume 3: System Programming Guide <SDM_>`_). However, the ``CPUFreq`` core
refer to Intel Software Developer’s Manual [2]_). However, the ``CPUFreq`` core
uses frequencies for identifying operating performance points of CPUs and
frequencies are involved in the user space interface exposed by it, so
``intel_pstate`` maps its internal representation of P-states to frequencies too
Expand Down Expand Up @@ -561,9 +563,9 @@ or to pin every task potentially sensitive to them to a specific CPU.]

On the majority of systems supported by ``intel_pstate``, the ACPI tables
provided by the platform firmware contain ``_PSS`` objects returning information
that can be used for CPU performance scaling (refer to the `ACPI specification`_
for details on the ``_PSS`` objects and the format of the information returned
by them).
that can be used for CPU performance scaling (refer to the ACPI specification
[3]_ for details on the ``_PSS`` objects and the format of the information
returned by them).

The information returned by the ACPI ``_PSS`` objects is used by the
``acpi-cpufreq`` scaling driver. On systems supported by ``intel_pstate``
Expand Down Expand Up @@ -728,6 +730,14 @@ P-state is called, the ``ftrace`` filter can be set to to
<idle>-0 [000] ..s. 2537.654843: intel_pstate_set_pstate <-intel_pstate_timer_func


.. _LCEU2015: http://events.linuxfoundation.org/sites/events/files/slides/LinuxConEurope_2015.pdf
.. _SDM: http://www.intel.com/content/www/us/en/architecture-and-technology/64-ia-32-architectures-software-developer-system-programming-manual-325384.html
.. _ACPI specification: http://www.uefi.org/sites/default/files/resources/ACPI_6_1.pdf
References
==========

.. [1] Kristen Accardi, *Balancing Power and Performance in the Linux Kernel*,
http://events.linuxfoundation.org/sites/events/files/slides/LinuxConEurope_2015.pdf
.. [2] *Intel® 64 and IA-32 Architectures Software Developer’s Manual Volume 3: System Programming Guide*,
http://www.intel.com/content/www/us/en/architecture-and-technology/64-ia-32-architectures-software-developer-system-programming-manual-325384.html
.. [3] *Advanced Configuration and Power Interface Specification*,
https://uefi.org/sites/default/files/resources/ACPI_6_3_final_Jan30.pdf
8 changes: 6 additions & 2 deletions Documentation/admin-guide/pm/sleep-states.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
.. SPDX-License-Identifier: GPL-2.0
.. include:: <isonum.txt>

===================
System Sleep States
===================

::
:Copyright: |copy| 2017 Intel Corporation

:Author: Rafael J. Wysocki <[email protected]>

Copyright (c) 2017 Intel Corp., Rafael J. Wysocki <[email protected]>

Sleep states are global low-power states of the entire system in which user
space code cannot be executed and the overall system activity is significantly
Expand Down
8 changes: 6 additions & 2 deletions Documentation/admin-guide/pm/strategies.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
.. SPDX-License-Identifier: GPL-2.0
.. include:: <isonum.txt>

===========================
Power Management Strategies
===========================

::
:Copyright: |copy| 2017 Intel Corporation

:Author: Rafael J. Wysocki <[email protected]>

Copyright (c) 2017 Intel Corp., Rafael J. Wysocki <[email protected]>

The Linux kernel supports two major high-level power management strategies.

Expand Down
2 changes: 2 additions & 0 deletions Documentation/admin-guide/pm/system-wide.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.. SPDX-License-Identifier: GPL-2.0
============================
System-Wide Power Management
============================
Expand Down
3 changes: 3 additions & 0 deletions Documentation/admin-guide/pm/working-state.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.. SPDX-License-Identifier: GPL-2.0
==============================
Working-State Power Management
==============================
Expand All @@ -8,3 +10,4 @@ Working-State Power Management
cpuidle
cpufreq
intel_pstate
intel_epb
7 changes: 5 additions & 2 deletions Documentation/driver-api/pm/cpuidle.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
.. SPDX-License-Identifier: GPL-2.0
.. include:: <isonum.txt>

.. |struct cpuidle_governor| replace:: :c:type:`struct cpuidle_governor <cpuidle_governor>`
.. |struct cpuidle_device| replace:: :c:type:`struct cpuidle_device <cpuidle_device>`
.. |struct cpuidle_driver| replace:: :c:type:`struct cpuidle_driver <cpuidle_driver>`
Expand All @@ -7,9 +10,9 @@
CPU Idle Time Management
========================

::
:Copyright: |copy| 2019 Intel Corporation

Copyright (c) 2019 Intel Corp., Rafael J. Wysocki <[email protected]>
:Author: Rafael J. Wysocki <[email protected]>


CPU Idle Time Management Subsystem
Expand Down
12 changes: 8 additions & 4 deletions Documentation/driver-api/pm/devices.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
.. SPDX-License-Identifier: GPL-2.0
.. include:: <isonum.txt>

.. |struct dev_pm_ops| replace:: :c:type:`struct dev_pm_ops <dev_pm_ops>`
.. |struct dev_pm_domain| replace:: :c:type:`struct dev_pm_domain <dev_pm_domain>`
.. |struct bus_type| replace:: :c:type:`struct bus_type <bus_type>`
Expand All @@ -12,11 +15,12 @@
Device Power Management Basics
==============================

::
:Copyright: |copy| 2010-2011 Rafael J. Wysocki <[email protected]>, Novell Inc.
:Copyright: |copy| 2010 Alan Stern <[email protected]>
:Copyright: |copy| 2016 Intel Corporation

:Author: Rafael J. Wysocki <[email protected]>

Copyright (c) 2010-2011 Rafael J. Wysocki <[email protected]>, Novell Inc.
Copyright (c) 2010 Alan Stern <[email protected]>
Copyright (c) 2016 Intel Corp., Rafael J. Wysocki <[email protected]>

Most of the code in Linux is device drivers, so most of the Linux power
management (PM) code is also driver-specific. Most drivers will do very
Expand Down
2 changes: 2 additions & 0 deletions Documentation/driver-api/pm/index.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.. SPDX-License-Identifier: GPL-2.0
===============================
CPU and Device Power Management
===============================
Expand Down
8 changes: 6 additions & 2 deletions Documentation/driver-api/pm/notifiers.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
.. SPDX-License-Identifier: GPL-2.0
.. include:: <isonum.txt>

=============================
Suspend/Hibernation Notifiers
=============================

::
:Copyright: |copy| 2016 Intel Corporation

:Author: Rafael J. Wysocki <[email protected]>

Copyright (c) 2016 Intel Corp., Rafael J. Wysocki <[email protected]>

There are some operations that subsystems or drivers may want to carry out
before hibernation/suspend or after restore/resume, but they require the system
Expand Down
2 changes: 2 additions & 0 deletions Documentation/driver-api/pm/types.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.. SPDX-License-Identifier: GPL-2.0
==================================
Device Power Management Data Types
==================================
Expand Down
3 changes: 2 additions & 1 deletion MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -4553,6 +4553,7 @@ S: Maintained
F: drivers/devfreq/
F: include/linux/devfreq.h
F: Documentation/devicetree/bindings/devfreq/
F: include/trace/events/devfreq.h

DEVICE FREQUENCY EVENT (DEVFREQ-EVENT)
M: Chanwoo Choi <[email protected]>
Expand Down Expand Up @@ -12416,7 +12417,7 @@ M: Mark Rutland <[email protected]>
M: Lorenzo Pieralisi <[email protected]>
L: [email protected]
S: Maintained
F: drivers/firmware/psci*.c
F: drivers/firmware/psci/
F: include/linux/psci.h
F: include/uapi/linux/psci.h

Expand Down
2 changes: 1 addition & 1 deletion arch/x86/kernel/cpu/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ obj-y += cpuid-deps.o
obj-$(CONFIG_PROC_FS) += proc.o
obj-$(CONFIG_X86_FEATURE_NAMES) += capflags.o powerflags.o

obj-$(CONFIG_CPU_SUP_INTEL) += intel.o intel_pconfig.o
obj-$(CONFIG_CPU_SUP_INTEL) += intel.o intel_pconfig.o intel_epb.o
obj-$(CONFIG_CPU_SUP_AMD) += amd.o
obj-$(CONFIG_CPU_SUP_HYGON) += hygon.o
obj-$(CONFIG_CPU_SUP_CYRIX_32) += cyrix.o
Expand Down
17 changes: 0 additions & 17 deletions arch/x86/kernel/cpu/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -1824,23 +1824,6 @@ void cpu_init(void)
}
#endif

static void bsp_resume(void)
{
if (this_cpu->c_bsp_resume)
this_cpu->c_bsp_resume(&boot_cpu_data);
}

static struct syscore_ops cpu_syscore_ops = {
.resume = bsp_resume,
};

static int __init init_cpu_syscore(void)
{
register_syscore_ops(&cpu_syscore_ops);
return 0;
}
core_initcall(init_cpu_syscore);

/*
* The microcode loader calls this upon late microcode load to recheck features,
* only when microcode has been updated. Caller holds microcode_mutex and CPU
Expand Down
1 change: 0 additions & 1 deletion arch/x86/kernel/cpu/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ struct cpu_dev {
void (*c_init)(struct cpuinfo_x86 *);
void (*c_identify)(struct cpuinfo_x86 *);
void (*c_detect_tlb)(struct cpuinfo_x86 *);
void (*c_bsp_resume)(struct cpuinfo_x86 *);
int c_x86_vendor;
#ifdef CONFIG_X86_32
/* Optional vendor specific routine to obtain the cache size. */
Expand Down
Loading

0 comments on commit 8f5e823

Please sign in to comment.