linux/drivers/powercap
Srinivas Pandruvada c7cd6f04c0 powercap: idle_inject: Support 100% idle injection
The users of the idle injection framework allow 100% idle injection. For
example: thermal/cpuidle_cooling.c driver. When the ratio is set to
100%, the runtime_duration becomes zero.

However, idle_inject_set_duration() in the idle injection framework
silently ignores run_duration_us == 0 without any error (it is a void
function). The caller will then assume that everything is fine and
100% idle is effective, but in reality the idle duration will not
change.

There are two options:

 - The caller may change their max state to 99% instead of 100% and
   document that 100% is not supported by the idle inject framework.

 - Add 100% idle support to the idle inject framework.

Since there are other protections via RT throttling, this framework can
allow 100% idle. The RT throttling will be activated at 95% idle by
default. The caller disabling RT throttling and injecting 100% idle,
should be aware that CPU can't be used at all.

The idle inject timer is started for (run_duration_us + idle_duration_us)
duration. Hence replace (run_duration_us && idle_duration_us) with
(run_duration_us + idle_duration_us) in the function
idle_inject_set_duration(). Also check for !(run_duration_us +
idle_duration_us) to return -EINVAL in idle_inject_start().

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>
[ rjw: Changelog edits ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2023-01-20 18:28:19 +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: Support 100% idle injection 2023-01-20 18:28:19 +01:00
intel_rapl_common.c powercap: intel_rapl: add support for Emerald Rapids 2023-01-20 17:23:56 +01: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: fix possible name leak in powercap_register_zone() 2023-01-20 14:57:23 +01:00