Page 1 of 1

High CPU usage

Posted: 6. Jan 2009, 09:45
by Jon R
I have previously posted about a problem using a particular software package within Virtualbox. That seems to have been fixed with v2.1.0.

However now I have transferred to Mandriva as a host I can see that a high CPU load is being caused when I try to run the software and my vm locks up. I have checked elsewhere and had a look at other resolutions that have been offered but none seem to fix the problem.

I am using an Acer Aspire One, 120Gb HDD, Atom N270 processor, 1.5Gb RAM. My host is Mandriva 2009 and I am using Windows XP Pro SP3 as a guest. The guest has 768Mb virtual memory and 64Mb graphics memory. Virtual box is V2.1.0.

The software I am running is TwinCAT, which is a PC automation system. It seems fine, although sluggish whilst coding and configuring but as soon as you try to start the runtime it locks at 99% CPU usage.

My VDI file is located on a windows NTFS partition. Could this be causing part of the issue or does it not matter where the VDI is located?

Jon.

Posted: 6. Jan 2009, 18:01
by TerryE
Can I suggest that you use perfmon inside your guest to instrument what is going on here. The key counters to look at are in the System and Processor sections, specifically the rate counters on Interrupts and Deferred Procedure Calls (see ISRs and DPCs, The Silent Killers) and Context Switches.

Realtime applications such as TwinCAT can drive these "through the roof" in turn driving the VirtualBox VMM process in the 100% compute bound that you see. Other than changing to non SMP kernels, unlike in Linux there are few tuning parameters available to the Windows OS which help mitigate this type of guest OS behaviour causing compute bound run-away of the VMM.

Re: High CPU usage

Posted: 23. Mar 2009, 16:30
by DietmarJeske
I seem to have TwinCat operational on a Vista/64 with XP/Pro as guest.

It looks like the TwinCat build has some effect, however - TwinCat 2.10 Build 1334 (current as of 20 Mar 2009) hangs when my VB application does certain things, but using build 1325 works fine.

There is relatively high CPU load on the Host - considering what TwinCat does it's probably unavoidable when running in a VM.

In any case, it looks like the combination of VirtualBox version, TwinCat version, and possibly XP version are a little fragile, but a workable configuration is possible.

Re: High CPU usage

Posted: 29. Mar 2009, 15:28
by Nercury
Created a bug ticket for this http://www.virtualbox.org/ticket/3613

Re: High CPU usage

Posted: 29. Mar 2009, 17:46
by Jon R
Nercury,

Thanks for delving further into these issues.

I hadn't had time to look at it myself, I will follow and see what happens.

Jon.

Re: High CPU usage

Posted: 29. Mar 2009, 18:24
by Nercury
It would be great if you could check in perfmon how much interrupt count increases when the program is running. If increase is approximately 1024, the issue is likely int 70h timer-related too.

To do that:
- Open performance monitor Win-R, enter "perfmon"
- Open "Monitoring Tools" -> "Performance Monitor"
- At the bottom, right click list and choose "Add Counters..."
- Select Processor -> Interrupts/sec counter

Re: High CPU usage

Posted: 4. Apr 2009, 20:46
by DietmarJeske
Ran perfmon as suggested.

First some background - host is Vista/64 running on 2.4 GHz Duo with 6 Gig ram.

Virtual mach is XP/Pro SP2 with 1 Gig ram, no netowrk, no serial, no USB, 12 Mb Video, no hardware accel.

When host system is more or less idle, perfmon Int/sec count Last varies from 300 - 1000, max 1,300, avg. 450

When I start the Virtual machine which is running TwinCat (in TwinCat's "Idle" mode at this point - i.e. it is started , but not doing anything yet), perfmon int/sec count 'goes through the roof" - last count varies from 40,000 - 60,000, max is 120,000

Not sure how familiar you are with TwinCat, but it provides Machine Control capabilities with sub msec response times. When TwinCat is running on a Real windows XP system, there is no noticeable impact on performance when the TwinCat system is "idle". When it is actually doing something (controlling a machine, etc.) the impact on the rest of the XP system is hardly noticeable.

Let me know if this helps / need more info.

Thanks for looking into this.

Re: High CPU usage

Posted: 5. Apr 2009, 00:01
by vbox4me2
DietmarJeske wrote:Not sure how familiar you are with TwinCat, but it provides Machine Control capabilities with sub msec response times.
This is prob. whats causing this, any idea what kind of polling its doing? serial, paralel?

Re: High CPU usage

Posted: 16. Apr 2009, 16:10
by DietmarJeske
vbox4me2 wrote:
DietmarJeske wrote:Not sure how familiar you are with TwinCat, but it provides Machine Control capabilities with sub msec response times.
This is prob. whats causing this, any idea what kind of polling its doing? serial, paralel?
Nothing to do with serial / parallel / or even USB - my virtual machine has all of these disabled.

I think the problem is to some extent inherent in what, and how, TwinCat does. Part of TwinCat runs as a service under Windows - in order to provide "real time" (i.e. deterministic) capabilities required for machine control functions. TwinCat will even remain operational if Windows "blue screens" - i.e. once installed, the TwinCat service pretty much operates outside of windows. On normal, real hardware, it will pre-empt windows to ensure that the machine control task gets the required amount of processor time.

Something about the way TwinCat does this, and how this is emulated in VirtualBox, don't mesh particularly well. It works, but consumes a lot of resources.

To be honest, I'm a little amazed that it works at all. Microsft Virtual PC doesn't work with it at all - have not tried any other virtualizers.

Re: High CPU usage

Posted: 16. Apr 2009, 17:12
by vbox4me2
In that case there is not much you can do other then fix the number of processors the VM uses via the Host and taskmanager or such tools. It is not destructive to have a VM at full proc. use. if it runs it runs.