All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] add PLE stats to kvmstat
@ 2012-07-05 21:50 Andrew Theurer
  2012-07-06  7:42 ` Xiao Guangrong
  0 siblings, 1 reply; 8+ messages in thread
From: Andrew Theurer @ 2012-07-05 21:50 UTC (permalink / raw)
  To: kvm

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 <habanero@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;
 			}
 		}



^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-07-09 10:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-05 21:50 [PATCH] add PLE stats to kvmstat Andrew Theurer
2012-07-06  7:42 ` Xiao Guangrong
2012-07-06 13:22   ` Andrew Theurer
2012-07-06 17:40     ` Xiao Guangrong
2012-07-06 18:12       ` Andrew Theurer
2012-07-08  9:50         ` Avi Kivity
2012-07-09  6:42           ` Xiao Guangrong
2012-07-09 10:52             ` Avi Kivity

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.