I, and I expect others, have a keen interest in knowing how often we exit for PLE, and also how often that includes a yielding to another vcpu. The following adds two more counters to kvmstat to track the exits and the vcpu yields. This in no way changes PLE behavior, just helps us track what's going on.
-Andrew Theurer Signed-off-by: Andrew Theurer <haban...@linux.vnet.ibm.com> arch/x86/include/asm/kvm_host.h | 2 ++ arch/x86/kvm/svm.c | 1 + arch/x86/kvm/vmx.c | 1 + arch/x86/kvm/x86.c | 2 ++ virt/kvm/kvm_main.c | 1 + 5 files changed, 7 insertions(+), 0 deletions(-) diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index 24b7647..aebba8a 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h @@ -593,6 +593,8 @@ struct kvm_vcpu_stat { u32 hypercalls; u32 irq_injections; u32 nmi_injections; + u32 pause_exits; + u32 vcpu_yield_to; }; struct x86_instruction_info; diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 7a41878..1c1b81e 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -3264,6 +3264,7 @@ static int interrupt_window_interception(struct vcpu_svm *svm) static int pause_interception(struct vcpu_svm *svm) { + ++svm->vcpu.stat.pause_exits; kvm_vcpu_on_spin(&(svm->vcpu)); return 1; } diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index eeeb4a2..1309578 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -5004,6 +5004,7 @@ out: */ static int handle_pause(struct kvm_vcpu *vcpu) { + ++vcpu->stat.pause_exits; skip_emulated_instruction(vcpu); kvm_vcpu_on_spin(vcpu); diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 8eacb2e..ad85403 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -143,6 +143,8 @@ struct kvm_stats_debugfs_item debugfs_entries[] = { { "insn_emulation_fail", VCPU_STAT(insn_emulation_fail) }, { "irq_injections", VCPU_STAT(irq_injections) }, { "nmi_injections", VCPU_STAT(nmi_injections) }, + { "pause_exits", VCPU_STAT(pause_exits) }, + { "vcpu_yield_to", VCPU_STAT(vcpu_yield_to) }, { "mmu_shadow_zapped", VM_STAT(mmu_shadow_zapped) }, { "mmu_pte_write", VM_STAT(mmu_pte_write) }, { "mmu_pte_updated", VM_STAT(mmu_pte_updated) }, diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 636bd08..d80b6cd 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -1610,6 +1610,7 @@ void kvm_vcpu_on_spin(struct kvm_vcpu *me) if (kvm_vcpu_yield_to(vcpu)) { kvm->last_boosted_vcpu = i; yielded = 1; + ++vcpu->stat.vcpu_yield_to; break; } } -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html