From mboxrd@z Thu Jan 1 00:00:00 1970 From: ehrhardt@linux.vnet.ibm.com Date: Mon, 17 Mar 2008 15:02:26 +0000 Subject: [kvm-ppc-devel] [PATCH] kvmppc: add kvmstat support for ppc exits Message-Id: <1205766146831-git-send-email-ehrhardt@linux.vnet.ibm.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: kvm-ppc@vger.kernel.org Subject: [PATCH] kvmppc: add kvmstat support for ppc exits From: Christian Ehrhardt This patch adds support to report kvm ppc exit reasons via the kvm_stat infrastructure (debugfs). Signed-off-by: Christian Ehrhardt --- [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