Host CPU temperature in KVM guest


Yun-Chih Chen

I am trying to use to lm_sensorsdetect host CPU temperature in a KVM guest.

In the host, after inserting the x86_pkg_temp_thermal kernel module, the sysfs interface /sys/class/thermal/thermal_zone*/tempwill display the required information.

Here is the output of the sensors-detectscript on the host 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

In a KVM guest running Fedora 24, kernel modules cannot be inserted:

[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-detectThe output of the script in the guest indicates that the host has not exposed this feature.

[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

Is there any way to expose the "Intel Digital Thermal Sensor" to the KVM guest?

Rui F Ribeiro

There should be no temperature in the virtual CPU, this is expected behavior.

CPUs in a VM are virtual and they may not map exactly one-to-one to real CPUs.

In virtual environments/VMs there are also expected differences/trade-offs, where a full emulation of the host environment is not expected to be found, and usually isn't even desirable for performance reasons.

So, for example, in some virtualization platforms extra effort is put into paravirtualizing network interface cards and disk controllers rather than simulating full hardware - the difference in performance can often be orders of magnitude.

In order to capture hardware data (i.e. temperature) and other monitoring data of the host, I recommend monitoring the host directly, such as configuring SNMP services, in addition to monitoring the VM.

Related


Ubuntu Server 18.04.1 guest on Ubuntu Server 18.04.1 host, KVM

user3006062 I'm trying to install an Ubuntu Server 18.04.1 guest on an Ubuntu Server 18.04.1 host using KVM. I have downloaded ubuntu-18.04.1-live-server-amd64.iso to the host. When I run the following command: sudo virt-install -n marmoset-eugo-1 --descriptio

KVM high CPU host crashes

lrussell123 I'm currently running KVM as a hypervisor on 14.04.5 LTS. When CPU usage is high, the host will crash badly, killing the monitor and keyboard. There is no sign of a kernel panic or anything else, everything will go away. I can't track anything in t

Host CPU does not scale frequency when required by KVM guest

Huygens Observation: I have an HP server with an AMD dual core CPU (Turion II Neo N40L) that can scale the frequency from 800 to 1500 MHz. Frequency scaling is available under Ubuntu 12.04 with FreeBSD 9 and Linux kernel 3.5. However, when I put FreeBSD 9 in a

Host CPU does not scale frequency when required by KVM guest

Huygens Observation: I have an HP server with an AMD dual core CPU (Turion II Neo N40L) that can scale the frequency from 800 to 1500 MHz. Frequency scaling is available under Ubuntu 12.04 with FreeBSD 9 and Linux kernel 3.5. However, when I put FreeBSD 9 in a

How to prevent time drift in Debian guest on CentOS KVM host?

username I know I can install ntpin the guest , but the suggestions that have confused me so far from googling suggest that it's not necessary. The host is CentOS 6.3 and the guest is Debian Wheezy, which seems to use the kvm clock as the time source: # cat /s

How to copy paste from host to KVM guest?

Ellopio I have a QEMU/KVM virtual machine created with Virtual Machine Manager. I want to be able to copy text on the host and paste it into the guest and vice versa. How to share clipboard between host and guest? Ellopio The solution is simple. Just install t

Share folder from host to guest VM using KVM

OK I want to share a folder from the host machine (Linux) to a Linux VM that is running on it. After some research, I used the 9p (version=9p2000.L) share, following the instructions on the link below: http://www.linux-kvm.org/page/9p_virtio Problem: I can't r

Unable to resume KVM guest after rebooting host

Japanese and Chinese I'm running KVM on Linux Mint 17.1, kernel 3.16.0-31-generic. The only guest is a Windows 8.1 VM. I noticed that if the host is restarted while the guest is running, the guest cannot be recovered after the host restarts. Virt-manager just

KVM host, add LV to guest

Bafast I have a KVM host with a software RAID 10 array. A software RAID 10 array is a PV on the host, with only one VG. I'm using several LVs ( data storage for KVM guest .imgfiles ) at the host level. Typically, when adding a new disk to the guest, I create a

KVM guest access host USB serial dongle

Sardathrion - Preventing SE Abuse I have a KVM virtual machine running CentOS 7 on a host running Fedora 24. I installed a USB serial dongle (actually an RFID reader, but that should be fine) on that host. The host can see it after running: sudo modprobe usbse

KVM host networking - guest connection issues

Mike Souler There seems to be a lot of stuff on this topic already, so apologies for adding information, but I haven't had any luck finding anything that can solve my problem. My guests can't ping my default gateway, but my host can ping my default gateway. I

KVM: VPN host, guest needs VPN and host access to NFS

diagonal I'm running an Ubuntu guest in KVM, which in turn runs on an Ubuntu host. The host network goes through a VPN (OpenVPN), providing tun0. I need the guest network to go through the VPN as well, except I need to be able to access the host over the netwo

How to copy paste from host to KVM guest?

Ellopio I have a QEMU/KVM virtual machine created with Virtual Machine Manager. I want to be able to copy text on the host and paste it into the guest and vice versa. How to share clipboard between host and guest? Ellopio The solution is simple. Just install t

High KVM host CPU usage for Win10 guest

Mr. Calvin Some time ago, it was noticed that Windows 10 1803 WM would give high CPU usage on the host, say 25%, even though the client CPU usage was 0%. Solved this by having the following settings in the virt XML file: <hyperv> <relaxed state='on'/> <

KVM high CPU host crashes

lrussell123 I'm currently running KVM as a hypervisor on 14.04.5 LTS. When CPU usage is high, the host will crash badly, killing the monitor and keyboard. There is no sign of a kernel panic or anything else, everything will go away. I can't track anything in t

How to copy paste from host to KVM guest?

Ellopio I have a QEMU/KVM virtual machine created with Virtual Machine Manager. I want to be able to copy text on the host and paste it into the guest and vice versa. How to share clipboard between host and guest? Ellopio The solution is simple. Just install t

KVM host, add LV to guest

Bafast I have a KVM host with a software RAID 10 array. A software RAID 10 array is a PV on the host, with only one VG. I'm using several LVs ( data storage for KVM guest .imgfiles ) at the host level. Typically, when adding a new disk to the guest, I create a

Unable to resume KVM guest after rebooting host

Japanese and Chinese I'm running KVM on Linux Mint 17.1, kernel 3.16.0-31-generic. The only guest is a Windows 8.1 VM. I noticed that if the host is restarted while the guest is running, the guest cannot be recovered after the host restarts. Virt-manager just

Host CPU temperature in KVM guest

Yun-Chih Chen I am trying to use to lm_sensorsdetect host CPU temperature in a KVM guest. In the host, after inserting the x86_pkg_temp_thermal kernel module, the sysfs interface /sys/class/thermal/thermal_zone*/tempwill display the required information. Here

Host CPU does not scale frequency when required by KVM guest

Huygens Observation: I have an HP server with an AMD dual core CPU (Turion II Neo N40L) that can scale the frequency from 800 to 1500 MHz. Frequency scaling is available under Ubuntu 12.04 with FreeBSD 9 and Linux kernel 3.5. However, when I put FreeBSD 9 in a

KVM: VPN host, guest needs VPN and host access to NFS

diagonal I'm running an Ubuntu guest in KVM, which in turn runs on an Ubuntu host. The host network goes through a VPN (OpenVPN), providing tun0. I need the guest network to go through the VPN as well, except I need to be able to access the host over the netwo

KVM guest access host USB serial dongle

Sardathrion - Preventing SE Abuse I have a KVM virtual machine running CentOS 7 on a host running Fedora 24. I installed a USB serial dongle (actually an RFID reader, but that should be fine) on that host. The host can see it after running: sudo modprobe usbse

KVM host networking - guest connection issues

Mike Souler There seems to be a lot of stuff on this topic already, so apologies for adding information, but I haven't had any luck finding anything that can solve my problem. My guests can't ping my default gateway, but my host can ping my default gateway. I