KVM: add halt_attempted_poll to VCPU stats
authorPaolo Bonzini <pbonzini@redhat.com>
Tue, 15 Sep 2015 16:27:57 +0000 (18:27 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 16 Sep 2015 10:17:00 +0000 (12:17 +0200)
commit62bea5bff486644ecf363fe8a1a2f6f32c614a49
tree774180da187dabef4995896aec803248b075a36d
parent8f4216c7d28976f7ec1b2bcbfa0a9f787133c45e
KVM: add halt_attempted_poll to VCPU stats

This new statistic can help diagnosing VCPUs that, for any reason,
trigger bad behavior of halt_poll_ns autotuning.

For example, say halt_poll_ns = 480000, and wakeups are spaced exactly
like 479us, 481us, 479us, 481us. Then KVM always fails polling and wastes
10+20+40+80+160+320+480 = 1110 microseconds out of every
479+481+479+481+479+481+479 = 3359 microseconds. The VCPU then
is consuming about 30% more CPU than it would use without
polling.  This would show as an abnormally high number of
attempted polling compared to the successful polls.

Acked-by: Christian Borntraeger <borntraeger@de.ibm.com<
Reviewed-by: David Matlack <dmatlack@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 files changed:
arch/arm/include/asm/kvm_host.h
arch/arm64/include/asm/kvm_host.h
arch/mips/include/asm/kvm_host.h
arch/mips/kvm/mips.c
arch/powerpc/include/asm/kvm_host.h
arch/powerpc/kvm/book3s.c
arch/powerpc/kvm/booke.c
arch/s390/include/asm/kvm_host.h
arch/s390/kvm/kvm-s390.c
arch/x86/include/asm/kvm_host.h
arch/x86/kvm/x86.c
virt/kvm/kvm_main.c