Changes between Version 2 and Version 3 of DVFS
- Timestamp:
- 06/19/2020 10:16:45 PM (4 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
DVFS
v2 v3 1 1 [[PageOutline]] 2 2 3 = Dynamic Voltage and Frequency Scaling (DVFS) - Ventana Only3 = Dynamic Voltage and Frequency Scaling (DVFS) 4 4 Modern processors allow their core clocks to be scaled in order to trade-off performance vs power or simple to save power when performance is not needed. This is referred to as 'Dynamic Frequency Scaling'. In some cases processors also allow you to scale the core voltages down when using lower clock-speeds which is referred to as 'Dynamic Voltage Scaling'. 5 5 6 The Gateworks Ventana family based off the Freescale i.MX6 CPU family allows DVFS 6 The following Gateworks product families support DVFS: 7 - Ventana (i.MX6) 8 - Venice (i.MX8) 7 9 8 10 = Linux Kernel DVFS API 9 11 The linux kernel provides a DVFS framework that allows each CPU core to have a min/max frequency and a governor that governs it. A sysfs API exists which is used by the cpufreq-utils package. 12 13 The {{{/sys/devices/system/cpu/cpufreq/}}} directory will exist if you have hardware that supports dynamic frequency control and a cpufreq driver. That directory will have one or more policy nodes (ie policy0) which itself has the following nodes: 14 * scaling_governor - get/set the governor 15 * scaling_available_governors - get the available governors 16 * scaling_available_frequencies - get the available frequencies 17 * cpuinfo_cur_freq - get/set the current freq 18 * cpuinfo_max_freq - get/set the max freq 19 * cpuinfo_min_freq - get/set the min freq 20 * scaling_setspeed - set the current freq (if using the userspace governor) 21 * affected_cpus - which cpu's are affected together 22 23 It is possible to have a system that groups cores into different policies. 10 24 11 25 == Governors … … 17 31 * conservative - adjust based on utilization but be a bit more conservative by adjusting gradually 18 32 19 Each cpu has an entry in sysfs at {{{/sys/devices/system/cpu/cpu<n>/cpufreq/}}} at {{{/sys/devices/system/cpu}}} with the following files: 20 * scaling_governor - get/set the governor 21 * scaling_available_governors - get the available governors 22 * scaling_available_frequencies - get the available frequencies 23 * cpuinfo_cur_freq - get/set the current freq 24 * cpuinfo_max_freq - get/set the max freq 25 * cpuinfo_min_freq - get/set the min freq 26 * scaling_setspeed - set the current freq (if using the userspace governor) 27 * affected_cpus - which cpu's are affected together 28 29 Examples: 30 * show governor for cpu0 33 == Examples 34 Here are some examples of using DVFS: 35 * show affected cpu's for policy0: 36 {{{#!bash 37 cat /sys/devices/system/cpu/cpufreq/policy0/related_cpus 38 }}} 39 * show governor for cpu0: 31 40 {{{#!bash 32 41 cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor 33 42 }}} 34 * show available frequencies (in MHz) for cpu043 * show the governor for policy0: 35 44 {{{#!bash 36 cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies 45 cat /sys/devices/system/cpu/cpufreq/policy0/scaling_governor 46 }}} 47 * show available frequencies (in MHz) for policy0 48 {{{#!bash 49 cat /sys/devices/system/cpu/cpufreq/policy0/scaling_available_frequencies 37 50 }}} 38 51 * set 'conservative' governor for a good mix of power-saving and performance 39 52 {{{#!bash 40 echo conservative > /sys/devices/system/cpu/cpu 0/cpufreq/scaling_governor53 echo conservative > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor 41 54 }}} 42 55 * set to lowest power mode using the 'powersave' governor: 43 56 {{{#!bash 44 echo powersave > /sys/devices/system/cpu/cpu 0/cpufreq/scaling_governor57 echo powersave > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor 45 58 }}} 46 59 * set to highest performance mode using the 'performance' governor: 47 60 {{{#!bash 48 echo performance > /sys/devices/system/cpu/cpu 0/cpufreq/scaling_governor61 echo performance > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor 49 62 }}} 50 63 * set 'userspace' governer because perhaps you have a script that wants to adjust it manually based on your own criteria over time: 51 64 {{{#!bash 52 echo userspace > /sys/devices/system/cpu/cpu 0/cpufreq/scaling_governor53 echo 396000 > /sys/devices/system/cpu/cpu 0/cpufreq/setspeed54 echo 792000 > /sys/devices/system/cpu/cpu 0/cpufreq/setspeed55 echo 996000 > /sys/devices/system/cpu/cpu 0/cpufreq/setspeed65 echo userspace > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor 66 echo 396000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_setspeed 67 echo 792000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_setspeed 68 echo 996000 > /sys/devices/system/cpu/cpufreq/policy0/scaling_setspeed 56 69 }}}