Skip to contentSkip to conversation

kvmppc: add kvmstat support for ppc exits

PATCH Applied [email protected] 2 participants 2 messages Mar 17, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kvmppc: add kvmstat support for ppc exits

Subject: [PATCH] kvmppc: add kvmstat support for ppc exits

From: Christian Ehrhardt <[email protected]>

This patch adds support to report kvm ppc exit reasons via the kvm_stat infrastructure (debugfs).

---

[diffstat]

 arch/powerpc/kvm/powerpc.c     |   20 ++++++++++++++++++++
 include/asm-powerpc/kvm_host.h |    1 +
 2 files changed, 21 insertions(+)
arch/powerpc/kvm/powerpc.c +20 -0
@@ -33,7 +33,16 @@
 
 unsigned long kvmppc_44x_handlers;
 
+#define VM_STAT(x) offsetof(struct kvm, stat.x), KVM_STAT_VM
+#define VCPU_STAT(x) offsetof(struct kvm_vcpu, stat.x), KVM_STAT_VCPU
+
 struct kvm_stats_debugfs_item debugfs_entries[] = {
+	{ "exits",            VCPU_STAT(exits) },
+	{ "mmio_exits",       VCPU_STAT(mmio_exits) },
+	{ "dcr_exits",        VCPU_STAT(dcr_exits) },
+	{ "signal_exits",     VCPU_STAT(signal_exits) },
+	{ "light_exits",      VCPU_STAT(light_exits) },
+	{ "remote_tlb_flush", VM_STAT(remote_tlb_flush) },
 	{ NULL }
 };
 
@@ -410,6 +419,17 @@ int kvmppc_handle_exit(struct kvm_run *r
 		run->exit_reason = KVM_EXIT_INTR;
 		r = (-EINTR << 2) | RESUME_HOST | (r & RESUME_FLAG_NV);
 	}
+
+	if ((r = RESUME_GUEST) || (r = RESUME_GUEST_NV))
+		vcpu->stat.light_exits++;
+	else {
+		switch (run->exit_reason) {
+		case KVM_EXIT_MMIO: vcpu->stat.mmio_exits++; break;
+		case KVM_EXIT_DCR:  vcpu->stat.dcr_exits++;  break;
+		case KVM_EXIT_INTR:  vcpu->stat.signal_exits++;  break;
+		}
+	}
+	vcpu->stat.exits++;
 
 	return r;
 }
include/asm-powerpc/kvm_host.h +1 -0
@@ -40,6 +40,7 @@ struct kvm_vcpu_stat {
 struct kvm_vcpu_stat {
 	u32 exits;
 	u32 mmio_exits;
+	u32 dcr_exits;
 	u32 signal_exits;
 	u32 light_exits;
 };

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
kvm-ppc-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel

#1 lore raw

Re: [kvm-ppc-devel] [PATCH] kvmppc: add kvmstat support for ppc

Quoted 8 lines · On Mon, 2008-03-17 at 16:02 +0100, [email protected] wrote:

Subject: [PATCH] kvmppc: add kvmstat support for ppc exits

From: Christian Ehrhardt <[email protected]>

This patch adds support to report kvm ppc exit reasons via the kvm_stat infrastructure (debugfs).

Applied, thanks.

I simplified a little of the logic at the end, and I don't think things like "remote_tlb_flushes" make sense for us right now. However, I expect we'll be refining our statistics in the future anyways, so we can deal with it then.

Signature · 12 lines
Hollis Blanchard
IBM Linux Technology Center


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
kvm-ppc-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel