LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Virtualization and Cloud (https://www.linuxquestions.org/questions/linux-virtualization-and-cloud-90/)
-   -   Windows7 on KVM consumes large amount of host CPU while apparently idle (https://www.linuxquestions.org/questions/linux-virtualization-and-cloud-90/windows7-on-kvm-consumes-large-amount-of-host-cpu-while-apparently-idle-908612/)

mallux 10-17-2011 11:37 AM

Windows7 on KVM consumes large amount of host CPU while apparently idle
 
I have a Windows 7 guest running under qemu-kvm-0.15.0 (kernel 3.0-ARCH). Despite the guest showing as relatively (2-3% in taskmgr) idle, the VM never seems to drop below 25% host CPU, and an strace on the qemu process shows a large amount of time being spent in futex():
Code:

$ sudo strace -f -c -p 27004 & sleep 60 && kill %1
[1] 3721
Process 27004 attached with 3 threads - interrupt to quit
Process 27004 detached
Process 27006 detached
Process 3592 detached
% time    seconds  usecs/call    calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
 77.99    9.618903          41    235158      7166 futex
 12.70    1.566517          8    206798          ioctl
  4.38    0.539965      539965        1          restart_syscall
  1.03    0.126658        4691        27          fdatasync
  1.01    0.124738        588      212          pwrite
  0.90    0.110948        1261        88          preadv
  0.86    0.105672          0    229047    76118 read
  0.76    0.093454          1    132287          select
  0.24    0.029999        1667        18          pread
  0.06    0.007457          1      5350          recvmsg
  0.03    0.004227          0    76642          write
  0.02    0.001939          0    77637          timer_settime
  0.01    0.001548          0    87610          timer_gettime
  0.01    0.000961          0    76406          rt_sigaction
  0.00    0.000000          0      140          writev
  0.00    0.000000          0      377          kill
  0.00    0.000000          0        1          rt_sigpending
  0.00    0.000000          0        1        1 rt_sigtimedwait
  0.00    0.000000          0        32          pwritev
------ ----------- ----------- --------- --------- ----------------
100.00  12.332986              1127832    83285 total

Here's the qemu command line:
Code:

/usr/bin/qemu-kvm -S -M pc-0.14 -enable-kvm -m 1024
 -smp 1,sockets=1,cores=1,threads=1 -name Windows7
 -uuid [my_uuid]
 -nodefconfig -nodefaults
 -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/Windows7.monitor,server,nowait
 -mon chardev=charmonitor,id=monitor,mode=control -rtc base=localtime
 -drive file=/dev/vg/vmWindows7,if=none,id=drive-ide0-0-0,format=raw,cache=none
 -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1
 -netdev tap,fd=21,id=hostnet0
 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:ca:8b:c5,bus=pci.0,multifunction=on,addr=0x3.0x0
 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0
 -usb -device usb-tablet,id=input0 -vnc 127.0.0.1:0 -vga std
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,multifunction=on,addr=0x5.0x0

Any idea what's going on and how I might reduce the unnecessary host CPU burn?

Chris

macemoneta 10-17-2011 12:22 PM

You need to install Windows in qemu with the '-no-acpi' qemu option, otherwise the system burns CPU communicating with what it thinks is the ACPI BIOS. I don't know of any way to disable this after installation.

tronayne 10-17-2011 12:39 PM

I don't use KVM -- VirtualBox instead -- and I notice constant CPU activity in both cores, varying from 3%-5% up to about 24% periodically with a Win7 64-bit guest; I never see anywhere near that activity when Slackware-64 is just sitting the mumbling to itself. And, XP is significantly worse than Win7 as far as CPU activity. It just appears that Windows-whatever-version is a hog no matter what you do (keep in mind that Windows is always doing some blasted thing or other that uses cycles).

As I'm writhing this both cores at at 50% +. Why, I do not know.

Can't really advise you what to do other than perhaps giving it more RAM and see if that helps (so it's not stumbling over its own feet all the time). If you've got 4G or more in the box, let it have 2G -- it is a hog and that's what I've done to alleviate some of the problems.

I keep an eye on things with GKrellM, which is a kind of nifty monitor utility that displays your CPU(s), processes, disk activty, Ethernet activity, memory use, swap use and your can add battery status, fans, temperature and all kinds of stuff if they're available on your system. Might be worth a little time to either start that up (if it's already on you system) or get it from http://members.dslextreme.com/users/...m/gkrellm.html.

I look forward to the day that I can completely dump Microsoft forever, bu tin the meantime...

Hope this helps some.

macemoneta 10-17-2011 01:00 PM

@tronayne I don't know if you've seen this.

tronayne 10-17-2011 01:59 PM

Quote:

Originally Posted by macemoneta (Post 4500704)
@tronayne I don't know if you've seen this.

Oh, dang!

Well, so far, it seems to work for me -- I only use Win7 for Stamp.com, Family Tree Maker and Turbotax -- and, of course, the almost weekly "critical updates." Dammit, I do hate Windows.

Sigh.

mallux 10-17-2011 03:06 PM

Quote:

Originally Posted by macemoneta (Post 4500664)
You need to install Windows in qemu with the '-no-acpi' qemu option, otherwise the system burns CPU communicating with what it thinks is the ACPI BIOS. I don't know of any way to disable this after installation.

Yeah I thought it might be ACPI, unfortunately this was a company "standard build" that I had to take from a physical machine, so didn't have the option of installing from scratch. :-( Did try booting the vm with ACPI off but didn't get past the loading screen.

mallux 10-17-2011 03:20 PM

Quote:

Originally Posted by tronayne (Post 4500682)
I don't use KVM -- VirtualBox instead -- and I notice constant CPU activity in both cores, varying from 3%-5% up to about 24% periodically with a Win7 64-bit guest; I never see anywhere near that activity when Slackware-64 is just sitting the mumbling to itself. And, XP is significantly worse than Win7 as far as CPU activity. It just appears that Windows-whatever-version is a hog no matter what you do (keep in mind that Windows is always doing some blasted thing or other that uses cycles).

As I'm writhing this both cores at at 50% +. Why, I do not know.

Can't really advise you what to do other than perhaps giving it more RAM and see if that helps (so it's not stumbling over its own feet all the time). If you've got 4G or more in the box, let it have 2G -- it is a hog and that's what I've done to alleviate some of the problems.

Thanks, I'll try that. I was trying to pare down the vms as much as possible as I'm trying to cram a whole test environment onto my laptop, but I hadn't anticipated the amount of crap that you have to run as a bare minimum.

Quote:

Originally Posted by tronayne (Post 4500682)
I keep an eye on things with GKrellM, which is a kind of nifty monitor utility that displays your CPU(s), processes, disk activty, Ethernet activity, memory use, swap use and your can add battery status, fans, temperature and all kinds of stuff if they're available on your system. Might be worth a little time to either start that up (if it's already on you system) or get it from http://members.dslextreme.com/users/...m/gkrellm.html.

Cheers, will do - had been using top, iotop and the gnome system monitor. GKrellM - now that's a blast from the past!

Quote:

Originally Posted by tronayne (Post 4500682)
I look forward to the day that I can completely dump Microsoft forever, bu tin the meantime...

Ha ha, me too.

mallux 10-17-2011 03:33 PM

Just tried with 2GB, no difference I'm afraid - still burning far too many CPU cycles.

Chris


All times are GMT -5. The time now is 01:27 PM.