VirtualBox not utilising 100% CPU and context switching like crazy

Discussions related to using VirtualBox on Linux hosts.
Post Reply
giacomogd2
Posts: 4
Joined: 8. Jul 2017, 22:03

VirtualBox not utilising 100% CPU and context switching like crazy

Post by giacomogd2 »

I have a machine with two processors, having 10 physical cores each. The host OS is Debian 9, the guest OS is Ubuntu 16.04. The VM is headless, and configured with bog-standard settings (I changed nothing except of course --cpus 20).

For some reason, when I run "stress --cpu 20" on the guest OS, the 20 VBoxHeadless threads in the host OS seem capped to 90% CPU usage (NB.: the execution cap is 100%)! :shock: They also do a bazillion of voluntary_ctx_switches (10,000 per second :o ).

Can anyone help me figure out what the heck is going on here? Thanks in advance. :D
Martin
Volunteer
Posts: 2562
Joined: 30. May 2007, 18:05
Primary OS: Fedora other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: XP, Win7, Win10, Linux, OS/2

Re: VirtualBox not utilising 100% CPU and context switching like crazy

Post by Martin »

You have a host with 20 CPU cores and want to run a guest whith 20 CPUs. Then the host doesn't have a CPU left to handle the running of the VM and needs to switch very often between letting the VM run and handling it.
giacomogd2
Posts: 4
Joined: 8. Jul 2017, 22:03

Re: VirtualBox not utilising 100% CPU and context switching like crazy

Post by giacomogd2 »

Providing fewer virtual CPUs makes no difference.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: VirtualBox not utilising 100% CPU and context switching like crazy

Post by mpack »

Please provide a VM log file. With the VM fully shut down, right click it in GUI. Select "Show Log" and save "VBox.log" (ONLY) to a zip file. Attach the zip here.
giacomogd2
Posts: 4
Joined: 8. Jul 2017, 22:03

Re: VirtualBox not utilising 100% CPU and context switching like crazy

Post by giacomogd2 »

Sure, I'll do it shortly. Just to be clear, there's no GUI: I'll paste here the contents of Logs/Vbox.log.
 Edit: I am sifting through the log to obfuscate usernames, IPs, and other potentially sensitive information. In the meantime, I "solved" the problem by resorting to kvm (which I really didn't want to use, as it is remarkably more convoluted), pinning each virtual core to a physical core, and sharing the NUMA topology with the guest. I now have full CPU utilisation, no context switches, and this is reflected by the performance. 
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: VirtualBox not utilising 100% CPU and context switching like crazy

Post by mpack »

If you're obfuscating the log the please don't bother posting it.
giacomogd2
Posts: 4
Joined: 8. Jul 2017, 22:03

Re: VirtualBox not utilising 100% CPU and context switching like crazy

Post by giacomogd2 »

Why? You should see what you're looking for anyway.

Thanks for your help, by the way. :wink:
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: VirtualBox not utilising 100% CPU and context switching like crazy

Post by mpack »

Because I don't want to see a log filtered by what you think is important.
Post Reply