linux/drivers/powercap
Srinivas Pandruvada acbc661032 powercap: idle_inject: Add update callback
The powercap/idle_inject core uses play_idle_precise() to inject idle
time. But play_idle_precise() can't ensure that the CPU is fully idle
for the specified duration because of wakeups due to interrupts. To
compensate for the reduced idle time due to these wakes, the caller
can adjust requested idle time for the next cycle.

The goal of idle injection is to keep system at some idle percent on
average, so this is fine to overshoot or undershoot instantaneous idle
times.

The idle inject core provides an interface idle_inject_set_duration()
to set idle and runtime duration.

Some architectures provide interface to get actual idle time observed
by the hardware. So, the effective idle percent can be adjusted using
the hardware feedback. For example, Intel CPUs provides package idle
counters, which is currently used by Intel powerclamp driver to
readjust runtime duration.

When the caller's desired idle time over a period is less or greater
than the actual CPU idle time observed by the hardware, caller can
readjust idle and runtime duration for the next cycle.

The only way this can be done currently is by monitoring hardware idle
time from a different software thread and readjust idle and runtime
duration using idle_inject_set_duration().

This can be avoided by adding a callback which callers can register and
readjust from this callback function.

Add a capability to register an optional update() callback, which can be
called from the idle inject core before waking up CPUs for idle injection.
This callback can be registered via a new interface:
idle_inject_register_full().

During this process of constantly adjusting idle and runtime duration
there can be some cases where actual idle time is more than the desired.
In this case idle inject can be skipped for a cycle. If update() callback
returns false, then the idle inject core skips waking up CPUs for the
idle injection.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2023-02-02 21:08:32 +01:00
..
arm_scmi_powercap.c powercap: arm_scmi: Add SCMI Powercap based driver 2022-10-25 18:53:15 +02:00
dtpm_cpu.c Power management updates for 5.20-rc1 2022-08-02 11:17:00 -07:00
dtpm_devfreq.c powercap/drivers/dtpm: Add dtpm devfreq with energy model support 2022-02-04 17:38:09 +01:00
dtpm_subsys.h powercap/drivers/dtpm: Add dtpm devfreq with energy model support 2022-02-04 17:38:09 +01:00
dtpm.c powercap: DTPM: Fix spelling mistake "initialze" -> "initialize" 2022-03-01 18:59:35 +01:00
idle_inject.c powercap: idle_inject: Add update callback 2023-02-02 21:08:32 +01:00
intel_rapl_common.c powercap: intel_rapl: Use standard Energy Unit for SPR Dram RAPL domain 2022-09-24 19:32:46 +02:00
intel_rapl_msr.c powercap: RAPL: Add Power Limit4 support for Alder Lake-N and Raptor Lake-P 2022-07-26 20:58:28 +02:00
Kconfig powercap: arm_scmi: Add SCMI Powercap based driver 2022-10-25 18:53:15 +02:00
Makefile powercap: arm_scmi: Add SCMI Powercap based driver 2022-10-25 18:53:15 +02:00
powercap_sys.c powercap: Use kstrtobool() instead of strtobool() 2022-11-03 19:38:16 +01:00