machyve / xhyve

xhyve, a lightweight OS X virtualization solution
Other
6.44k stars 356 forks source link

High idle CPU / Energy use #6

Open daaku opened 9 years ago

daaku commented 9 years ago

High level issue, but the idle CPU on my MBP is ~3.5% and energy impact according to activity monitor is ~8.6 with just the default shell in TCL.

rimusz commented 9 years ago

yes, I see the same

xez commented 9 years ago

Seems like that's due to the APIC timer, needs improvement, but that's already part of the TODOs.

AntonioMeireles commented 9 years ago

@xez btw (off-topic) when do you think your (great) vmnet-tap work/branch is ready to be proposed to be merged in main tree ?

xez commented 9 years ago

@AntonioMeireles I wanted to test if it compiles on El Capitan, but didn't get around to it yet.

scrogson commented 9 years ago

@xez I was able to get it compiled and running on El Capitan.

xez commented 9 years ago

Back on-topic :)

With the ACPI fixes in, removing "acpi=off" from the Linux kernel cmdline and running xhyve with -A, idle CPU usage drops to ~ 0.1 - 0.2%, which is inline or below VMware running the same VM.

Also true for FreeBSD guests.

Can anyone confirm?

tommythorn commented 9 years ago

Fantastic! I can confirm your observation 100%, but my CentOS 6.6 guest causes a ~ 4-5% load on vmware-vmx, so xhyve is much better. That's really nice! I'll install my (mostly compute) workload and see how the two compare. (OT: how much work is needed save the [non-disk] state between invocations?)

AntonioMeireles commented 9 years ago

@xez same here, as @tommythorn . :+1:

dvbportal commented 9 years ago

This is great. The ACPI fix works wonders. Energy impact is now 0.5 and CPU 0.3% on Ubuntu 14.04 idle.

raulbe commented 9 years ago

It was hovering around 3.5% with acpi=off. Now its 0.2% at idle and using around 28MB RAM. With some activity for instance a container start its hits 3.7% and heads back to 0.2%. This is with a Alpine Linux VM on a MBP 13 Yosemite, and inline with what I see with KVM on Ubuntu, which is fantastic for such a young project.

tommythorn commented 9 years ago

Clearly the original issue is resolved, but I still wonder where the rest of the idle load comes from. Would a tickless kernel improve matters?

xez commented 9 years ago

Ok, great. Guess we should make this the default in xhyverun.sh then.

@tommythorn Saving and restoring CPU and memory state should be pretty straightforward but device state is probably less so. bhyve and hence xhyve doesn't support this yet.

Yes, tickless kernels are a lot better. So are kernels with support for timer coalescing. Most guests are probably never truly quiesce, so some residual idle activity is expected.

AntonioMeireles commented 9 years ago

@xez @mist64 wondering if, at this stage, ACPI shouldn't just be turned on by default.

taterbase commented 8 years ago

I ran into this issue today while playing with xhyve and was pleasantly surprised to see it is a known issue. The acpi fix worked great. Is there a reason it is not the default yet? I don't know very much about acpi and why it would be turned off in the first place.

taterbase commented 8 years ago

Oh... actually this looks solved? https://github.com/mist64/xhyve/commit/cd782515fff03bd4b80da60e29108f6b33476bf5