Gnome-boxes VM taking 200% CPU while idle

My gnome-boxes (qemu) Windows 10 VM is painfully slow. It is taking almost 200% CPU when idle.
It was running fine, and after some upgrade (probably kernel) it went south, and I haven’t been able to identify the cause.

top - 18:39:56 up 1 day,  8:51,  1 user,  load average: 2.20, 2.21, 2.05
Tasks: 346 total,   1 running, 345 sleeping,   0 stopped,   0 zombie
%Cpu(s):  4.7 us, 19.6 sy,  0.0 ni, 74.8 id,  0.0 wa,  0.7 hi,  0.2 si,  0.0 st
MiB Mem :  64224.6 total,  24575.3 free,  20916.7 used,  18732.6 buff/cache
MiB Swap:  12288.0 total,  12288.0 free,      0.0 used.  42037.4 avail Mem 

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                      
 133652 sanmi@m+  20   0   18.3g  16.2g  30860 S 195.3  25.8 280:52.81 qemu-system-x86                              
 133245 sanmi@m+  20   0  951124 288432 149848 S   3.0   0.4   0:22.75 chrome                                       
 151464 sanmi@m+  20   0 9186800 192756 100848 S   2.7   0.3   0:40.79 chrome                                       
   2357 sanmi@m+  20   0 4725420 450848 139172 S   1.7   0.7  13:52.51 gnome-shell                                  
 133523 sanmi@m+  20   0   83.0g 137760  85732 S   1.3   0.2   1:29.30 gnome-boxes                                  
 152047 sanmi@m+  20   0 4910916 135696  97756 S   1.0   0.2   0:02.72 chrome     

This is the process:

[sanmi@fos ~]$ ps ax | grep qemu
 133652 ?        Rl   283:22 /usr/bin/qemu-system-x86_64 -name guest=win10,debug-threads=on -S -object secret,id=masterKey0,format=raw,file=/home/sanmi/.config/libvirt/qemu/lib/domain-1-win10/master-key.aes -machine pc-q35-4.2,accel=kvm,usb=off,dump-guest-core=off -cpu host,migratable=on -m 16390 -overcommit mem-lock=off -smp 8,sockets=1,dies=1,cores=4,threads=2 -uuid 55a45adf-ea03-4bbe-b732-396c669f802f -no-user-config -nodefaults -chardev socket,id=charmonitor,fd=27,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=localtime,driftfix=slew -global kvm-pit.lost_tick_policy=delay -no-hpet -no-shutdown -global ICH9-LPC.disable_s3=1 -global ICH9-LPC.disable_s4=1 -boot menu=off,strict=on -device pcie-root-port,port=0x10,chassis=1,id=pci.1,bus=pcie.0,multifunction=on,addr=0x2 -device pcie-root-port,port=0x11,chassis=2,id=pci.2,bus=pcie.0,addr=0x2.0x1 -device pcie-root-port,port=0x12,chassis=3,id=pci.3,bus=pcie.0,addr=0x2.0x2 -device pcie-root-port,port=0x13,chassis=4,id=pci.4,bus=pcie.0,addr=0x2.0x3 -device pcie-root-port,port=0x14,chassis=5,id=pci.5,bus=pcie.0,addr=0x2.0x4 -device ich9-usb-ehci1,id=usb,bus=pcie.0,addr=0x1d.0x7 -device ich9-usb-uhci1,masterbus=usb.0,firstport=0,bus=pcie.0,multifunction=on,addr=0x1d -device ich9-usb-uhci2,masterbus=usb.0,firstport=2,bus=pcie.0,addr=0x1d.0x1 -device ich9-usb-uhci3,masterbus=usb.0,firstport=4,bus=pcie.0,addr=0x1d.0x2 -device virtio-serial-pci,id=virtio-serial0,bus=pci.2,addr=0x0 -device usb-ccid,id=ccid0,bus=usb.0,port=1 -blockdev {"driver":"file","filename":"/home/sanmi/.local/share/gnome-boxes/images/win10","node-name":"libvirt-2-storage","cache":{"direct":false,"no-flush":false},"auto-read-only":true,"discard":"unmap"} -blockdev {"node-name":"libvirt-2-format","read-only":false,"cache":{"direct":false,"no-flush":false},"driver":"qcow2","file":"libvirt-2-storage","backing":null} -device virtio-blk-pci,bus=pci.3,addr=0x0,drive=libvirt-2-format,id=virtio-disk0,bootindex=1,write-cache=on -device ide-cd,bus=ide.2,id=sata0-0-2 -netdev tap,fd=33,id=hostnet0 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:00:37:38,bus=pci.1,addr=0x0 -chardev spicevmc,id=charsmartcard0,name=smartcard -device ccid-card-passthru,chardev=charsmartcard0,id=smartcard0,bus=ccid0.0 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -chardev spicevmc,id=charchannel0,name=vdagent -device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=com.redhat.spice.0 -chardev spiceport,id=charchannel1,name=org.spice-space.webdav.0 -device virtserialport,bus=virtio-serial0.0,nr=2,chardev=charchannel1,id=channel1,name=org.spice-space.webdav.0 -device usb-tablet,id=input0,bus=usb.0,port=2 -spice port=0,disable-ticketing,image-compression=off,seamless-migration=on -device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,vram64_size_mb=0,vgamem_mb=16,max_outputs=1,bus=pcie.0,addr=0x1 -device ich9-intel-hda,id=sound0,bus=pcie.0,addr=0x1b -device hda-duplex,id=sound0-codec0,bus=sound0.0,cad=0 -chardev spicevmc,id=charredir0,name=usbredir -device usb-redir,chardev=charredir0,id=redir0,bus=usb.0,port=3 -chardev spicevmc,id=charredir1,name=usbredir -device usb-redir,chardev=charredir1,id=redir1,bus=usb.0,port=4 -chardev spicevmc,id=charredir2,name=usbredir -device usb-redir,chardev=charredir2,id=redir2,bus=usb.0,port=5 -chardev spicevmc,id=charredir3,name=usbredir -device usb-redir,chardev=charredir3,id=redir3,bus=usb.0,port=6 -device virtio-balloon-pci,id=balloon0,bus=pci.4,addr=0x0 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny -msg timestamp=on
1 Like

This looks quite normal. The load of 2 is not an issue because that is not directly related to the cpu. Top is telling you that only 4.7% cpu time is user processes and 74.8% is idle. This link tells you a lot about what the load numbers mean and how to relate them to your system.

1 Like

I’m not concerned about the host machine, but take a look downwards and see the load that the qemu-system-x86 is enduring: 195.3% CPU while idle. The VM machine is barely responsive.

PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                      

133652 sanmi@m+ 20 0 18.3g 16.2g 30860 S 195.3 25.8 280:52.81 qemu-system-x86

Post the output:

virt-host-validate
[sanmi@fos ~]$ sudo virt-host-validate
  QEMU: Checking for hardware virtualization                                 : PASS
  QEMU: Checking if device /dev/kvm exists                                   : PASS
  QEMU: Checking if device /dev/kvm is accessible                            : PASS
  QEMU: Checking if device /dev/vhost-net exists                             : PASS
  QEMU: Checking if device /dev/net/tun exists                               : PASS
  QEMU: Checking for cgroup 'cpu' controller support                         : WARN (Enable 'cpu' in kernel Kconfig file or mount/enable cgroup controller in your system)
  QEMU: Checking for cgroup 'cpuacct' controller support                     : PASS
  QEMU: Checking for cgroup 'cpuset' controller support                      : WARN (Enable 'cpuset' in kernel Kconfig file or mount/enable cgroup controller in your system)
  QEMU: Checking for cgroup 'memory' controller support                      : PASS
  QEMU: Checking for cgroup 'devices' controller support                     : PASS
  QEMU: Checking for cgroup 'blkio' controller support                       : WARN (Enable 'blkio' in kernel Kconfig file or mount/enable cgroup controller in your system)
  QEMU: Checking for device assignment IOMMU support                         : PASS
  QEMU: Checking if IOMMU is enabled by kernel                               : WARN (IOMMU appears to be disabled in kernel. Add intel_iommu=on to kernel cmdline arguments)
  QEMU: Checking for secure guest support                                    : WARN (Unknown if this platform has Secure Guest support)
   LXC: Checking for Linux >= 2.6.26                                         : PASS
   LXC: Checking for namespace ipc                                           : PASS
   LXC: Checking for namespace mnt                                           : PASS
   LXC: Checking for namespace pid                                           : PASS
   LXC: Checking for namespace uts                                           : PASS
   LXC: Checking for namespace net                                           : PASS
   LXC: Checking for namespace user                                          : PASS
   LXC: Checking for cgroup 'cpu' controller support                         : FAIL (Enable 'cpu' in kernel Kconfig file or mount/enable cgroup controller in your system)
   LXC: Checking for cgroup 'cpuacct' controller support                     : PASS
   LXC: Checking for cgroup 'cpuset' controller support                      : FAIL (Enable 'cpuset' in kernel Kconfig file or mount/enable cgroup controller in your system)
   LXC: Checking for cgroup 'memory' controller support                      : PASS
   LXC: Checking for cgroup 'devices' controller support                     : PASS
   LXC: Checking for cgroup 'freezer' controller support                     : FAIL (Enable 'freezer' in kernel Kconfig file or mount/enable cgroup controller in your system)
   LXC: Checking for cgroup 'blkio' controller support                       : FAIL (Enable 'blkio' in kernel Kconfig file or mount/enable cgroup controller in your system)
   LXC: Checking if device /sys/fs/fuse/connections exists                   : PASS

Virtio-in-0.1.185 drivers and agent are installed in the Windows 10 VM

1 Like
virsh dumpxml VM_NAME

https://pastebin.com/raw/rPjpUTkZ

1 Like

Check if the issue persists when you log out the guest, or boot it in the safe/recovery mode.

Also try to boot the host with 5.8 kernel:

sudo dnf downgrade kernel
sudo reboot
uname -a

Definitely it is kernel 5.9
safe/recovery mode under kernel 5.9 goes down to 60%, but reverting to kernel 5.8 gets back the snappy reponse to the VM and idle CPU% values down to 120%.

1 Like

Sorry, what do you mean?

I mean that under linux host kernel 5.9, the Windows 10 VM running in safe mode takes 60% CPU, but is still slow as molasses.
Under kernel 5.8, the Windows 10 VM runs as expected.

2 Likes

If you need virtualization, use 5.8 for the time being and test 5.10 when it is available in the testing repository, meanwhile you can report this regression against 5.9.