Schi Heil と叫ぶために

hiroakiuno's blog

big.LITTLE の制御ソフトウェア技術を整理してみよう (その2)

前回の続き。前回は主に用語を整理したので続いて中身の整理。よく知らないものはその都度調べていこう。

まずは IKS について。【後藤弘茂のWeekly海外ニュース】2014年にはメジャーになるARMの省電力技術「big.LITTLE」 - PC Watch からポイントを拾っていくと、

 IKSの利点は、OSのスケジューラに変更を加えず、スケジューラの下で動作する2,000行くらいのコードで実現していることだ。IKSでは、OSのスケジューラからはCPUコアは通常の対称型のSMP(Symmetric Multi-Processor)構成に見えているが、ハードウェア的には非対称なAMP(Asymmetric Multiple Processor)構成となる。

 LinaroのIn-Kernel Switcher(IKS)は、CPUコアを切り替える際に、CPU負荷に応じる。切り替えの遷移ポイントの決定には、CPUコアの電圧と動作周波数を切り替える「DVFS(Dynamic Voltage and Frequency Scaling)」の仕組みを使ってる。LinuxのCPUFreq Governorサブシステムが、CPU使用率をモニタしてCPUの動作周波数を遷移させる。IKSは、DVFSが一定のポイントに達した時にCPUコアをスイッチさせる。

そのため、IKSでは、バーチャルOPP(Operating Performance Point)を設定して、Cortex-A7とCortex-A15それぞれの実際のDVFSポイントにマップしている。OSから見えるのは、バーチャルOPPとなる。

 こうした仕組みを取っているため、IKSではGovernorサブシステムの味付けで、ある程度振るまいを変えることができる。パフォーマンス優先のGovernorなら、より多くbigコアに割り振られることが多くなる。逆に省電力優先のGovernorをベンダーが選択すると、よりLITTLEコアの比率が高くなる。

ここで CPUFreq Governor とか OPP って何なのか調べてみる。

まず CPUFreq というのが一つの単語で、消費電力を抑えたりするために CPU の周波数を上げ下げする linux の仕組みらしい。で Governor は CPUFreq の要素とある。要素というのを Governor と Driver に分けているので、Driver が実体のことだとすると、Governor の方は周波数や電圧を動的に変更するアルゴリズムみたいなものだろうか。

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 elements
The Governor - that makes decisions
The Driver - acts based on the decisions made by the governor


DVFS User Guide - Texas Instruments Wiki

1. What Is A CPUFreq Governor?
==============================

Most cpufreq drivers (except the intel_pstate and longrun) or even most
cpu frequency scaling algorithms only offer the CPU to be set to one
frequency. In order to offer dynamic frequency scaling, the cpufreq
core must be able to tell these drivers of a "target frequency". So
these specific drivers will be transformed to offer a "->target/target_index"
call instead of the existing "->setpolicy" call. For "longrun", all
stays the same, though.

How to decide what frequency within the CPUfreq policy should be used?
That's done using "cpufreq governors".

https://www.kernel.org/doc/Documentation/cpu-freq/governors.txt

以下も参考。

また OPP というのは Operating Performance Point の略で、DVFS で切り替える周波数と電力をペアにした単位のことのようだ。

1.1 What is an Operating Performance Point (OPP)?

Complex SoCs of today consists of a multiple sub-modules working in conjunction.
In an operational system executing varied use cases, not all modules in the SoC
need to function at their highest performing frequency all the time. To
facilitate this, sub-modules in a SoC are grouped into domains, allowing some
domains to run at lower voltage and frequency while other domains run at
voltage/frequency pairs that are higher.

The set of discrete tuples consisting of frequency and voltage pairs that
the device will support per domain are called Operating Performance Points or
OPPs.

https://www.kernel.org/doc/Documentation/power/opp.txt

で、IKS のまとめとしては下記がしっくりくる。

LinaroのIKSは、CPU負荷に応じて2つのコアを切り替える。切り替えの遷移ポイントの決定には、負荷に応じてCPUコアの電圧と動作周波数を切り替える「DVFS(Dynamic Voltage and Frequency Scaling)」の仕組みを使ってる。Linuxの場合は、CPUFreq Governorと呼ばれるサブシステムがあり、CPU使用率をモニタしてCPUの動作周波数を遷移させる。IKSは、Governorからの情報で、DVFSが一定のポイントに達した時にCPUコアをスイッチさせる
【後藤弘茂のWeekly海外ニュース】海外のオクタコア版GALAXY S4の「big.LITTLE」ソフトウェアアーキテクチャ - PC Watch

長いので一旦ここで切ってつづく