cpufreq による動的動作周波数変更 †Linux カーネルには CPU の動作周波数や動作電圧を動的に変更する cpufreq という仕組みがあります。 この仕組みを利用して動作クロックを変更した場合に driver †cpufreq を使用するためには kernel driver を有効にする必要があります。 -> CPU Power management -> CPU Frequency scaling [*] CPU Frequency scaling <*> CPU frequency translation statistics [*] CPU frequency translation statistics details Default CPUFreq governor (userspace) ---> <*> 'performance' governor <*> 'powersave' governor -*- 'userspace' governor for userspace frequency scaling <*> 'ondemand' cpufreq policy governor <*> 'conservative' cpufreq governor [*] Generic CPU0 cpufreq driver ARM CPU frequency scaling drivers ---> で設定します。 governor †CPUfreq governor は動作周波数の変更に関する規則を決定するものです。
cpufreq インタフェース †この設定を有効にした kerenl で起動し、操作は sysfs の cpufreq インタフェースから行います。 # ls /sys/devices/system/cpu/cpu0/cpufreq/ affected_cpus scaling_cur_freq cpuinfo_cur_freq scaling_driver cpuinfo_max_freq scaling_governor cpuinfo_min_freq scaling_max_freq cpuinfo_transition_latency scaling_min_freq related_cpus scaling_setspeed scaling_available_frequencies stats scaling_available_governors このインタフェースで動作周波数や管理ポリシーを確認し設定することが出来ます。
cpufrequtils †このインタフェースを直接操作するのは煩雑なので、操作を行うためのユーティリティー cpufrequtils が用意されています。 # cpufreq-info cpufrequtils 006: cpufreq-info (C) Dominik Brodowski 2004-2009 Report errors and bugs to cpufreq@vger.kernel.org, please. analyzing CPU 0: driver: omap CPUs which run at the same hardware frequency: 0 CPUs which need to have their frequency coordinated by software: 0 maximum transition latency: 300 us. hardware limits: 125 MHz - 600 MHz available frequency steps: 125 MHz, 250 MHz, 500 MHz, 550 MHz, 600 MHz available cpufreq governors: conservative, ondemand, powersave, userspace, performance current policy: frequency should be within 125 MHz and 600 MHz. The governor "userspace" may decide which speed to use within this range. current CPU frequency is 600 MHz (asserted by call to hardware). cpufreq stats: 125 MHz:0.00%, 250 MHz:0.00%, 500 MHz:0.00%, 550 MHz:0.00%, 600 MHz:100.00% bc10 の OMAP3530 は 125、250、500、550、600 MHz で動作させられること、 # cpufreq-set --help cpufrequtils 006: cpufreq-set (C) Dominik Brodowski 2004-2009 Report errors and bugs to cpufreq@vger.kernel.org, please. Usage: cpufreq-set [options] Options: -c CPU, --cpu CPU number of CPU where cpufreq settings shall be modified -d FREQ, --min FREQ new minimum CPU frequency the governor may select -u FREQ, --max FREQ new maximum CPU frequency the governor may select -g GOV, --governor GOV new cpufreq governor -f FREQ, --freq FREQ specific frequency to be set. Requires userspace governor to be available and loaded -r, --related Switches all hardware-related CPUs -h, --help Prints out this screen Notes: 1. Omitting the -c or --cpu argument is equivalent to setting it to zero 2. The -f FREQ, --freq FREQ parameter cannot be combined with any other parameter except the -c CPU, --cpu CPU parameter 3. FREQuencies can be passed in Hz, kHz (default), MHz, GHz, or THz by postfixing the value with the wanted unit name, without any space (FREQuency in kHz =^ Hz * 0.001 =^ MHz * 1000 =^ GHz * 1000000). c、r はマルチプロセッサーのシステムでしか意味がないので # cpufreq-set -f 500MHz 変更に成功した場合はメッセージなど何も表示されません。 # cpufreq-info cpufrequtils 006: cpufreq-info (C) Dominik Brodowski 2004-2009 Report errors and bugs to cpufreq@vger.kernel.org, please. analyzing CPU 0: driver: omap CPUs which run at the same hardware frequency: 0 CPUs which need to have their frequency coordinated by software: 0 maximum transition latency: 300 us. hardware limits: 125 MHz - 600 MHz available frequency steps: 125 MHz, 250 MHz, 500 MHz, 550 MHz, 600 MHz available cpufreq governors: conservative, ondemand, powersave, userspace, performance current policy: frequency should be within 125 MHz and 600 MHz. The governor "userspace" may decide which speed to use within this range. current CPU frequency is 500 MHz (asserted by call to hardware). cpufreq stats: 125 MHz:0.00%, 250 MHz:0.00%, 500 MHz:3.51%, 550 MHz:0.00%, 600 MHz:96.49% (1) また、/proc/cpuinfo を確認すると動作周波数によって BogoMIPS が変化するので、 動作周波数別ネットワークスループット †bc10-router をルーターモードで起動し、 ・kernel 3.3.7
500MHz動作で nuttcp によるテスト負荷に十分な処理能力に達しているため、 ondemand governor での動作 †cpufreq governor を ondemand に設定しすると動作周波数は自動的に |