0

We're using KVM/qemu on Ubuntu 12.04 to spawn a Windows 2008 R2 VM that uses a lot of host resources (all CPU cores, 4GB RAM). It seems that during a Windows boot that Windows allocates all its assigned memory, and this really thrashes the host resources and seems to sometimes cause KVM to segfault.

Are there any suggested settings or options for this type of deployment, beyond using virtio drivers etc (thinking more along the lines of the hypervisor settings, or host kernel tweaks).

  • What have you overcommitted? – Michael Hampton Jan 14 '14 at 3:45
  • Nothing overcommitted apart from underlying host needs. It's a single VM assigned all host cores and about 15% of the RAM. – AndyC Jan 14 '14 at 4:43
  • You gave the VM as many cores as the host has, or as many threads (hint: do you have hyperthreading in place)? Also, when the VM is booting, what exactly is being thrashed, how do you see that? Windows does claim all of the memory a machine has on boot, that's normal behavior. – dyasny Jan 14 '14 at 5:06
  • Threads - the host has a quad core Xeon with HT, so 8 cores/threads assigned to the VM. When the VM boots the host just "feels" very sluggish, though we can't really narrow down why (not a great deal of I/O going on). We expected contention between the host and the VM if its using all threads during boot as well as having to zero out all that memory, but we didn't expect it to actually cause KVM to segfault. – AndyC Jan 14 '14 at 5:12
  • It shouldn't be segfaulting, but you definitely are saturating more than you physically have - threads aren't CPUs, not even close. Try to take the CPU count in the VM down to the amount of physical cores you have, and see if that changes things – dyasny Jan 14 '14 at 22:07
0

This turned out to be some combination of the kernel or QEMU version Ubuntu 12.04 LTS uses, as upgrading to 12.10 has fixed this issue completely. I came across this whilst debugging the KVM process during its boot using 'perf top', and it was showing an intense amount of __ticket_spin_lock which after searching the KVM archives led to comments about possible kernel scheduling, and also newer QMEU patches which mentioned improving scheduling issues.

The following versions are what 12.10 uses.

QEMU emulator version 1.2.0 (qemu-kvm-1.2.0+noroms-0ubuntu2.12.10.6, Debian) Kernel 3.5.0-46-generic

I would definitely recommend this as a minimum versions on Ubuntu - the performance increase has been outstanding. Whilst we normally prefer LTS in this situation it was just easier to upgrade, and 14.04 LTS should be along soon anyway.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.