energy-model.rst (cdd38c5f1ce4398ec58fec95904b75824daab7b5) | energy-model.rst (d62aab8ff711dc3a4c07684ea33042347f79b630) |
---|---|
1.. SPDX-License-Identifier: GPL-2.0 2 3======================= 4Energy Model of devices 5======================= 6 71. Overview 8----------- --- 87 unchanged lines hidden (view full) --- 96deemed necessary. Only for CPU devices, drivers must specify the CPUs of the 97performance domains using cpumask. For other devices than CPUs the last 98argument must be set to NULL. 99The last argument 'milliwatts' is important to set with correct value. Kernel 100subsystems which use EM might rely on this flag to check if all EM devices use 101the same scale. If there are different scales, these subsystems might decide 102to: return warning/error, stop working or panic. 103See Section 3. for an example of driver implementing this | 1.. SPDX-License-Identifier: GPL-2.0 2 3======================= 4Energy Model of devices 5======================= 6 71. Overview 8----------- --- 87 unchanged lines hidden (view full) --- 96deemed necessary. Only for CPU devices, drivers must specify the CPUs of the 97performance domains using cpumask. For other devices than CPUs the last 98argument must be set to NULL. 99The last argument 'milliwatts' is important to set with correct value. Kernel 100subsystems which use EM might rely on this flag to check if all EM devices use 101the same scale. If there are different scales, these subsystems might decide 102to: return warning/error, stop working or panic. 103See Section 3. for an example of driver implementing this |
104callback, and kernel/power/energy_model.c for further documentation on this 105API. | 104callback, or Section 2.4 for further documentation on this API |
106 107 1082.3 Accessing performance domains 109^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 110 111There are two API functions which provide the access to the energy model: 112em_cpu_get() which takes CPU id as an argument and em_pd_get() with device 113pointer as an argument. It depends on the subsystem which interface it is --- 4 unchanged lines hidden (view full) --- 118em_cpu_get() API. The energy model tables are allocated once upon creation of 119the performance domains, and kept in memory untouched. 120 121The energy consumed by a performance domain can be estimated using the 122em_cpu_energy() API. The estimation is performed assuming that the schedutil 123CPUfreq governor is in use in case of CPU device. Currently this calculation is 124not provided for other type of devices. 125 | 105 106 1072.3 Accessing performance domains 108^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 109 110There are two API functions which provide the access to the energy model: 111em_cpu_get() which takes CPU id as an argument and em_pd_get() with device 112pointer as an argument. It depends on the subsystem which interface it is --- 4 unchanged lines hidden (view full) --- 117em_cpu_get() API. The energy model tables are allocated once upon creation of 118the performance domains, and kept in memory untouched. 119 120The energy consumed by a performance domain can be estimated using the 121em_cpu_energy() API. The estimation is performed assuming that the schedutil 122CPUfreq governor is in use in case of CPU device. Currently this calculation is 123not provided for other type of devices. 124 |
126More details about the above APIs can be found in include/linux/energy_model.h. | 125More details about the above APIs can be found in ``<linux/energy_model.h>`` 126or in Section 2.4 |
127 128 | 127 128 |
1292.4 Description details of this API 130^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 131.. kernel-doc:: include/linux/energy_model.h 132 :internal: 133 134.. kernel-doc:: kernel/power/energy_model.c 135 :export: 136 137 |
|
1293. Example driver 130----------------- 131 132This section provides a simple example of a CPUFreq driver registering a 133performance domain in the Energy Model framework using the (fake) 'foo' 134protocol. The driver implements an est_power() function to be provided to the 135EM framework:: 136 --- 46 unchanged lines hidden --- | 1383. Example driver 139----------------- 140 141This section provides a simple example of a CPUFreq driver registering a 142performance domain in the Energy Model framework using the (fake) 'foo' 143protocol. The driver implements an est_power() function to be provided to the 144EM framework:: 145 --- 46 unchanged lines hidden --- |