Lag spikes with 'Default' or 'KVM' PI in Linux Mint guest

Postings relating to old VirtualBox pre-releases
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Lag spikes with 'Default' or 'KVM' PI in Linux Mint gues

Post by Perryg »

No but the OP does in their dmesg file and indicates an issue.

I am running a mint-17 guest with KVM set in processor acceleration and don't have this issue either, so it has to be something unique to their setup.
While I agree with the OP that they should not see this lag by maxing out the cores I would at least try to reduce it by one to find out if that helps. I also run nested paging with EPT which is not enabled by default, because a lot of processors don't support EPT yet. Well I should say that a lot of users don't have the processors that do.

I will say that I find running more than 2 cores does not help a lot in a virtual OS. I render movies in this guest and some of them press 65GB. Using two cores runs just about as fast as on metal.

I see you have posted before I got this out so I want to ask what happens if you leave it set to default. That way VirtualBox decides if and what you need. Mine is set to default but shows KVM.
Ver Greeneyes
Posts: 22
Joined: 22. Aug 2013, 00:27

Re: Lag spikes with 'Default' or 'KVM' PI in Linux Mint gues

Post by Ver Greeneyes »

Here's three logs from my regular VM comparing startups with Legacy, Default and KVM. Default is just as slow as KVM on this VM, and also appears to be just as slow as KVM on the other (new) VM now that I've had KVM enabled on it. Why that matters I don't know, perhaps it causes the OS to set a flag of some sort.

Edit: So in other words, I guess if I just don't mess with it (leave it set to Default from creation), I don't get the slow startup. But I don't know why that would be, considering it should be using KVM anyway.

Edit2: Okay, the number of cores is definitely related. The more cores I assign the VM, the longer it hangs during startup. But with 3 cores, startup still only takes a few seconds. With 4 cores, it takes minutes. Perhaps it's doing something that becomes exponentially harder with each core. Or perhaps using 4 cores is creating contention with the host, and making whatever it's trying to do almost impossible.
Attachments
VirtualBox logs.zip
(82.5 KiB) Downloaded 21 times
loukingjr
Volunteer
Posts: 8851
Joined: 30. Apr 2009, 09:45
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: just about all that run

Re: Lag spikes with 'Default' or 'KVM' PI in Linux Mint gues

Post by loukingjr »

Ver Greeneyes wrote: Edit2: Okay, the number of cores is definitely related. The more cores I assign the VM, the longer it hangs during startup.
This can't be true. It was recently pointed out to me that it is "Nonsense" not to assign all cores to a guest.
OSX, Linux and Windows Hosts & Guests
There are three groups of people. Those that can count and those that can't.
Ver Greeneyes
Posts: 22
Joined: 22. Aug 2013, 00:27

Re: Lag spikes with 'Default' or 'KVM' PI in Linux Mint gues

Post by Ver Greeneyes »

I'm sorry if I offended you. My point was simply that these problems do not happen with the Paravirtualization Interface set to 'Legacy' - so even if using all 4 cores is causing problems with KVM, it was never a problem before. But yes, it turns out to be involved.
Ramshankar
Oracle Corporation
Posts: 793
Joined: 7. Jan 2008, 16:17

Re: Lag spikes with 'Default' or 'KVM' PI in Linux Mint gues

Post by Ramshankar »

Ver Greeneyes wrote:I'm sorry if I offended you. My point was simply that these problems do not happen with the Paravirtualization Interface set to 'Legacy' - so even if using all 4 cores is causing problems with KVM, it was never a problem before. But yes, it turns out to be involved.
Keep the 4 CPU VM, make sure KVM is enabled and the VM is powered off and try this:

Code: Select all

VBoxManage setextradata <your-vm-name> VBoxInternal/TM/TSCModeSwitchAllowed 0
Now power the VM on and see if it helps. Make sure you include the VBox.log if it still causes this 'hanging' issue.
Oracle Corp.
michaln
Oracle Corporation
Posts: 2973
Joined: 19. Dec 2007, 15:45
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Any and all
Contact:

Re: Lag spikes with 'Default' or 'KVM' PI in Linux Mint gues

Post by michaln »

Ver Greeneyes wrote:Edit: So in other words, I guess if I just don't mess with it (leave it set to Default from creation), I don't get the slow startup. But I don't know why that would be, considering it should be using KVM anyway.
Among other things, the "Session Information" dialog of a running VM will show the current paravirtualization interface. For Linux VMs, "Default" should translate to "KVM".
Ver Greeneyes
Posts: 22
Joined: 22. Aug 2013, 00:27

Re: Lag spikes with 'Default' or 'KVM' PI in Linux Mint gues

Post by Ver Greeneyes »

Ramshankar wrote:Keep the 4 CPU VM, make sure KVM is enabled and the VM is powered off and try this:

Code: Select all

VBoxManage setextradata <your-vm-name> VBoxInternal/TM/TSCModeSwitchAllowed 0
Now power the VM on and see if it helps. Make sure you include the VBox.log if it still causes this 'hanging' issue.
Thanks for the feedback! I tried the command, specifically

Code: Select all

VBoxManage setextradata "Linux Mint 64-bit New" VBoxInternal/TM/TSCModeSwitchAllowed 0
... but startup, at least, still takes just as long (I've been focusing on startup since the delay there isn't intermittent). I've attached the log and the dmesg output again.
Attachments
VirtualBox logs.zip
(27.95 KiB) Downloaded 20 times
Ramshankar
Oracle Corporation
Posts: 793
Joined: 7. Jan 2008, 16:17

Re: Lag spikes with 'Default' or 'KVM' PI in Linux Mint gues

Post by Ramshankar »

Ver Greeneyes wrote:
Ramshankar wrote:Keep the 4 CPU VM, make sure KVM is enabled and the VM is powered off and try this:

Code: Select all

VBoxManage setextradata <your-vm-name> VBoxInternal/TM/TSCModeSwitchAllowed 0
Now power the VM on and see if it helps. Make sure you include the VBox.log if it still causes this 'hanging' issue.
Thanks for the feedback! I tried the command, specifically

Code: Select all

VBoxManage setextradata "Linux Mint 64-bit New" VBoxInternal/TM/TSCModeSwitchAllowed 0
... but startup, at least, still takes just as long (I've been focusing on startup since the delay there isn't intermittent). I've attached the log and the dmesg output again.
Would you be willing to try a test build?
Oracle Corp.
Ver Greeneyes
Posts: 22
Joined: 22. Aug 2013, 00:27

Re: Lag spikes with 'Default' or 'KVM' PI in Linux Mint gues

Post by Ver Greeneyes »

Sure, just let me know what I need to do.
loukingjr
Volunteer
Posts: 8851
Joined: 30. Apr 2009, 09:45
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: just about all that run

Re: Lag spikes with 'Default' or 'KVM' PI in Linux Mint gues

Post by loukingjr »

I thought we were trying a test build by installing 5.0 Betas. Shows you what I know. :)
OSX, Linux and Windows Hosts & Guests
There are three groups of people. Those that can count and those that can't.
Ramshankar
Oracle Corporation
Posts: 793
Joined: 7. Jan 2008, 16:17

Re: Lag spikes with 'Default' or 'KVM' PI in Linux Mint gues

Post by Ramshankar »

Ver Greeneyes wrote:Sure, just let me know what I need to do.
Try this test build:
https://www.virtualbox.org/download/tes ... 20-Win.exe

It disables PV spinlocks for KVM guests and may or may not help with the issue. I tried reproducing the problem you're having on my Win7 with a Linux guest (didn't try your exact guest) and so far no luck.
Oracle Corp.
Ver Greeneyes
Posts: 22
Joined: 22. Aug 2013, 00:27

Re: Lag spikes with 'Default' or 'KVM' PI in Linux Mint gues

Post by Ver Greeneyes »

The OS boots up quickly with this version! I'm currently a bit constrained in what testing I can do as some construction work is making physical access to my PC difficult (I'm VNCing into it), so I can't confirm that the intermittent hangs are gone, but it seems likely. Let me know if more logs would be useful or if I can test any more constrained/desirable fixes/workarounds.
Ramshankar
Oracle Corporation
Posts: 793
Joined: 7. Jan 2008, 16:17

Re: Lag spikes with 'Default' or 'KVM' PI in Linux Mint gues

Post by Ramshankar »

Ver Greeneyes wrote:The OS boots up quickly with this version! I'm currently a bit constrained in what testing I can do as some construction work is making physical access to my PC difficult (I'm VNCing into it), so I can't confirm that the intermittent hangs are gone, but it seems likely. Let me know if more logs would be useful or if I can test any more constrained/desirable fixes/workarounds.
I'm eager to know if it really helps solve your problem because the change I made in that build is temporary and has been backed out. So I would need to investigate further on how to reach a solution by knowing the problem and how to reproduce it more.

Sorry if you mentioned this already, but could you post your guest OS and the exact kernel version it is using?
Also, do other Linux guests (like some latest Ubuntu live CD) exhibit similar problems for you or is it only this guest?
Oracle Corp.
Ver Greeneyes
Posts: 22
Joined: 22. Aug 2013, 00:27

Re: Lag spikes with 'Default' or 'KVM' PI in Linux Mint gues

Post by Ver Greeneyes »

Ramshankar wrote:Sorry if you mentioned this already, but could you post your guest OS and the exact kernel version it is using?
Also, do other Linux guests (like some latest Ubuntu live CD) exhibit similar problems for you or is it only this guest?
The guest OS is Linux Mint 17.1 "Rebecca" - Cinnamon (64-bit). As far as I know all available kernels for the OS show the problem (the kernel can be updated by opening the Update Manager, expanding the View menu and selecting the Linux kernels option). Available kernels currently range from 3.13.0-24 through 3.13.0-52 and 3.16.0-25 through 3.16.0-37. I'm currently testing it with 3.16.0-37.

I have physical access to my PC again, so I'll be able to do more tests. I'll try the actual beta 4, and then I'll try Ubuntu instead of Mint.
Ver Greeneyes
Posts: 22
Joined: 22. Aug 2013, 00:27

Re: Lag spikes with 'Default' or 'KVM' PI in Linux Mint gues

Post by Ver Greeneyes »

Sorry about the delay. Some observations:
  • Problem (perhaps unsurprisingly) still exists in beta 4.
  • In one new VM, the startup delay only seemed to manifest itself after purging pre-existing virtualbox packages (|sudo apt-get purge .*virtualbox.*|). Installing the guest additions did not make the problem go away.
  • In another instance, the startup delay only manifested after I purged the packages and then installed the guest additions. I did however see several long hangs while doing so.
  • In yet another instance, the startup delay manifested itself on the third startup - that is, after installing the OS, rebooting, then rebooting again, without doing anything else.
  • Default appears to imply KVM, as expected. I don't understand why the startup delay appears so randomly, then consistently sticks around.
  • During slow startup, the text "keys:" eventually appears on the screen in the upper left corner (while still showing the Mint logo in the center of the screen).
  • During slow startup, the HDD icon can be seen blinking semi-periodically.
  • I tried installing Ubuntu 15.04 (ubuntu-15.04-desktop-amd64.iso) and it also starts up extremely slowly. If anything it seems worse than Mint - as I write this it still hasn't started, now showing a black screen (but at a higher resolution than the first stage of startup).
I noticed both Mint and Ubuntu spew the following messages during boot (mint only during startup of the live CD, but I imagine it's there on every boot behind the mint logo overlay):
piix4_smbus 0000:00:07.0: SMBus base address uninitialized - upgrade BIOS or use force_addr=0xaddr
intel_rapl: no valid rapl domains found in package 0
intel_rapl: no valid rapl domains found in package 0
No idea if this is related. Ubuntu, which doesn't show a logo when starting up, also shows
NMI watchdog: BUG: soft lockup - CPU#0 stuck for 22s! [swapper/0:0]
... during the slow startup. I assume Mint would show this as well if it wasn't showing the logo.

Edit: Yeah, the Ubuntu VM got stuck in some sort of boot-loop when set to KVM. On Legacy it boots up just fine. It still shows the SMBus and intel_rapl messages either way, so I doubt they're related.
Post Reply