Difference between revisions of "RZ-G/RZG2 kernel"

From eLinux.org
Jump to: navigation, search
m (.)
(add Power Saving)
Line 1: Line 1:
 
<big> RZ/G2 Kernel and Linux FAQ </big>
 
<big> RZ/G2 Kernel and Linux FAQ </big>
{{TOC right|width=50%}}
+
__TOC__
  
  
 
= CPU Hotplug =
 
= CPU Hotplug =
You can enable and disable CPU cores by wrriting to a sysfs value.
+
You can enable and disable CPU cores by writing to a sysfs value.
 
<br>
 
<br>
 
This is helpful for when you want to experiment with the performance of your application if you were to use a processor with less CPU cores.
 
This is helpful for when you want to experiment with the performance of your application if you were to use a processor with less CPU cores.
Line 13: Line 13:
  
 
More detailed information can be found here: https://www.cyberciti.biz/faq/debian-rhel-centos-redhat-suse-hotplug-cpu
 
More detailed information can be found here: https://www.cyberciti.biz/faq/debian-rhel-centos-redhat-suse-hotplug-cpu
 +
 +
 +
= Power Saving =
 +
* In Linux, this is a mechanism that is generally supported by all kernels.(it may depend on the version)
 +
* The Renesas kernel has support them.
 +
 +
About power consumption in RZ/G2 series, we have some supported features to save power cost in default environment: 
 +
* CPUHotplug: Turn on/off CPU in runtime.
 +
* CPUIdle: Support 2 modes to turn off clock or power domain of CPU when CPU is idle (nothing to do). 
 +
** Sleep mode: put in sleep state.
 +
** Core standby mode: put in shutdown state. It is described in devicetree of each SoC => It has deeper state than sleep mode so that save more power.
 +
* CPUFreq: there are 6 governors to support "Dynamic Frequency Scaling": 
 +
** '''Performance''': The frequency is always set maximum => It is using as default in our current environment.
 +
** '''Powersave''': The frequency is always set minimum.
 +
** '''Ondemand''': If CPU load is bigger than 95%, the frequency is set max. If CPU load is equal to or less than 95%, the frequency is set based on CPU load.
 +
** Conservative: If CPU load is bigger than 80%, the frequency is set one level higher than current frequency. If CPU load is equal to or less than 20%, the frequency is set one level lower than current frequency.
 +
** '''Userspace''': It sets frequency which is defined by user in runtime.
 +
** '''Schedutil''': Schedutil governor is driven by scheduler. It uses scheduler-provided CPU utilization information as input for making its decisions by formula: freq_next= 1.25 * freq_max* util_of_CPU.
 +
* Power Domain: it is supported as default by Linux Power Management Framework. If a module is not use, system will disable its clock and power domain automatically.
 +
 +
Therefore, select proper method will be based on user's purpose. Here are my examples: 
 +
* Want to use with best performance: disable CPUIdle + use performance frequency governor.
 +
* Want to use less power: enable CPUIdle + use powersave frequency governor.
 +
* Want to balance performance and power: we can use schedutil.
 +
* Want to modify frequency as user's purpose: use userspance frequency governor.
 +
* If user is running realtime environment, I suggest using performance governor to ensure the minimum latency.
 +
Here are some commands to check frequency value and frequency governor in linux: 
 +
* Check available CPU frequency:
 +
: <code> cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_available_frequencies </code>
 +
* Check available CPU frequency governor:
 +
: <code>cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_available_governors </code>
 +
* Change to other governor:
 +
: <code>echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor (performance/userspace/schedutil/...) </code>
 +
* Check current frequency:
 +
: <code> cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq</code>

Revision as of 09:01, 2 November 2020

RZ/G2 Kernel and Linux FAQ


CPU Hotplug

You can enable and disable CPU cores by writing to a sysfs value.
This is helpful for when you want to experiment with the performance of your application if you were to use a processor with less CPU cores.

For example, this command will disable the 2nd core.

$ echo 0 > /sys/devices/system/cpu/cpu1/online

More detailed information can be found here: https://www.cyberciti.biz/faq/debian-rhel-centos-redhat-suse-hotplug-cpu


Power Saving

  • In Linux, this is a mechanism that is generally supported by all kernels.(it may depend on the version)
  • The Renesas kernel has support them.

About power consumption in RZ/G2 series, we have some supported features to save power cost in default environment:

  • CPUHotplug: Turn on/off CPU in runtime.
  • CPUIdle: Support 2 modes to turn off clock or power domain of CPU when CPU is idle (nothing to do).
    • Sleep mode: put in sleep state.
    • Core standby mode: put in shutdown state. It is described in devicetree of each SoC => It has deeper state than sleep mode so that save more power.
  • CPUFreq: there are 6 governors to support "Dynamic Frequency Scaling":
    • Performance: The frequency is always set maximum => It is using as default in our current environment.
    • Powersave: The frequency is always set minimum.
    • Ondemand: If CPU load is bigger than 95%, the frequency is set max. If CPU load is equal to or less than 95%, the frequency is set based on CPU load.
    • Conservative: If CPU load is bigger than 80%, the frequency is set one level higher than current frequency. If CPU load is equal to or less than 20%, the frequency is set one level lower than current frequency.
    • Userspace: It sets frequency which is defined by user in runtime.
    • Schedutil: Schedutil governor is driven by scheduler. It uses scheduler-provided CPU utilization information as input for making its decisions by formula: freq_next= 1.25 * freq_max* util_of_CPU.
  • Power Domain: it is supported as default by Linux Power Management Framework. If a module is not use, system will disable its clock and power domain automatically.

Therefore, select proper method will be based on user's purpose. Here are my examples:

  • Want to use with best performance: disable CPUIdle + use performance frequency governor.
  • Want to use less power: enable CPUIdle + use powersave frequency governor.
  • Want to balance performance and power: we can use schedutil.
  • Want to modify frequency as user's purpose: use userspance frequency governor.
  • If user is running realtime environment, I suggest using performance governor to ensure the minimum latency.

Here are some commands to check frequency value and frequency governor in linux:

  • Check available CPU frequency:
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_available_frequencies
  • Check available CPU frequency governor:
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_available_governors
  • Change to other governor:
echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor (performance/userspace/schedutil/...)
  • Check current frequency:
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq