LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud
User Name
Password
Linux - Virtualization and Cloud This forum is for the discussion of all topics relating to Linux Virtualization and Linux Cloud platforms. Xen, KVM, OpenVZ, VirtualBox, VMware, Linux-VServer and all other Linux Virtualization platforms are welcome. OpenStack, CloudStack, ownCloud, Cloud Foundry, Eucalyptus, Nimbus, OpenNebula and all other Linux Cloud platforms are welcome. Note that questions relating solely to non-Linux OS's should be asked in the General forum.

Notices


Reply
  Search this Thread
Old 10-17-2011, 11:37 AM   #1
mallux
Member
 
Registered: Jun 2007
Location: London, UK
Distribution: Ubuntu, RHEL, Fedora
Posts: 46
Blog Entries: 1

Rep: Reputation: 16
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
 
Old 10-17-2011, 12:22 PM   #2
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
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.
 
Old 10-17-2011, 12:39 PM   #3
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
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.
 
Old 10-17-2011, 01:00 PM   #4
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
@tronayne I don't know if you've seen this.
 
Old 10-17-2011, 01:59 PM   #5
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
Quote:
Originally Posted by macemoneta View Post
@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.
 
Old 10-17-2011, 03:06 PM   #6
mallux
Member
 
Registered: Jun 2007
Location: London, UK
Distribution: Ubuntu, RHEL, Fedora
Posts: 46

Original Poster
Blog Entries: 1

Rep: Reputation: 16
Quote:
Originally Posted by macemoneta View Post
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.
 
Old 10-17-2011, 03:20 PM   #7
mallux
Member
 
Registered: Jun 2007
Location: London, UK
Distribution: Ubuntu, RHEL, Fedora
Posts: 46

Original Poster
Blog Entries: 1

Rep: Reputation: 16
Quote:
Originally Posted by tronayne View Post
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 View Post
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 View Post
I look forward to the day that I can completely dump Microsoft forever, bu tin the meantime...
Ha ha, me too.
 
Old 10-17-2011, 03:33 PM   #8
mallux
Member
 
Registered: Jun 2007
Location: London, UK
Distribution: Ubuntu, RHEL, Fedora
Posts: 46

Original Poster
Blog Entries: 1

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

Chris
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
mq_receive consumes too high CPU time Jack Guo Red Hat 0 05-01-2011 10:06 AM
Windows7 KVM problems on FC12 mickeyboa Fedora 10 05-09-2010 09:41 AM
Select() call consumes CPU barunparichha Linux - Software 1 03-31-2010 07:14 AM
pdftotext consumes 100%cpu power alaios Linux - Software 1 04-02-2007 06:27 PM
beagle consumes cpu alaios Linux - General 6 12-16-2006 11:05 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud

All times are GMT -5. The time now is 02:32 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration