web-dev-qa-db-ja.com

KVMゲスト内のホストCPU温度

lm_sensorsを使用して、KVMゲストのホストCPU温度を検出しようとしています。

ホストで、 x86_pkg_temp_thermal カーネルモジュールが挿入された状態で、sysfsインターフェイス/sys/class/thermal/thermal_zone*/tempが必要な情報を公開します。

ホスト上のsensors-detectからのlm-sensorsスクリプトの出力は次のとおりです。

$ Sudo sensors-detect
# sensors-detect revision 6284 (2015-05-31 14:00:33 +0200)
# System: LENOVO 20C60065TW [ThinkPad Edge E540] (laptop)
# Kernel: 4.8.8-200.fc24.x86_64 x86_64
# Processor: Intel(R) Core(TM) i7-4702MQ CPU @ 2.20GHz (6/60/3)

This program will help you determine which kernel modules you need
to load to use lm_sensors most effectively. It is generally safe
and recommended to accept the default answers to all questions,
unless you know what you're doing.

Some south bridges, CPUs or memory controllers contain embedded sensors.
Do you want to scan for them? This is totally safe. (YES/no): YES
Silicon Integrated Systems SIS5595...                       No
VIA VT82C686 Integrated Sensors...                          No
VIA VT8231 Integrated Sensors...                            No
AMD K8 thermal sensors...                                   No
AMD Family 10h thermal sensors...                           No
AMD Family 11h thermal sensors...                           No
AMD Family 12h and 14h thermal sensors...                   No
AMD Family 15h thermal sensors...                           No
AMD Family 16h thermal sensors...                           No
AMD Family 15h power sensors...                             No
AMD Family 16h power sensors...                             No
Intel digital thermal sensor...                             Success!
    (driver `coretemp')
Intel AMB FB-DIMM thermal sensor...                         No
Intel 5500/5520/X58 thermal sensor...                       No
VIA C7 thermal sensor...                                    No
VIA Nano thermal sensor...                                  No

Fedora24を実行しているKVMゲストでは、カーネルモジュールを挿入できません:

[root@Fedora ~]# modprobe -v x86_pkg_temp_thermal
insmod /lib/modules/4.8.8300.fc25.x86_64/kernel/drivers/thermal/x86_pkg_temp_thermal.ko.xz 
modprobe: ERROR: could not insert 'x86_pkg_temp_thermal': No such device
[root@Fedora ~]# modprobe -v coretemp
insmod /lib/modules/4.8.8-300.fc25.x86_64/kernel/drivers/hwmon/coretemp.ko.xz 
modprobe: ERROR: could not insert 'coretemp': No such device

ゲストのsensors-detectスクリプトの出力は、そのような機能がホストから公開されていないことを示しています。

[root@Fedora ~]# sensors-detect 
# sensors-detect revision 6284 (2015-05-31 14:00:33 +0200)
# System: QEMU Standard PC (i440FX + PIIX, 1996) [pc-i440fx-2.6]
# Kernel: 4.8.8-300.fc25.x86_64 x86_64
# Processor: Westmere E56xx/L56xx/X56xx (Nehalem-C) (6/44/1)

This program will help you determine which kernel modules you need
to load to use lm_sensors most effectively. It is generally safe
and recommended to accept the default answers to all questions,
unless you know what you're doing.

Some south bridges, CPUs or memory controllers contain embedded sensors.
Do you want to scan for them? This is totally safe. (YES/no): YES
Silicon Integrated Systems SIS5595...                       No
VIA VT82C686 Integrated Sensors...                          No
VIA VT8231 Integrated Sensors...                            No
AMD K8 thermal sensors...                                   No
AMD Family 10h thermal sensors...                           No
AMD Family 11h thermal sensors...                           No
AMD Family 12h and 14h thermal sensors...                   No
AMD Family 15h thermal sensors...                           No
AMD Family 16h thermal sensors...                           No
AMD Family 15h power sensors...                             No
AMD Family 16h power sensors...                             No
Intel digital thermal sensor...                             No
Intel AMB FB-DIMM thermal sensor...                         No
Intel 5500/5520/X58 thermal sensor...                       No
VIA C7 thermal sensor...                                    No
VIA Nano thermal sensor...                                  No

「Intelデジタル温度センサー」をKVMゲストに公開する方法はありますか?

4
Yun-Chih Chen

仮想化されたCPUには温度が存在してはならず、これは予想される動作です。

VMのCPUは仮想であり、実際のCPUに正確に1対1でマッピングされない場合があります。

また、ホスト環境の完全なエミュレーションが見つかることは期待されず、パフォーマンス上の理由から望ましくないことも多い、仮想環境/ VMには予想される違い/トレードオフがあります。

したがって、たとえば、一部の仮想化プラットフォームでは、ハードウェア全体をエミュレートする代わりに、ネットワークインターフェイスカードとディスクコントローラーを準仮想化するための余分な労力が必要です。パフォーマンスの違いは、桁違いに達することがよくあります。

ハードウェアデータ、つまり温度、およびホストのその他の監視データをキャプチャするには、VMの監視に加えて、SNMPサービスの構成など、ホストへの直接監視も行うことをお勧めします。

3
Rui F Ribeiro