Problem with high CPU load solved !

Discussions related to using VirtualBox on Windows hosts.
helledi
Posts: 10
Joined: 2. Apr 2008, 10:57

Problem with high CPU load solved !

Post by helledi »

I have experienced a high cpu load on my Windows XP host even if my linux guest was idle. I have a dual core cpu and it seems as if that is the problem.

I tried to set the processor affinity to CPU0 (zero) and the problem disappeared !
To set affinity: in taskmanager/processes, right-click on the virtualbox process, select 'set affinity...' select the first cpu only.

... I am a very happy camper now :-)

Could someone else please verify this ?


Regards
dirkgently
Posts: 11
Joined: 9. Apr 2008, 08:42

Post by dirkgently »

Yes, I had similar problems to you. I'm running a CentOS 4.6 guest with no package updates on a WindowsXP SP2 host running Virtual Box 1.5.6. I have an Intel Core 2 6600 CPU. I've found the following things:

1. Default CentOS 4.6 SMP kernel gets stuck on boot and never gets past "Ok, booting the kernel." Whether affinity is set to CPU0 is set or not.

2. Default CentOS 4.6 non-SMP kernel boots and consumes all of one core while idling in X windows. top within the CentOS guest show it is idle as far as it's concerned.

3. Using the default CentOS 4.6 non-SMP kernel and setting the affinity to CPU0 as you suggested changes the situation dramatically. CPU usage goes to ~25% of one core.

4. Using the latest CentOS 4.6 non-SMP kernel from http://vmware.xaox.net/centos/4.6/i386/ AND setting affinity to CPU0 changes the situation dramatically again. There is now virtually no CPU usage on the Windows host when the CentOS guest is idling. I've not yet installed additions against this kernel.

5. Using the latest CentOS 4.6 non-SMP kernel from vmware.xaox.net and NOT setting affinity, CPU usage goes up again to consume all of one core.


So the optimal solution for me has been setting affinity to CPU0 and using the latest non-SMP kernel from vmware.xaox.net. I've not yet tried an SMP kernel from vmware.xaox.net. It may have a similar problem to the default CentOS 4.6 kernel.

I should also note all of this testing has been with VT-x turned off in the virtual machine settings. I haven't gone through any of the above iterations with VT-x turned on.
helledi
Posts: 10
Joined: 2. Apr 2008, 10:57

Post by helledi »

Great.

Are we about to have enough material to post a serious bug ?
I can see that others have had this problem as well.

Let's just hope that SUN takes it seriously, as this is just going to get worse as more and more people get multi-core cpu's.

Regards.
axet
Volunteer
Posts: 93
Joined: 3. Sep 2007, 23:20

Post by axet »

that help me too! big thx!!!
Mugwump00
Posts: 15
Joined: 11. Oct 2007, 11:12

Post by Mugwump00 »

I found runaway CPU problems when hosting large numbers (>7) VMs could be tamed by setting the Core-affinity of Virtualbox.exe permanatly to 1 core using Process Lasso.

Great great tool!
bwilhite
Posts: 5
Joined: 20. Apr 2008, 18:34

As far as I'm concerned this is a bug...

Post by bwilhite »

I just attempted to install Ubuntu 6 LAMP server on a virtual box and had these problems:

1) OS won't boot from startup (might be that I need a different kernel)
2) Very high CPU load (I run 2 cores, with both my load was 87%, with setting affinity to CPU 0 the load was still 50%, i.e. it was using a whole core)

I also previously installed a desktop version of Ubuntu and had a problem with the CPU load. When I run it on my dual-core machine everything works fine. But when I run it on my other single core machine it puts a high load on the CPU. When it idles it's consistently higher than 20% of the CPU and frequently around 50%. This other machine is no slouch either, it's a 2.4 GHz CPU with 768 MB RAM. The host OS on both machines is Windows XP SP2.

I'll see if I can figure out how to get the right kernel in there, but imo there's certainly more going on here than just that.

Brandon
dirkgently
Posts: 11
Joined: 9. Apr 2008, 08:42

Post by dirkgently »

I think in my case there are two separate issues, one being the CPU affinity and the other being (I suspect) the resolution of the timer used by the CentOS 4.6 kernel.

We should raise CPU affinity as a bug in the Virtual Box bug tracker. It seems to me that the short term fix is for Virtual Box to set the CPU affinity of the virtual machine processes automatically. This could be exposed to the user in the virtual machine settings dialog. Say somewhere under the General -> Advanced tab. You might have two ways to set it. You'd set either "Run on X number of cores" or you could set "Run on this particular core".

Longer term whatever the underlying issue is needs to be addressed, but the ability to set CPU affinity per virtual machine could be a useful feature to keep. In some situations it may just so happen that you want to restrict a particular virtual machine to a particular core of the host system.
Louie928
Posts: 32
Joined: 2. May 2008, 02:01

Post by Louie928 »

Mugwump00 wrote:I found runaway CPU problems when hosting large numbers (>7) VMs could be tamed by setting the Core-affinity of Virtualbox.exe permanatly to 1 core using Process Lasso.

Great great tool!
I am having huge problems trying to install WinXP on my Mandriva 2008 host. I get part way through the installation about where XP setup formats the virtual hard drive and the machine slows to a very slow crawl. It takes 10 minutes for a mouse movement to happen. Formatting never ends even after 4 or 5 hours. I've tried different WinXP CDs.

The hardware is an AMD 64 4200 dual core. MSI K9A2 MB, Nvidia G force 8500 video card, 4 gb RAM, and 120 GB WD SATA hard drive. From my almost halted system, it is possible I have the dual core procesor scheduling problem. How can I set affinity to 0? This happens before I get WinXP installed.

How do I get Process Lasso, if that will help?

Thanks for any help as I'm about to give up on it. A similar thing happens with VMware.
helledi
Posts: 10
Joined: 2. Apr 2008, 10:57

Post by helledi »

Process lasso is for windows only.
You need to set the affinity of the virtualbox process on the host system. On linux, there is a package called 'schedutils', which should be able to do it for you.
Louie928
Posts: 32
Joined: 2. May 2008, 02:01

Post by Louie928 »

helledi wrote:Process lasso is for windows only.
You need to set the affinity of the virtualbox process on the host system. On linux, there is a package called 'schedutils', which should be able to do it for you.
Ok, thanks very much.
Guest

Post by Guest »

Louie928 wrote: I am having huge problems trying to install WinXP on my Mandriva 2008 host. I get part way through the installation about where XP setup formats the virtual hard drive and the machine slows to a very slow crawl.
... How can I set affinity to 0? This happens before I get WinXP installed.

How do I get Process Lasso, if that will help?

Thanks for any help as I'm about to give up on it. A similar thing happens with VMware.
Try
/bin/taskset
( taskset - retrieve or set a process's CPU affinity )
which is in the util-linux-ng package on (all) MD*Linux.
man taskset
gives details.
Louie928
Posts: 32
Joined: 2. May 2008, 02:01

Post by Louie928 »

fhj52 wrote:
Louie928 wrote: I am having huge problems trying to install WinXP on my Mandriva 2008 host. I get part way through the installation about where XP setup formats the virtual hard drive and the machine slows to a very slow crawl.
... How can I set affinity to 0? This happens before I get WinXP installed.

How do I get Process Lasso, if that will help?

Thanks for any help as I'm about to give up on it. A similar thing happens with VMware.
Try
/bin/taskset
( taskset - retrieve or set a process's CPU affinity )
which is in the util-linux-ng package on (all) MD*Linux.
man taskset
gives details.
Thanks very much for this additional clue. I couldn't find schedutils as a package available for Mandriva. Maybe it's a Debian thing. I'm evaluating Ubuntu as well so I can use it there. This same slow down problem happens with either OS (Ubuntu or Mandriva). As you can guess, I'm relatively new to Linux and traversing the minefield to get a usable system is a daunting journey.
Guest

Post by Guest »

yea, I understand(you're welcome, :)). I've been using MD* since ~'99; they have changed some things so finding what one needs can be difficult sometimes. Other distros do the same thing. ...
I have plans on installing VirtualBox OSE on 2008.1x64 PWP and then WinXPx64 so I needed the info anyway ...just in case.

FYI:
"PID" can be found with
pidof [task_name]

One can also do
taskset [options] `pidof [task_name]`

Those are backquotes which basically means execute and substitute the result at that spot in the cmd line; for the bash shell -don't rem' how good it works for ksh, csh or others. BASH is the std shell(CMD line) for MDLinux.
(BTW, brackets are not used in the command. They are just there for clarity ...)

Finding the task_name for virtualbox is done several ways. One is use (KDE) ksysguard program and just look for it; another from the shell is to use the "top" program. If the manual has the name of the task I have not seen it. ... could be vbox but it could be something totally different too. I cannot help with that since I don't have V'Box running in MD*; you will have to hunt it down.
Note that if you use KSysGuard or top the PID of the task is displayed too.

There is another way you might try without setting the processor affinity.
Quit the X11 desktop and login at the virtual terminal. then from there use the VBoxManage to create the vdi; IIRC, the command is
VBoxManage createdvi [options] [/path/to/name.vdi]

options are size, type, etc. They will display if you type
VBoxManage createdvi

at the CLI with no information(no options, target,...).

It is possible that the GUI is getting in the way so not running X11 will eliminate that problem ...IF that is the issue.
dirkgently
Posts: 11
Joined: 9. Apr 2008, 08:42

VirtualBox 1.6

Post by dirkgently »

I'm running VirtualBox 1.6 on Windows XP SP3 and my CPU affinity issues are resolved on my dual core Core 2 6600. I can now run my VMs in 1.6 without having set the affinity to CPU0.
helledi
Posts: 10
Joined: 2. Apr 2008, 10:57

Post by helledi »

I have experienced the same thing.
Bug fixed.
Post Reply