freebsd:tuning_power_consumption

差分

このページの2つのバージョン間の差分を表示します。

この比較画面にリンクする

両方とも前のリビジョン 前のリビジョン
次のリビジョン
前のリビジョン
最新のリビジョン 両方とも次のリビジョン
freebsd:tuning_power_consumption [2015-03-24 21:01]
Decomo
freebsd:tuning_power_consumption [2019-11-29 19:32]
Decomo
行 5: 行 5:
 Alexandar Motin 記す: Alexandar Motin 記す:
  
-I would like to summarize some of my knowledge on reducing FreeBSD power consumption and describe some new things implemented in FreeBSD 8.x/9.x. The main character of this story is my 12" Acer TravelMate 6292 laptop with C2D T7700 2.4GHz CPU965GM chipset and SATA HDD.+FreeBSDでの消費電力削減に関して私の知るところをまとめ、FreeBSD 8.x/9.xで実装されたいくつかの新しい事柄を説明しようと思います。このストーリーの主人公は、C2D T7700 2.4GHz CPU965GMチップセット、SATA HDDを搭載した私の12インチAcer TravelMate 6292ラップトップです。
  
-Modern systems, especially laptops, are implementing big number of power-saving technologies. Some of them are working automatically, other have significant requirements and need special system tuning or trade-offs to be effectively used.+現代のシステム、とりわけラップトップは数多くの省エネ技術を搭載しています。それらのいくつかは自動で機能するものの、その他は効果を発揮するための明示的な設定と特別なシステムチューニング、トレードオフが存在します。
  
-So here is the steps:+ 
 +ここから順にみていきます。
  
 ==== 1. CPU ==== ==== 1. CPU ====
  
 CPUはシステムで最も消費する部分です。 CPUはシステムで最も消費する部分です。
-フル稼働下ではそれだけで40W以上((原文ではconsume more then 40W of powerとなっているが、more than 40Wの間違いか?))の電力を消費しますが、実際のラップトップ利用で最も重要なのはアイドル消費電力です。+フル稼働下ではそれだけで40W以上の電力を消費しますが、実際のラップトップ利用で最も重要なのはアイドル消費電力です。
 Core2Duo T7700 CPUは2つのコアを持ち、2.4GHzで動作し、2400, 2000, 1600, 1200, 800MHzの段階のPステートを使うEISTテクノロジーをサポートし、C1, C2, C3の待機Cステートと加えてスロットリングをサポートします。 Core2Duo T7700 CPUは2つのコアを持ち、2.4GHzで動作し、2400, 2000, 1600, 1200, 800MHzの段階のPステートを使うEISTテクノロジーをサポートし、C1, C2, C3の待機Cステートと加えてスロットリングをサポートします。
 では、どうやってそれを使うのでしょうか: では、どうやってそれを使うのでしょうか:
行 38: 行 39:
 </code> </code>
  
-Intel Turbo Boost機能の制御のために、ACPIは公称より1MHz余分な性能レベルを報告するかもしれません。 +Intel Turbo Boost機能の制御のために、ACPIは公称クロック周波数より1MHz多い追加の性能レベルを報告するかもしれません。 
-例えば、Core i7-870では下記のようなレポートを見るでしょう:+例えば、Core i7-870では下記のようなレポートを見ることができるでしょう:
  
 <code> <code>
行 68: 行 69:
 C3ステートは、CPUが全ての内部クロックを完全に停止し、電圧を下げ、システムバスからの切り離しを許可します。 C3ステートは、CPUが全ての内部クロックを完全に停止し、電圧を下げ、システムバスからの切り離しを許可します。
 このステートは更なる省エネ効果をもたらしますが、安くはなくトレードオフを必要とします。 このステートは更なる省エネ効果をもたらしますが、安くはなくトレードオフを必要とします。
-C3ステートでCPUが完全に止まるや否や、FreeBSDがSMPでイベントタイマーとして使用する各CPUコア内のローカルAPICタイマーは機能しなくなります。 +C3ステートでCPUが完全に止まると同時に、FreeBSDがSMP環境下でイベントタイマーとして使用する各CPUコア内のローカルAPICタイマーは機能しなくなります。 
-それはシステムタイマーを止め、スケジューリングを破壊し、これはシステムを死へと誘います。+それはシステムタイマーを止め、スケジューリングを破壊し、システムを死へと誘います。
 この問題に対する唯一の解決策は幾つかの外部タイマーを使うことです。 この問題に対する唯一の解決策は幾つかの外部タイマーを使うことです。
  
 C1Eとして知られる擬似ステートもあります。 C1Eとして知られる擬似ステートもあります。
 これはCステート対応のないOSで、モダンなCPUがより上手く動くための次善策です。 これはCステート対応のないOSで、モダンなCPUがより上手く動くための次善策です。
-BIOSで有効にすると、そのOSによってC1ステートを要求された際に、CPUが幾つかのより深いCステートに入る事を可能にします。+BIOSで有効にすると、OSによってC1ステートを要求された際に、CPUが幾つかのより深いCステートに入る事を可能にします。
  
 通常、AMDのCPUとBIOSは実際のCステートをOSに見せませんが、代わりにC1Eメカニズムだけを使います。 通常、AMDのCPUとBIOSは実際のCステートをOSに見せませんが、代わりにC1Eメカニズムだけを使います。
行 99: 行 100:
  
 これによりシステム応答時間が僅かに増加するかもしれませんが、ラップトップにとって重要なことではありません。 これによりシステム応答時間が僅かに増加するかもしれませんが、ラップトップにとって重要なことではありません。
-Also we may avoid additional 128 interrupts per second per core, by the cost of scheduling precision, with using i8254 timer also for statistic collection purposes instead of RTC clock, by using another newly added option:+別の新規オプションを追加することで、RTCの代わりに静的コレクション用途のi8254タイマを用いて、スケジューリング精度のコストによる1コア毎秒間128回の追加割込みを回避することもできるでしょう。
  
 <code> <code>
行 119: 行 120:
 効果的なC3ステート使用の結果、C2+powerdと比較して約2Wの削減です。 効果的なC3ステート使用の結果、C2+powerdと比較して約2Wの削減です。
  
-As soon as entering C1E on AMD CPUs may result in unexpected and uncontrolled entering C3 and resulting local APIC timer stop, FreeBSD 8.x blocks C1E functionality completely.+AMD CPUにおいてC1Eステートへの突入は、予測不能で制御不能なC3ステートへの落下を引き起こし、ひいてはローカルAPICタイマの停止に繋がる可能性があるため、FreeBSD 8.xではC1E機能を完全にブロックします。
  
 == FreeBSD 9.x == == FreeBSD 9.x ==
  
-FreeBSD 9.xは新しいイベントタイマーサブシステム''eventtimers(4)''を持ち、現代的なチップセットの殆どに存在しCPU電源管理に左右されない、HPETを含む更なる種類のタイマーハードウェアサポートを可能にします。+FreeBSD 9.xは新しいイベントタイマーサブシステム''eventtimers(4)''を持ち、現代的なチップセットの殆どに存在しCPU電源管理に左右されない、HPETを含む更なる種類のタイマーハードウェアサポートを可能にします。
 システムは最適と思われるタイマーを自動的に選択しますが、''sysctl''を通してタイマーを確認し動的に変更することも可能です。 システムは最適と思われるタイマーを自動的に選択しますが、''sysctl''を通してタイマーを確認し動的に変更することも可能です。
  
-また、''eventtimers(4)''はワンショットタイマー操作モードの対応を追加しまし、そしてそれは何か行う事がある時だけ割り込みを生成します。 +また、''eventtimers(4)''はワンショットタイマー操作モードの対応を追加し、それは何か行う事がある時だけ割り込みを生成します。 
-That allows to not reduce kern.hz variable -- even multicore system should have only about 50-100 interrupts per second total when idle. But you still may want to do it, to reduce effect of some power-ineffectively written applications.+これにより''kern.hz''を減らさずに済み、マルチコアシステムでさえアイドル時の合計割込み数がたった50100回で済みます。 
 +それでもなお''kern.hz''の削減は、いくつかの電源効率を考えずに作られたアプリケーションに対して有効です。
  
 FreeBSD 9.x adds check whether it safe to use specific C-state with present event timer and may automatically block C2/C3 states, making it mostly safe.  FreeBSD 9.x adds check whether it safe to use specific C-state with present event timer and may automatically block C2/C3 states, making it mostly safe. 
行 194: 行 196:
 ==== 5. 無線 ==== ==== 5. 無線 ====
  
 +WiFiとBluetoothのアダプタは、使用時(当方の''iwm(4)''のWiFiがつながっている時は最大2W)ないし有効にしただけ(0.5W)で有意に電力を消費します。
  
-WiFi and Bluetooth adapters can consume significant power when used (up to 2W when my iwn(4) WiFi is connected) or just enabled (0.5W). +いくつかのWiFiアダプタ(当方の''iwm(4)''のような)は、未使用時に無線回路を無効にするといった、省電力モードに対応します。 
- +これを有効にするには、以下のオプションを''ifconfig''インタフェースに設定します。
-Some WiFi adapters (like my iwn(4)) support power-saving mode, disabling radio during inactivity periods. It can be enabled by adding+
  
 +<code>
 powersave powersave
 +</code>
  
-option to the ifconfig interface options. This may significantly reduce WiFi power consumption by the price of slightly increased link latency.+この有意義なWiFi消費電力の削減は、リンク遅延の若干の増加と引き換えに行われる可能性があります。
  
 ==== 6. HDAモデム ==== ==== 6. HDAモデム ====
  
- +私は驚いたのですが、内蔵HDAモデムは未使用時でさえ約1Wの電力を消費していました。 
-I was surprised, but integrated HDA modem consumed about 1W of power even when not used. I have used the most radical solution - removed it mechanically from socket. Case surface in that area become much cooler.+私は最も過激な解決策を用いました─物理的にソケットから外したのです。 
 +その場所にあたるケースの表面の温度が以前より下がりました。
  
 ==== 7. HDAサウンド ==== ==== 7. HDAサウンド ====
  
 +サウンド生成割り込みの数を減らすため、私は''loader.conf''に追加しました:
  
-To reduce number of sound generated interrupts I have added to the loader.conf+<code conf>
 hw.snd.latency=7 hw.snd.latency=7
 +</code>
  
-On FreeBSD before 9-STABLE of 2012-03-10 also may be useful to increase maximal buffer sizes:+2012-03-10以前のFreeBSD 9-STABLEでは、最大バッファサイズを増やす事も有益かもしれません:
  
 +<code conf>
 hint.pcm.0.buffersize=65536 hint.pcm.0.buffersize=65536
 hint.pcm.1.buffersize=65536 hint.pcm.1.buffersize=65536
 +</code>
  
 ==== 8. HDD ==== ==== 8. HDD ====
  
 +まず、ありふれたオススメ設定は一時ファイル用にtmpfsを使う事です。RAMは消費電力へのインパクトが少なく、速く、
  
 First common recommendation is use tmpfs for temporary files. RAM is cheap, fast and anyway with you. Also you may try to setup automatic idle drive spin-down, but if it is the only system drive you should be careful, as every spin-up reduces drive's life time. For several months (until I have bought SATA SSD) I have successfully used SDHC card in built-in PCI sdhci card reader as main file system. On random read requests it is much faster then HDD, but it is very slow on random write. Same time it consumes almost nothing. USB drives could also be used, but effect is much less as EHCI USB controller consumes much power. Spinning-down my 2.5" Hitachi SATA HDD saves about 1W of power. Removing it completely saves 2W. First common recommendation is use tmpfs for temporary files. RAM is cheap, fast and anyway with you. Also you may try to setup automatic idle drive spin-down, but if it is the only system drive you should be careful, as every spin-up reduces drive's life time. For several months (until I have bought SATA SSD) I have successfully used SDHC card in built-in PCI sdhci card reader as main file system. On random read requests it is much faster then HDD, but it is very slow on random write. Same time it consumes almost nothing. USB drives could also be used, but effect is much less as EHCI USB controller consumes much power. Spinning-down my 2.5" Hitachi SATA HDD saves about 1W of power. Removing it completely saves 2W.
行 236: 行 245:
 ==== 10. USB ==== ==== 10. USB ====
  
 +以下のコマンドを実行することで、USBデバイスは個々に省エネモードの設定を切り替えることができます。
  
-USB devices can individually be switched to and from power save mode by running the following commands: +<code> 
- +データが流れていない時にUSBデバイスを自動でサスペンドさせる
-This command will enable automatic suspend of the USB device when no data traffic is pending.+
 usbconfig -d X.Y power_save usbconfig -d X.Y power_save
  
-This command will disable USB power save for the given device.+# USBデバイスの省エネモード設定を無効にする
 usbconfig -d X.Y power_on usbconfig -d X.Y power_on
 +</code>
 +
 +デフォルト設定はUSB HUBを除いて全て「電源オン」です。
 +USBデバイスの省エネ設定を有効化する前に、USBデバイスのコンフィギュレーションデスクリプタの確認、すなわち''"bmAttributes"''フィールドでデバイスがリモート起動に対応しているか確認すべきです。
 +USBのサスペンド/レジュームによる遅延がUSB規格内に収まるよう、システムタイマーレートが250Hz未満でUSB省エネ設定をすることは非推奨です。
  
 The default for all devices except USB HUBs is power on. You should check the configuration descriptor of your device, that the "bmAttributes" field indicates that the device supports remote wakeup before enabling power save on a random USB device. It is not recommended to set the system timer tick rate below 250 HZ and enable USB power save, due to some USB suspend and resume delays which must comply to the USB specification. The power save feature also applies in the same way to USB device/gadget mode. The default for all devices except USB HUBs is power on. You should check the configuration descriptor of your device, that the "bmAttributes" field indicates that the device supports remote wakeup before enabling power save on a random USB device. It is not recommended to set the system timer tick rate below 250 HZ and enable USB power save, due to some USB suspend and resume delays which must comply to the USB specification. The power save feature also applies in the same way to USB device/gadget mode.
  • freebsd/tuning_power_consumption.txt
  • 最終更新: 2019-12-01 19:16
  • by Decomo