Kernel KVM-PPC virtualization development
 help / color / mirror / Atom feed
* [kvm-ppc-devel] [PATCH] kvmppc: add kvmstat support for ppc exits
@ 2008-03-17 15:02 ehrhardt
  2008-03-17 20:21 ` [kvm-ppc-devel] [PATCH] kvmppc: add kvmstat support for ppc Hollis Blanchard
  0 siblings, 1 reply; 2+ messages in thread
From: ehrhardt @ 2008-03-17 15:02 UTC (permalink / raw)
  To: kvm-ppc

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

From: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>

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

Signed-off-by: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>
---

[diffstat]
 arch/powerpc/kvm/powerpc.c     |   20 ++++++++++++++++++++
 include/asm-powerpc/kvm_host.h |    1 +
 2 files changed, 21 insertions(+)

diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -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;
 }
diff --git a/include/asm-powerpc/kvm_host.h b/include/asm-powerpc/kvm_host.h
--- a/include/asm-powerpc/kvm_host.h
+++ b/include/asm-powerpc/kvm_host.h
@@ -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
kvm-ppc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel

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

* Re: [kvm-ppc-devel] [PATCH] kvmppc: add kvmstat support for ppc
  2008-03-17 15:02 [kvm-ppc-devel] [PATCH] kvmppc: add kvmstat support for ppc exits ehrhardt
@ 2008-03-17 20:21 ` Hollis Blanchard
  0 siblings, 0 replies; 2+ messages in thread
From: Hollis Blanchard @ 2008-03-17 20:21 UTC (permalink / raw)
  To: kvm-ppc

On Mon, 2008-03-17 at 16:02 +0100, ehrhardt@linux.vnet.ibm.com wrote:
> Subject: [PATCH] kvmppc: add kvmstat support for ppc exits
> 
> From: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>
> 
> This patch adds support to report kvm ppc exit reasons via the kvm_stat
> infrastructure (debugfs).
> 
> Signed-off-by: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>

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.

-- 
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
kvm-ppc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-ppc-devel

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

end of thread, other threads:[~2008-03-17 20:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-17 15:02 [kvm-ppc-devel] [PATCH] kvmppc: add kvmstat support for ppc exits ehrhardt
2008-03-17 20:21 ` [kvm-ppc-devel] [PATCH] kvmppc: add kvmstat support for ppc Hollis Blanchard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox