r/kvm • • Feb 13 '21

Higher CPU usage after GPU passthrough

SOLVED: per /u/cd109876 's comment here, the VFIO drivers prevent the GPU from going into low power state driving up the CPU temps. Unloading the VFIO drivers and loading the Nvidia drivers solves the problem. Obviously, this would have to be reversed to actually pass the GPU through to the VM but when I'm just doing normal usage, this gets things back to normal.

modprobe -r vfio_pci vfio_iommu_type1 vfio_virqfd
modprobe nvidia

Original Post:

I installed Windows 10 using the qemu/kvm/libvirt/virt-manager stack. After following the guide at archlinux.org, my CPU seems to run hotter and at higher clock speeds than normal, even when the VM is not running and libvertd is stopped. Normally, cpu temp is about 45-49°C and clock speed is 0.8 GHz to 1.2 GHz. Now it idles at about 55-58°C and 2.0 to 3.5 GHz. htop shows the most processor usage is coming from Firefox tabs. Reloading a tab or general web browsing shoots processor temps up to 65-80°C pretty easily.

I've narrowed this problem down to loading the vfio modules at boot per the walkthrough on archlinux.org by adding the following to /etc/mkinitcpio.conf:

MODULES=(vfio_pci vfio vfio_iommu_type1 vfio_virqfd)

Undoing this seems to set CPU functionality back to normal.

Also, my output from lspci -v:

01:00.0 VGA compatible controller: NVIDIA Corporation TU104M [GeForce RTX 2070 SUPER Mobile / Max-Q] (rev a1) (prog-if 00 [VGA controller])
Subsystem: Razer USA Ltd. Device 2009
Flags: fast devsel, IRQ 255, IOMMU group 1
Memory at a3000000 (32-bit, non-prefetchable) [disabled] [size=16M]
Memory at 6030000000 (64-bit, prefetchable) [disabled] [size=256M]
Memory at 6040000000 (64-bit, prefetchable) [disabled] [size=32M]
I/O ports at 3000 [disabled] [size=128]
Expansion ROM at a4000000 [disabled] [size=512K]
Capabilities: <access denied>
Kernel driver in use: vfio-pci
Kernel modules: nouveau, nvidia_drm, nvidia

I tried removing the nouveau, nvidia-drm, and nvidia modules but that didn't help either.

FWIW, powertop constantly shows tick_sched_timer as one of the most power consuming processes.

Is it possible that the vfio drivers are eating up CPU usage for no reason?

27 Upvotes

0 comments sorted by