Intel-lpmd を Fedora で調教する話

広告

Intel-lpmd:正式名称は「Intel Low Power Mode Daemon」。Intel 公式の「大小核スケジューリング」を改善すると謳うバックグラウンド制御サービスだ。公式が出している以上、それなりの理由はあるんだろう。ただ公式見解では大小核系のみ対応で、大小核じゃない CPU で使っても意味はない。しかもこのサービスは「特定モデル向けにチューニングする」ことが目的で、ユーザーや OEM が専用の XML 設定ファイルを用意して消費電力を最適化できる仕組みになっている。

こんな前置きをしたのは、このサービスが少し前に Fedora でデフォルトインストールに設定されたらしいからだ。しかもタイミング悪くというか、少し前に Fedora のバージョンアップがあり、そこで Arrow Lake-H と WildCat Lake の 2 つの CPU への対応が追加されたとアナウンスされていた。

広告

c22ee555-d2a3-4aca-a3b1-9f55f73ebbb6.png

Arrow Lake-H ユーザーの自分も早速アップデートした。まず LPMD は私のプロセッサ ARL-H をしっかり認識し、設定ファイル /etc/intel_lpmd/intel_lpmd_config_F6_M197.xml を有効にした。ところがしばらく使うとどうも様子がおかしい。設定ファイルを開いて冒頭のコメントを見て、思わず吹き出した。

<?xml version="1.0"?>

<!--
Intel Energy Optimizer (LPMD) configuration for Arrow Lake-H
(family 6, model 0xC5 / 197).

  Performance (PerformanceDef=-1) -> LPMD_OFF  -> all CPUs active
  Balanced    (BalancedDef= 0)    -> LPMD_AUTO -> E+L cores only (P-cores parked)
  Powersaver  (PowersaverDef= 1)  -> LPMD_ON   -> L-cores only

Design: P-cores are NEVER used in Balanced mode. All WLT states use
ActiveLcores=ALL + ActiveEcores=ALL (topology-portable, not hardcoded
CPU numbers). EPP/EPB vary per WLT state to spread the power-performance
tradeoff across E+L cores. If the user wants P-cores, they select
Performance mode or disable LPMD.-->

どんな頭で考えたスケジューリングなのか分からんが、特にこの「 P-cores are NEVER used in Balanced mode」という一文。大半のノート PC は Balanced Mode で使うのに、これじゃ大核が完全に休んでしまう。電力効率は上がるだろうが、性能はガタ落ちじゃないか? お前は Intel の小核と小小核をそこまで信用しているのか?

しかも厄介なことに、これが Stable にまで流れ込んでいる。見たところデフォルトでプリインストールされているようで、この先どれだけの人が被害に遭うか分かったものじゃない。Bug リストを見るとすでに多くの人が爆発している:

https://bugzilla.redhat.com/show_bug.cgi?id=2532653

修正は簡単で、Buglist を参考にしてもいいし、AI に丸投げして書かせてもいい:

自分の ARL-H 285 はこう書き換えた:

<?xml version="1.0"?>
<Configuration>
	<lp_mode_cpus></lp_mode_cpus>
	<lp_mode_epp></lp_mode_epp>
	<Mode>1</Mode>
	<PerformanceDef>-1</PerformanceDef>
	<BalancedDef>0</BalancedDef>
	<PowersaverDef>1</PowersaverDef>
	<HfiLpmEnable>0</HfiLpmEnable>
	<WLTHintEnable>1</WLTHintEnable>
	<WLTHintPollEnable>1</WLTHintPollEnable>
	<HfiSuvEnable>0</HfiSuvEnable>
	<WLTHintMask>15</WLTHintMask>
	<IgnoreITMT>0</IgnoreITMT>
<States>
		<CPUFamily> 6 </CPUFamily>
		<CPUModel> 197 </CPUModel>
		<CPUConfig> * </CPUConfig>
		<State>
			<ID> 1 </ID>
			<Name> UTIL_IDLE </Name>
			<WLTTypeMask> 3 </WLTTypeMask>
			<ActiveLcores>ALL</ActiveLcores>
			<ActiveEcores>ALL</ActiveEcores>
			<IRQMigrate>0</IRQMigrate>
			<EPP>192</EPP>
			<EPB>8</EPB>
		</State>
		<State>
			<ID> 2 </ID>
			<Name> UTIL_IDLE_SUSTAIN </Name>
			<WLTType> 2 </WLTType>
			<ActivePcores>ALL</ActivePcores>
			<ActiveLcores>ALL</ActiveLcores>
			<ActiveEcores>ALL</ActiveEcores>
			<IRQMigrate>0</IRQMigrate>
			<EPP>64</EPP>
			<EPB>4</EPB>
		</State>
		<State>
			<ID> 3 </ID>
			<Name> UTIL_IDLE_BURSTY </Name>
			<WLTType> 3 </WLTType>
			<ActivePcores>ALL</ActivePcores>
			<ActiveLcores>ALL</ActiveLcores>
			<ActiveEcores>ALL</ActiveEcores>
			<IRQMigrate>0</IRQMigrate>
			<EPP>128</EPP>
			<EPB>6</EPB>
		</State>
	</States>
</Configuration>

基本方針は、Balance 時は P コアが必要なときだけ起動し、低負荷なら適度に切るというもの。

これを参考に、もう 1 台の大小核ノート、1215U 用にも独立した設定ファイルを書いた:/etc/intel_lpmd/intel_lpmd_config_F6_M154_T15.xml。自分の CPU がどの設定ファイルに対応するか分からない場合は、lpmd サービスのログを見て、どのファイルを探しているかを確認し、そのファイルを作ればいい。

<?xml version="1.0"?>
<Configuration>
	<lp_mode_cpus></lp_mode_cpus>
	<lp_mode_epp></lp_mode_epp>
	<Mode>1</Mode>
	<PerformanceDef>-1</PerformanceDef>
	<BalancedDef>0</BalancedDef>
	<PowersaverDef>1</PowersaverDef>
	<HfiLpmEnable>1</HfiLpmEnable>
	<WLTHintEnable>1</WLTHintEnable>
	<WLTHintPollEnable>1</WLTHintPollEnable>
	<HfiSuvEnable>0</HfiSuvEnable>
	<WLTHintMask>15</WLTHintMask>
	<util_entry_threshold>10</util_entry_threshold>
	<util_exit_threshold>70</util_exit_threshold>
	<IgnoreITMT>0</IgnoreITMT>
	<States>
		<CPUFamily> 6 </CPUFamily>
		<CPUModel> 154 </CPUModel>
		<CPUConfig> * </CPUConfig>
		<State>
			<ID> 1 </ID>
			<Name> UTIL_IDLE </Name>
			<WLTTypeMask> 3 </WLTTypeMask>
			<ActiveEcores>ALL</ActiveEcores>
			<IRQMigrate>0</IRQMigrate>
			<EPP>192</EPP>
			<EPB>8</EPB>
		</State>
		<State>
			<ID> 2 </ID>
			<Name> UTIL_IDLE_SUSTAIN </Name>
			<WLTType> 2 </WLTType>
			<ActivePcores>ALL</ActivePcores>
			<ActiveEcores>ALL</ActiveEcores>
			<IRQMigrate>0</IRQMigrate>
			<EPP>64</EPP>
			<EPB>4</EPB>
		</State>
		<State>
			<ID> 3 </ID>
			<Name> UTIL_IDLE_BURSTY </Name>
			<WLTType> 3 </WLTType>
			<ActivePcores>ALL</ActivePcores>
			<ActiveEcores>ALL</ActiveEcores>
			<IRQMigrate>0</IRQMigrate>
			<EPP>128</EPP>
			<EPB>6</EPB>
		</State>
	</States>
</Configuration>

同じ基本方針で、ファイルに書き込んだあと lpmd サービスを再起動すればいい。

systemctl restart intel_lpmd
systemctl status intel_lpmd

ARL-H の電力効率はそれほど大きく向上した感じはないが、1215U のほうは効果覿面で、Web 閲覧時のシステム全体の消費電力がしょっちゅう 5W しかない。

本家 plumz.me でこの記事にコメントする

コメントは中国語の本家サイトで受け付けています。このミラーは閲覧専用です。

目次