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: extend kvmstat exit information of
Date: Fri, 28 Mar 2008 14:48:39 +0000	[thread overview]
Message-ID: <1206715719868-git-send-email-ehrhardt@linux.vnet.ibm.com> (raw)

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

This adds a more detailed view of the light exits in kvmstat for kvmppc.
The values are split in that way
sum_exit
|-> mmio_exits
|-> dcr_exits
|-> signal_exits
|-> light_exits
    |-> itlb_r   - real itlb misses we deliver to the guest 
    |-> itlb_v   - virtual itlb misses we handle for the guest
    |-> dtlb_r   - real dtlb misses we deliver to the guest
    |-> dtlb_v   - virtual dtlb misses we handle for the guest
    |-> sysc     - syscall
    |-> isi      - instruction storage exception
    |-> dsi      - data storage exception
    |-> inst_emu - intruction emulation
    |-> dec      - decrementer
    |-> ext_intr - external interrupt

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

An example look at the guest now looks like this (I send an updated kvmstat script for non-python environments):
|   exits|     dcr|    mmio|     sig|   light|  itlb_v|  itlb_r|     isi|  dtlb_v|  dtlb_r|     dsi|inst_emu|    sysc|     dec|ext_intr|
|  131453|      60|      20|     118|  131136|   28999|     871|     116|   31869|     810|     294|   68092|      82|     305|      58|
The ratio between these exit types are stable across the complete guest boot process, no obvious big peak in one type on e.g. network init where it *pauses* a while.
~99% of exits are light exits which means exits that end with RESUME_GUEST
  -> ~25% of those are virtial itlb misses (caused by our tlb code)
  -> ~25% of those are virtial itlb misses (caused by our tlb code)
  -> ~50% light exits to emulate instructions

---

[diffstat]
 arch/powerpc/kvm/powerpc.c     |   37 +++++++++++++++++++++++++++++--------
 include/asm-powerpc/kvm_host.h |   15 +++++++++++++--
 2 files changed, 42 insertions(+), 10 deletions(-)

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
@@ -41,12 +41,21 @@ unsigned long kvmppc_44x_handlers;
 #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) },
+	{ "exits",        VCPU_STAT(sum_exits) },
+	{ "mmio",       VCPU_STAT(mmio_exits) },
+	{ "dcr",        VCPU_STAT(dcr_exits) },
+	{ "sig",     VCPU_STAT(signal_exits) },
+	{ "light",      VCPU_STAT(light_exits) },
+	{ "itlb_r",      VCPU_STAT(itlb_real_miss_exits) },
+	{ "itlb_v",      VCPU_STAT(itlb_virt_miss_exits) },
+	{ "dtlb_r",      VCPU_STAT(dtlb_real_miss_exits) },
+	{ "dtlb_v",      VCPU_STAT(dtlb_virt_miss_exits) },
+	{ "sysc",      VCPU_STAT(syscall_exits) },
+	{ "isi",      VCPU_STAT(isi_exits) },
+	{ "dsi",      VCPU_STAT(dsi_exits) },
+	{ "inst_emu",      VCPU_STAT(emulated_inst_exits) },
+	{ "dec",      VCPU_STAT(dec_exits) },
+	{ "ext_intr",      VCPU_STAT(ext_intr_exits) },
 	{ NULL }
 };
 
@@ -314,6 +323,10 @@ int kvmppc_handle_exit(struct kvm_run *r
 		 * misses before ceding control. */
 		if (need_resched())
 			cond_resched();
+		if (exit_nr=BOOKE_INTERRUPT_DECREMENTER)
+			vcpu->stat.dec_exits++;
+		else
+			vcpu->stat.ext_intr_exits++;
 		r = RESUME_GUEST;
 		break;
 
@@ -323,6 +336,7 @@ int kvmppc_handle_exit(struct kvm_run *r
 		case EMULATE_DONE:
 			/* Future optimization: only reload non-volatiles if
 			 * they were actually modified by emulation. */
+			vcpu->stat.emulated_inst_exits++;
 			r = RESUME_GUEST_NV;
 			break;
 		case EMULATE_DO_DCR:
@@ -348,17 +362,20 @@ int kvmppc_handle_exit(struct kvm_run *r
 		vcpu->arch.dear = vcpu->arch.fault_dear;
 		vcpu->arch.esr = vcpu->arch.fault_esr;
 		kvmppc_queue_exception(vcpu, exit_nr);
+		vcpu->stat.dsi_exits++;
 		r = RESUME_GUEST;
 		break;
 
 	case BOOKE_INTERRUPT_INST_STORAGE:
 		vcpu->arch.esr = vcpu->arch.fault_esr;
 		kvmppc_queue_exception(vcpu, exit_nr);
+		vcpu->stat.isi_exits++;
 		r = RESUME_GUEST;
 		break;
 
 	case BOOKE_INTERRUPT_SYSCALL:
 		kvmppc_queue_exception(vcpu, exit_nr);
+		vcpu->stat.syscall_exits++;
 		r = RESUME_GUEST;
 		break;
 
@@ -375,6 +392,7 @@ int kvmppc_handle_exit(struct kvm_run *r
 			kvmppc_queue_exception(vcpu, exit_nr);
 			vcpu->arch.dear = vcpu->arch.fault_dear;
 			vcpu->arch.esr = vcpu->arch.fault_esr;
+			vcpu->stat.dtlb_real_miss_exits++;
 			r = RESUME_GUEST;
 			break;
 		}
@@ -394,6 +412,7 @@ int kvmppc_handle_exit(struct kvm_run *r
 			kvmppc_44x_tlb_trace(KVMPPC_44x_STLB_WRITE, index,
 			                     &vcpu->arch.shadow_tlb[index],
 					     gtlbe - vcpu->arch.guest_tlb);
+			vcpu->stat.dtlb_virt_miss_exits++;
 			r = RESUME_GUEST;
 		} else {
 			/* Guest has mapped and accessed a page which is not
@@ -417,9 +436,11 @@ int kvmppc_handle_exit(struct kvm_run *r
 		if (!gtlbe) {
 			/* The guest didn't have a mapping for it. */
 			kvmppc_queue_exception(vcpu, exit_nr);
-			r = RESUME_GUEST;
+			vcpu->stat.itlb_real_miss_exits++;
 			break;
 		}
+
+		vcpu->stat.itlb_virt_miss_exits++;
 
 		gfn = tlb_xlate(gtlbe, eaddr) >> PAGE_SHIFT;
 
@@ -454,7 +475,7 @@ int kvmppc_handle_exit(struct kvm_run *r
 	kvmppc_check_and_deliver_interrupts(vcpu);
 
 	/* Do some exit accounting. */
-	vcpu->stat.exits++;
+	vcpu->stat.sum_exits++;
 	if (!(r & RESUME_HOST)) {
 		/* To avoid clobbering exit_reason, only check for signals if
 		 * we aren't already exiting to userspace for some other
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
@@ -43,11 +43,22 @@ struct kvm_vm_stat {
 };
 
 struct kvm_vcpu_stat {
-	u32 exits;
+	u32 sum_exits;
 	u32 mmio_exits;
 	u32 dcr_exits;
 	u32 signal_exits;
-	u32 light_exits;
+	u32 light_exits; /* ~RESUME_GUEST */
+	/* account special types of light exists */
+	u32 itlb_real_miss_exits;
+	u32 itlb_virt_miss_exits;
+	u32 dtlb_real_miss_exits;
+	u32 dtlb_virt_miss_exits;
+	u32 syscall_exits;
+	u32 isi_exits;
+	u32 dsi_exits;
+	u32 emulated_inst_exits;
+	u32 dec_exits;
+	u32 ext_intr_exits;
 };
 
 struct tlbe {

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
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-28 14:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1206715719868-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