bc10
bc10-router

The Dynamic Operating Frequency Change by cpufreq

Linux kernel has cpufreq, a feature that changes the dynamic operating frequency and operating voltage.

There is a particular way to change the operating frequency and voltage highly for a specific CPU. This feature is highly depending on a CPU. A specific device driver is prepared for a particular CPU. cpufreq has been adapted to CPUs of x86 architecture for a while. However, the adaptation of cpufreq on the CPUs of ARM architecture highly depends on its SoC. OMAP3530 of Texas Instruments, a CPU used for bc10, is capable of using cpupfeq since its Linux is based upon 3.2 kernel.

To utilize cpufreq, measure the change of network throughput and power consumption as changing operating clock of the CPU of bc10.

driver

To use cpufreq, let kernel driver active, Setting menuconfig as ARCH=arm, please configure as it is shown below.

-> 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  ---> 

Configure which governor makes active and which active governor is used as the default.

governor

CPUfreq governor determines the rules of operating frequency change.
governors, which OMAP3530 of bc10 can use, are shown below.

performanceMake CPU work at the maximum operating frequency
powersaveMake CPU work at the minimum operating frequency
userspaceAllow root user or root program to change operating frequency, dynamically
ondemandTo depend on CPU load, change the dynamic operating frequency. The frequency is adjusted to CPU Load at low-latency
conservativeTo depend on CPU load, change the dynamic operating frequency. The operating frequency gradually shifts depending on the performance of battery

cpufreq Interface

To let boot the kernel, which enables the previously set-up configuration, its operation is handled from the confreq interface of sysfs.

# 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


To use this interface, configure the operating frequency and management policy. The definition and function of each file are shown below.

affected_cpusThe list of CPUs, whose frequency should be cooperated by software
cpuinfo_cur_freqThe present dynamic operating frequency, which is obtained by hardware (kHz)
cpuinfo_max_freqThe maximum dynamic operating frequency (kHz)
cpuinfo_min_freqThe minimum dynamic operating frequency (kHz)
cpuinfo_transition_latencyThe duration of time, which is required as it shifts the two different states of operating frequency (Nano-sec)
related_cpusRegardless of software and hardware, the list of CPUs, which are needed to be cooperated
scaling_available_frequenciesthe list of available operating frequencies
scaling_available_governorsthe list of available governors
scaling_cur_freqA value of dynamic operating frequency, which is obtained from a governor and cpufreq core. Kernel considers this value as the present dynamic operating frequency (kHz)
scaling_driverHardware driver for cpufreq
scaling_governorGovernors that currently use. Add governors that you like to use by executing echo command.
scaling_max_freqThe conditional maximum dynamic operating frequency, which is managed by the operation policy. To change the maximum frequency, use echo command. To change this configuration, please change this value before the value of the conditional minimum dynamic frequency.

|scaling_min_freq|The conditional minimum dynamic operating frequency, which is conditioned by the operation policy. To change the minimum frequency apply echo command. To alter this configuration, please change the value of the conditional maximum dynamic frequency first.

scaling_setspeedTo change dynamic operating frequency, execute echo command the dynamic operating frequency that you like to change.
statstime_in_stateA list that how many hours each CPU worked at each configurable opeating frequency
total_transTotal number of operating frequency changes
trans_tableA table that shows the configuration and how the operating frequencies are changed from one state to the other.

cpufrequtils

Since it is too tedious to operate directly this interface, there is a utility for operating. The utility is called cpufrequtils. The present setting is handled by cpufreq-info.

# 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%

The performance of the present setting is shown above, and it indicates that:
OMAP3530 of bc10 can operate at 125, 250, 500, 550 and 600 MHz,
the present governor is userspace, and
the CPU is currently operating at 600MHz.

cpufreq-set is used for changing the current configuration.

# 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).

The Option c and r are only for multi-processor system, so option d, u, g, and f are actually applicable to bc10.

To make bc10 operate at 500Mz, please apply the command for changing its configuration.

# cpufreq-set -f 500MH


After executing the command above, there are no indications whether the new configuration is successfully applied or not. To check the effectiveness of the new configuration, it is necessary to execute cpufreq-info again.

# 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)

To check /proc/cpuinfo, it shows changes in BogoMIPS, depending on its operating frequencies.
To use BogoMIPS, the results of a new configuration are recognized.

Comparing network throughput against different operating frequencies

To boot bc10-router with the router mode, compare the level of network throughput against different operating frequencies of OMAP3530. The operating frequencies are 125, 250, 500, 550, and 600MHz. The frequencies are configured by cpufreq.
To measure network throughputs, nuttcp is used. In the network throughput testing environment, the other side of the network uses a PC, and its network configuration is the same as the one used at bc10-router/measuring network performance.

WAN Side: bc10-router nuttcp -S
LAN Side: PC nuttcp 192.168.30.1

kernel 3.3.7

  • 600MHz
    BogoMIPS 581.89
    N12345678910Avg.
    Mbps51.682250.495749.909550.021352.213347.862853.430153.224153.993653.503351.6336
    %TX66666777777
    %RX2424232324222424242424
    retrans00000000000
    msRTT1.512.011.491.491.531.921.381.411.451.401.56
  • 550MHz
    BogoMIPS 533.31
    N12345678910Avg.
    Mbps50.639449.483656.459756.842052.981255.749956.556256.347152.726754.833654.2619
    %TX66777777777
    %RX2423252525272627252525
    retrans00000000000
    msRTT3.291.581.342.201.891.651.342.571.621.561.90
  • 500MHz
    BogoMIPS 484.74
    N12345678910Avg.
    Mbps56.627057.387257.096656.783657.333155.972256.136455.856256.521855.629356.5343
    %TX67667777777
    %RX2325232424252626262625
    retrans00000000000
    msRTT1.421.603.471.981.421.731.581.541.772.571.90
  • 250MHz
    BogoMIPS 242.87
    N12345678910Avg.
    Mbps31.696229.815329.775130.547031.364131.696432.698131.665830.910828.025830.8194
    %TX22222443333
    %RX1415141416111110181814
    retrans00000000000
    msRTT2.312.151.772.321.982.563.731.701.852.032.24
  • 125MHz
    BogoMIPS 121.43
    N12345678910Avg.
    Mbps16.327916.013515.192215.618415.822716.698116.557516.419916.173116.143316.0988
    %TX11111111111
    %RX141210141312101391512
    retrans00000000000
    msRTT3.052.442.362.314.315.221.992.332.614.583.11

Results

Since the test load of nttcp consumes sufficient processing power of the CPU at the operating frequency of 500MHz, The difference in the throughput at the operating frequencies of 500MHz or higher is not recognized.

At less than 500MHz of operational frequencies, the relationship between operating frequency of CPU and network throughput is proportional. As the operating frequency of the CPU is lowered from 500MHz to 250MHz, its processing power is reduced to almost a half, and throughput also becomes almost a half of 500MHz's. As the operating frequency is set to 125MHz, its throughput becomes almost a half of 250MHz's and almost a quarter of 500MHz's.

As Several Wi-Fi clients are connected and communicated to bc10-router simultaneously, the maximum operating frequency could be needed. If only bc10-router is connected to only one router, the CPU will provide adequate processing power for handling this task at 500MHz of operating frequency.

Operated by ondemand governor

As the configuration is changed from cpufreq governor to ondemand governor, the operating frequency is shifted automatically from one frequency to the other, depending on CPU load. As The CPU load gets heavier, its frequency sifts automatically higher. This feature would be highly effective for conserving the energy and reducing heat from CPU.

Revision History

  • 2013-08-09 This article is initially uploaded.

Front page   Edit Freeze Diff Backup Upload Copy Rename Reload   New List of pages Search Recent changes   RSS of recent changes
Last-modified: 2013-08-09 (Fri) 12:29:20 (1628d)