High CPU usage on WIndows guest KVM machine

ktb92677 asked:

So I am noticing my windows KVM guests (managed by proxmox) are showing extremely high CPU usage when doing really simple things like watching a video on youtube. For example a 4 core KVM instance will go up to about 75% CPU usage when watching a single video via Google chrome at 480p. 1080p maxes out the CPU. How is it possible that I cannot watch a 1080p video? Here is my host CPU: Intel(R) Xeon(R) CPU E5-2697 v2 @ 2.70GHz. I also noticed the host has the following integrated GPU: Matrox Electronics Systems Ltd. MGA G200eW WPCM450 (rev 0a). Here is what I have tried:

  • Different browsers like Opera and Firefox do offer slightly lower CPU numbers but again too high to be acceptable.
  • Enabling and disabling hardware acceleration in Google Chrome settings does nothing.
  • Setting CPU type to host does not help
  • Setting Display to VirtIO-GPU does nothing
  • Setting Display to SPICE and installing spice-guest-tools does nothing

Any help would be so greatly appreciated!

My answer:

From my experience, Windows guests usually munch too much CPU when a virtual hardware driver is set to something less than ideal.

The settings I usually make are:

  • Storage should always be VirtIO-SCSI. You can just change this setting for an existing VM if the VirtIO-SCSI driver is already installed in the guest, but installing new guests requires you also have the VirtIO-Win ISO mounted during installation so you can load the driver.
  • I set the CPU to match the code name of the underlying processor. For an E5-2697 V2 this means using IvyBridge-IBRS rather than kvm64 or host. (IBRS activates certain Spectre/Meltdown mitigations.) I use “host” only when nested virtualization is required, i.e. running Hyper-V inside the Windows guest, because nested Hyper-V actually requires it.
  • Sockets are set to 1 and Cores set to the number of virtual CPUs desired.
  • Display should be set to SPICE. No other setting will allow for smooth video playback, so there’s no point changing it.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.