Kernel KVM-PPC virtualization development
 help / color / mirror / Atom feed
From: ehrhardt@linux.vnet.ibm.com
To: kvm-ppc@vger.kernel.org
Subject: [kvm-ppc-devel] [PATCH] kvmppc: add kvmstat support for ppc exits
Date: Mon, 17 Mar 2008 15:02:26 +0000	[thread overview]
Message-ID: <1205766146831-git-send-email-ehrhardt@linux.vnet.ibm.com> (raw)

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

             reply	other threads:[~2008-03-17 15:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-17 15:02 ehrhardt [this message]
2008-03-17 20:21 ` [kvm-ppc-devel] [PATCH] kvmppc: add kvmstat support for ppc Hollis Blanchard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1205766146831-git-send-email-ehrhardt@linux.vnet.ibm.com \
    --to=ehrhardt@linux.vnet.ibm.com \
    --cc=kvm-ppc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox