aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kvm/44x_emulate.c
diff options
context:
space:
mode:
authorHollis Blanchard <hollisb@us.ibm.com>2008-12-02 16:51:57 -0500
committerAvi Kivity <avi@redhat.com>2008-12-31 09:55:41 -0500
commit73e75b416ffcfa3a84952d8e389a0eca080f00e1 (patch)
tree6195be5b0fa56235550679f35ca990093dd081ca /arch/powerpc/kvm/44x_emulate.c
parentc5fbdffbda79254047ec83b09c1a61a3655d052a (diff)
KVM: ppc: Implement in-kernel exit timing statistics
Existing KVM statistics are either just counters (kvm_stat) reported for KVM generally or trace based aproaches like kvm_trace. For KVM on powerpc we had the need to track the timings of the different exit types. While this could be achieved parsing data created with a kvm_trace extension this adds too much overhead (at least on embedded PowerPC) slowing down the workloads we wanted to measure. Therefore this patch adds a in-kernel exit timing statistic to the powerpc kvm code. These statistic is available per vm&vcpu under the kvm debugfs directory. As this statistic is low, but still some overhead it can be enabled via a .config entry and should be off by default. Since this patch touched all powerpc kvm_stat code anyway this code is now merged and simplified together with the exit timing statistic code (still working with exit timing disabled in .config). Signed-off-by: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com> Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/powerpc/kvm/44x_emulate.c')
-rw-r--r--arch/powerpc/kvm/44x_emulate.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/arch/powerpc/kvm/44x_emulate.c b/arch/powerpc/kvm/44x_emulate.c
index 9ef79c78ede9..69f88d53c428 100644
--- a/arch/powerpc/kvm/44x_emulate.c
+++ b/arch/powerpc/kvm/44x_emulate.c
@@ -22,6 +22,7 @@
22#include <asm/dcr-regs.h> 22#include <asm/dcr-regs.h>
23#include <asm/disassemble.h> 23#include <asm/disassemble.h>
24#include <asm/kvm_44x.h> 24#include <asm/kvm_44x.h>
25#include "timing.h"
25 26
26#include "booke.h" 27#include "booke.h"
27#include "44x_tlb.h" 28#include "44x_tlb.h"
@@ -58,11 +59,11 @@ int kvmppc_core_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu,
58 int ws; 59 int ws;
59 60
60 switch (get_op(inst)) { 61 switch (get_op(inst)) {
61
62 case OP_RFI: 62 case OP_RFI:
63 switch (get_xop(inst)) { 63 switch (get_xop(inst)) {
64 case XOP_RFI: 64 case XOP_RFI:
65 kvmppc_emul_rfi(vcpu); 65 kvmppc_emul_rfi(vcpu);
66 kvmppc_set_exit_type(vcpu, EMULATED_RFI_EXITS);
66 *advance = 0; 67 *advance = 0;
67 break; 68 break;
68 69
@@ -78,10 +79,12 @@ int kvmppc_core_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu,
78 case XOP_MFMSR: 79 case XOP_MFMSR:
79 rt = get_rt(inst); 80 rt = get_rt(inst);
80 vcpu->arch.gpr[rt] = vcpu->arch.msr; 81 vcpu->arch.gpr[rt] = vcpu->arch.msr;
82 kvmppc_set_exit_type(vcpu, EMULATED_MFMSR_EXITS);
81 break; 83 break;
82 84
83 case XOP_MTMSR: 85 case XOP_MTMSR:
84 rs = get_rs(inst); 86 rs = get_rs(inst);
87 kvmppc_set_exit_type(vcpu, EMULATED_MTMSR_EXITS);
85 kvmppc_set_msr(vcpu, vcpu->arch.gpr[rs]); 88 kvmppc_set_msr(vcpu, vcpu->arch.gpr[rs]);
86 break; 89 break;
87 90
@@ -89,11 +92,13 @@ int kvmppc_core_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu,
89 rs = get_rs(inst); 92 rs = get_rs(inst);
90 vcpu->arch.msr = (vcpu->arch.msr & ~MSR_EE) 93 vcpu->arch.msr = (vcpu->arch.msr & ~MSR_EE)
91 | (vcpu->arch.gpr[rs] & MSR_EE); 94 | (vcpu->arch.gpr[rs] & MSR_EE);
95 kvmppc_set_exit_type(vcpu, EMULATED_WRTEE_EXITS);
92 break; 96 break;
93 97
94 case XOP_WRTEEI: 98 case XOP_WRTEEI:
95 vcpu->arch.msr = (vcpu->arch.msr & ~MSR_EE) 99 vcpu->arch.msr = (vcpu->arch.msr & ~MSR_EE)
96 | (inst & MSR_EE); 100 | (inst & MSR_EE);
101 kvmppc_set_exit_type(vcpu, EMULATED_WRTEE_EXITS);
97 break; 102 break;
98 103
99 case XOP_MFDCR: 104 case XOP_MFDCR:
@@ -127,6 +132,7 @@ int kvmppc_core_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu,
127 run->dcr.is_write = 0; 132 run->dcr.is_write = 0;
128 vcpu->arch.io_gpr = rt; 133 vcpu->arch.io_gpr = rt;
129 vcpu->arch.dcr_needed = 1; 134 vcpu->arch.dcr_needed = 1;
135 account_exit(vcpu, DCR_EXITS);
130 emulated = EMULATE_DO_DCR; 136 emulated = EMULATE_DO_DCR;
131 } 137 }
132 138
@@ -146,6 +152,7 @@ int kvmppc_core_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu,
146 run->dcr.data = vcpu->arch.gpr[rs]; 152 run->dcr.data = vcpu->arch.gpr[rs];
147 run->dcr.is_write = 1; 153 run->dcr.is_write = 1;
148 vcpu->arch.dcr_needed = 1; 154 vcpu->arch.dcr_needed = 1;
155 account_exit(vcpu, DCR_EXITS);
149 emulated = EMULATE_DO_DCR; 156 emulated = EMULATE_DO_DCR;
150 } 157 }
151 158
@@ -276,6 +283,7 @@ int kvmppc_core_emulate_mtspr(struct kvm_vcpu *vcpu, int sprn, int rs)
276 return EMULATE_FAIL; 283 return EMULATE_FAIL;
277 } 284 }
278 285
286 kvmppc_set_exit_type(vcpu, EMULATED_MTSPR_EXITS);
279 return EMULATE_DONE; 287 return EMULATE_DONE;
280} 288}
281 289
@@ -357,6 +365,7 @@ int kvmppc_core_emulate_mfspr(struct kvm_vcpu *vcpu, int sprn, int rt)
357 return EMULATE_FAIL; 365 return EMULATE_FAIL;
358 } 366 }
359 367
368 kvmppc_set_exit_type(vcpu, EMULATED_MFSPR_EXITS);
360 return EMULATE_DONE; 369 return EMULATE_DONE;
361} 370}
362 371