12

I have 2 VMs running as guests on a KVM virtualization platform running on Ubuntu 10.04. One VM is an Ubuntu 10.04 system, the other is a Windows 7 system. When both machines are completely logged out, the Linux machine uses 1% CPU, the Windows one 45-50%, according to top. The graphs in virt-manager seem to back this up. There's nothing installed on the Win7 image that would be running in the background; its as fresh as can be.

Why is the Windows VM using so much more than the Linux VM, when both are logged out and idling?

Edit:

I installed the guest with paravirt storage and network drivers from the get-go. I don't believe there are any other drivers that I'm missing, am I wrong?.

According to the guest's task manager, it is indeed idle. Taskman takes about 1 or 2 % of the guest CPU, but there's no other processes taking up any CPU time.

5 Answers5

7

I know that my answer comes after 100 years but: for future reference please see here:

http://forum.proxmox.com/threads/5770-Windows-guest-high-context-switch-rate-when-idle

If that is the casethen here is the solution: http://support.microsoft.com/kb/895980

It dropped my Win2K3 R2 guest cpu ussage (when guest was idle) on my x86_64 kvm host from ~30%-40% to 6%

Eugen
  • 71
  • 1
  • 1
  • 2
    The thread on Proxmox has a useful piece of information: remove the USB tablet virtual hardware from the windows VM will drop the number of context switches. My idle Windows VM went from 20ish% host CPU down to 5% host CPU. – Colin 't Hart Sep 18 '12 at 08:47
  • Thanks, worked for me. The tablet virtual device sent endless interrupt requests – michaelbn Aug 26 '14 at 09:38
3

What version of QEMU-KVM are you running?

We've seen this issue on versions 0.12.3 and down, but it doesn't seem to be too much of a problem on 0.12.4. Also, check to see if the screensavers are running. If you're using the VNC connection then it may be running there, and the CPU utilization won't be inside the VM - it will be used up by the KVM process.

trevoro
  • 46
  • 1
  • 1
    0.12.3. I'll build in 0.12.4 and see if this goes away. –  May 31 '10 at 23:21
  • 1
    And indeed it did. Windows found a driver for a Qemu 0.12.4 Virtual CPU, and this problem is gone after a guest reboot. –  May 31 '10 at 23:47
-1

I don't know anything at all about KVM, but on VMware this can happen if you don't install the VMware tools in the virtual machine, so that it doesn't have proper device drivers for the virtualized hardware and is unable to put its virtual CPU on real idle when it isn't actually doing anything, using a simple idle loop instead (which actually corresponds to the CPU being fully busy looping on itself).

Maybe there's something similar to VMware tools you should install in your VM?

Massimo
  • 70,200
  • 57
  • 200
  • 323
-1

The fact that Windows is freshly installed does not mean that is does not run background processes or services. Monitor the windows machine with SNMP or task manager and try to find out if it is indeed idle. As Massimo said you should also install pravirtualization drivers for your guest OS. I've never seen an idle VM to take CPU resources from the host.

Mircea Vutcovici
  • 17,619
  • 4
  • 56
  • 83
-3

First thing, stop comparing Windows and Linux or expecting them to behave the same. They are different.

Windows is never idle. It runs many background tasks and from my brief experience with Win 7 it does more of that than say XP. One thing that will help ease the load is to start shutting down necessary services, such as the indexing service.

John Gardeniers
  • 27,458
  • 12
  • 55
  • 109
  • 2
    Linux also runs many background "services". And the original poster confirmed that the Task Manager shows 1-2% CPU used in the Windows guest. – Colin 't Hart Sep 18 '12 at 08:34
  • @Colin, as we all know, the Task Manager lies about CPU loads. Who here hasn't seen it report 98% idle and the system still be completely unresponsive with the CPU temperature because of the load? I'm also well aware that Linux also runs background tasks but the point I was making is that Linux and Windows are completely different animals. Those who try to compare one to the other will always struggle more than those who simply accept that they are different and treat each as a separate entity. – John Gardeniers Sep 18 '12 at 12:55
  • 2
    That makes no sense at all. – Colin 't Hart Sep 18 '12 at 20:36
  • @Colin, that's probably because this kind of thing is way out of your field. Any Windows who's been around for a while will understand what I wrote about the CPU load. Anyone who works with both Windows and Linux should understand the rest. As you don't work in the same field I don't really expect you to understand these things, just as I wouldn't understand anything Oracle. – John Gardeniers Sep 18 '12 at 23:12
  • What makes you think I don't work in the same field? – Colin 't Hart Sep 19 '12 at 11:03
  • @Colin, based on what you have written in your profile. – John Gardeniers Sep 19 '12 at 11:20
  • Task Manager *is* pretty darned accurate. Systems being unresponsive even though CPU usage is low is usually due to the system having to wait for disk. Windows *does* idle when all processes have voluntarily returned control to the kernel. – zaTricky Dec 06 '16 at 21:20