On 2014-11-11 19:55, Samuel Thibault wrote: > Hello, > > jenkins.debian.net is running inside a KVM VM, and it runs nested > KVM guests for its installation attempts. This goes fine with Linux > kernels, but it is extremely slow with gnumach kernels. I have > reproduced the issue with my laptop with a linux 3.17 host kernel, a > 3.16 L1-guest kernel, and an i7-2720QM CPU, with similar results; it's > actually even slower than letting qemu emulate the CPU... For these > tests I'm using the following image: > > http://people.debian.org/~sthibault/tmp/netinst.iso > > The reference test here boils down to running qemu -cdrom netinst.iso -m > 512, choosing the "Automated install" choice, and waiting for "Loading > additional components" step to complete. (yes, the boot menu gets > mangled ATM, there's apparently currently a bug between qemu and grub) > > My host is A, my level1-KVM-guest is B. > > KVM: > A$ qemu -enable-kvm -cdrom netinst.iso -m 512M > takes ~1 minute. > > QEMU: > A$ qemu -cdrom netinst.iso -m 512M > takes ~7 minutes. > > KVM-in-KVM: > B$ qemu -enable-kvm -cdrom netinst.iso -m 512M > takes ~10 minutes, when it doesn't gets completely stuck, which is quite > often, actually... > > QEMU-in-KVM: > B$ qemu -cdrom netinst.iso -m 512M > takes ~7 minutes. > > I don't see such horrible slowdown with a linux image. Is there > something particular that could explain such a difference? What tools > or counters could I use to investigate which area of KVM is getting > slow? You can try to catch a trace (ftrace) on the physical host. I suspect the setup forces a lot of instruction emulation, either on L0 or L1. And that is slower than QEMU is KVM does not optimize like QEMU does. Jan