Server 2012R2 guest poor performance
I'm trying to track down some CPU usage issues we're having with some virtual machines. Basically, when we run our application under KVM, we see about 2x the CPU usage that we would see if we were running it on bare metal.
kvm_stat shows me the following:
efer_reload 0 0
exits 120145461 54146
fpu_reload 23548805 10735 halt_exits 21716863 9688 halt_wakeup 21674988 9696 host_state_reload 30264874 14106 hypercalls 0 0 insn_emulation 4459351 2087 insn_emulation_fail 0 0 invlpg 0 0 io_exits 8608533 4178 irq_exits 4170903 1026
irq_injections 32551242 15819
irq_window 7779935 5332
I'm trying to figure out why I'm seeing such high numbers for VM exits, but I haven't been able to track down the cause yet.
If I do:
# echo 1 >/sys/kernel/debug/tracing/events/kvm/enable; cat /sys/kernel/debug/tracing/trace_pipe | head -100000 > trace.log ; echo 0 >/sys/kernel/debug/tracing/events/kvm/enable
# cat trace.log | grep kvm_exit | awk '{print $7}' | sort | uniq -c
4518 EXCEPTION_NMI
427 EXTERNAL_INTERRUPT
4048 HLT
1870 IO_INSTRUCTION
6819 MSR_WRITE
188 PAUSE_INSTRUCTION
1756 PENDING_INTERRUPT
1775 TPR_BELOW_THRESHOLDI've uploaded a copy of the trace log to https://dl.dropboxusercontent.com/u/50986796/trace.log.gz
What is causing the MSR_WRITE exits? Is there anything I can do to optimize this?
I'm running:
qemu 2.2.0
'-cpu Haswell,+invtsc,hv_time,hv_relaxed,hv_vapic,hv_spinlocks=0x1000 -no-hpet' virtio storage + network
Is there anything else that I can do to make this run more efficiently?