DVFS User Guide
2016-04-29 17:35
411 查看
What is DVFS?
Dynamic Voltage and Frequency scaling is a framework to change the frequency and/or operating voltage of a processor(s) based on system performance requirements at the given point of time.
Frequency Scaling
Frequency scaling is achieved using CPUFreq framework.
What is CPUFreq?
CPUfreq is a linux kernel framework that monitors the performance requirements of a processor(s) and takes decisions to increase or decrease operating frequency in order to save power and/or reduce leakage power.
CpuFreq Architecture
CPUFreq consists two elementsThe Governor - that makes decisions
The Driver - acts based on the decisions made by the governor
Policy and Governor
Policy
Policy is set of rules the system is bound by such as min and max frequency for each cpu, availabilty of a frequency. Policy for a cpu is created during the CPUFreq framework initialization based on the frequency table.Frequency Table
Frequency table consists of available frequencies for all cpus in the system. Frequency table is generated/populated based on the Operating Performance Point(OPP) list for each cpu.
OPP List
Operating performance Point(OPP) is a tuple consisting a frequency value and voltage required to run at the frequency. OPP table contains OPPs with a cpu/device name they are applicable to and an availabilty flag. OPP information of each device is added to
OPP list.
Governor
Governor continuosly monitors the system perfomance requirements and when the requirement to change the frequency arises it checks the current cpu policy for frequency limits and requests the driver to change the frequency.
Driver
Multiple drivers can exist in the kernel but there will be only one scaling driver which performs actions based on governors decision.When the govenor request the driver to change the frequency to a target value, driver checks the frequency availability inthe OPP list. If its found it scales the device to new frequency.
Governors provided by CPUFreq
The following governors are available in CPUFreq frame workPerformance
Powersave
Ondemand
Userspace
Conservative
'NOTE: For more information each governor refer to Linux kernel documentation @ <kernel>/Documentation/cpu-freq/governors.txt
Default Governor
Default governor is "performance". The default governor can be changed through 'menuconfig':Chose the governor you want to use as default governor by selecting it from the list at: CPU Power management options ---> [*] CPU frequency scaling Default CPUFreq governor (performance) ---> (x) performance () userspace () ondemand () conservative
Build Multiple governors
Multiple governors can be built and exist in the kernel by selecting them through "menuconfig".Select the governors you want to build in to kernel. CPU Power management options ---> [*] CPU frequency scaling Default CPUFreq governor (performance) ---> [*] performance [*] userspace [*] ondemand [] conservative
Governors can be switched at any time through the 'sysfs' interface.
To list all available governors:
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
To see current active governor
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
To switch to a different governor
echo -n "<governor_name>" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
e.g. to switch to 'userspace' governor
echo -n "userspace" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
To see current
CPUFreq Frequency transition notification
CPUFreq driver supports notifications of frequency changes
CPUFreq User Interface
CPUFreq exports a lot of information to user through sysfs interface To see information pertaining to a cpu(say cpu0):current frequency of a cpu:
cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq
Available frequencies:
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
Available governors
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
Current governor/ governor in use
cat /sys/devices/ system/cpu/cpu0/cpufreq/scaling_governor
Voltage Scaling
Voltage scaling is achieved using voltage layer and regulator framework(driver). When the CPUFreq driver scales the device frequency, voltage corresponding to the frequency(target_voltage) is looked-up in the opp list. The device scale function requests thevoltage layer to scale the device voltage to the target_voltage.
Voltage Layer
The voltage layer consists of the information of all voltage domains in the system and configures all vdds during voltage layer initialization. When a vdd is configured a regulator supply handle is acquired and stored in the corresponding vdd structure.Theregulators scale/set voltage function is plugged in to the vdd's voltage scale function pointer. Thus when a voltage change is requested forwarded to a vdd. The voltage layer requests the regulator framework to change the device voltage to the target voltage.
Regluator driver verifies if the target voltage is in with in the limits of the voltage domain and regulator supply constraints. If all the checks go through then regulator changes the voltage of the requested device to the target voltage.
Transitioning to a different Power state(OPPs)
Userspace governor
Using "userspace" governor one can change the current OPP:Select userspace governor
echo -n "userspace" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
When using "userspace" governor to change to a low/high power state/OPP, first check the available frequencies:
$cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
Select a frequency and to change current cpu frequency do:
$echo -n "<new_frequency> > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed
when the frequency is changed, system voltage is also changed to meet the new requirements as part of scaling: This is done in two ways:
* when new frequency is higher (moving to high power state/opp) * Voltage is increased first then the frequency, * when new frequency is lower (moving to low power state/opp) * Frequency is reduced first then the voltage.
All other governors
For all other governors user does not need to give input in order to move to a low power/high power state.The governor takes the decision to transit based on system requirements and does the scaling of frequency and voltage.
Each governors provides some configuration options which can be set/modified through sysfs. For detailed configuration options available for each governor refer to kernel documentation on governors @<kernel>/Documentation/cpu-freq/governors.txt
相关文章推荐
- 探秘Java中String、StringBuilder以及StringBuffer
- NGUI与UGUI制作Loading条
- 评价网站UI--北京邮电大学首页
- 分布式Unique ID的生成方法一览
- Android 属性文件build.prop,获取属性以及设置属性
- CoreThink主题开发(一)使用H-ui开发博客主题之搭建目录结构
- iOS当UITableViewCell被选中或者高亮的时候,它的所有子view的颜色都会改变
- leetcode——300—— Longest Increasing Subsequence
- poj2524 Ubiquitous Religions
- java1.7集合源码阅读:ArrayBlockingQueue
- StringBuilder在高性能场景下的正确用法
- UVA-348 Optimal Array Multiplication Sequence
- 如何给Core Data添加UNIQUENESS约束
- [原创]Burp Suite web应用程序渗透测试神器
- 2016 UESTC Training for Data Structures
- poj 3080 Blue Jeans kmp 字符串匹配
- maui 限制使用节点数
- JUI框架表单验证
- [iOS]修改UILabel的行间距/段间距/缩进
- UIView的setNeedsLayout, layoutIfNeeded 和 layoutSubviews 方法之间的关系解释