diff options
author | Hollis Blanchard <hollisb@us.ibm.com> | 2008-12-02 16:51:57 -0500 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2008-12-31 09:55:41 -0500 |
commit | 73e75b416ffcfa3a84952d8e389a0eca080f00e1 (patch) | |
tree | 6195be5b0fa56235550679f35ca990093dd081ca /arch/powerpc/include | |
parent | c5fbdffbda79254047ec83b09c1a61a3655d052a (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/include')
-rw-r--r-- | arch/powerpc/include/asm/kvm_host.h | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h index a4a7d5ef6cf8..2f5b49f2a98e 100644 --- a/arch/powerpc/include/asm/kvm_host.h +++ b/arch/powerpc/include/asm/kvm_host.h | |||
@@ -71,6 +71,49 @@ struct kvmppc_44x_tlbe { | |||
71 | u32 word2; | 71 | u32 word2; |
72 | }; | 72 | }; |
73 | 73 | ||
74 | enum kvm_exit_types { | ||
75 | MMIO_EXITS, | ||
76 | DCR_EXITS, | ||
77 | SIGNAL_EXITS, | ||
78 | ITLB_REAL_MISS_EXITS, | ||
79 | ITLB_VIRT_MISS_EXITS, | ||
80 | DTLB_REAL_MISS_EXITS, | ||
81 | DTLB_VIRT_MISS_EXITS, | ||
82 | SYSCALL_EXITS, | ||
83 | ISI_EXITS, | ||
84 | DSI_EXITS, | ||
85 | EMULATED_INST_EXITS, | ||
86 | EMULATED_MTMSRWE_EXITS, | ||
87 | EMULATED_WRTEE_EXITS, | ||
88 | EMULATED_MTSPR_EXITS, | ||
89 | EMULATED_MFSPR_EXITS, | ||
90 | EMULATED_MTMSR_EXITS, | ||
91 | EMULATED_MFMSR_EXITS, | ||
92 | EMULATED_TLBSX_EXITS, | ||
93 | EMULATED_TLBWE_EXITS, | ||
94 | EMULATED_RFI_EXITS, | ||
95 | DEC_EXITS, | ||
96 | EXT_INTR_EXITS, | ||
97 | HALT_WAKEUP, | ||
98 | USR_PR_INST, | ||
99 | FP_UNAVAIL, | ||
100 | DEBUG_EXITS, | ||
101 | TIMEINGUEST, | ||
102 | __NUMBER_OF_KVM_EXIT_TYPES | ||
103 | }; | ||
104 | |||
105 | #ifdef CONFIG_KVM_EXIT_TIMING | ||
106 | /* allow access to big endian 32bit upper/lower parts and 64bit var */ | ||
107 | struct exit_timing { | ||
108 | union { | ||
109 | u64 tv64; | ||
110 | struct { | ||
111 | u32 tbu, tbl; | ||
112 | } tv32; | ||
113 | }; | ||
114 | }; | ||
115 | #endif | ||
116 | |||
74 | struct kvm_arch { | 117 | struct kvm_arch { |
75 | }; | 118 | }; |
76 | 119 | ||
@@ -130,6 +173,19 @@ struct kvm_vcpu_arch { | |||
130 | u32 dbcr0; | 173 | u32 dbcr0; |
131 | u32 dbcr1; | 174 | u32 dbcr1; |
132 | 175 | ||
176 | #ifdef CONFIG_KVM_EXIT_TIMING | ||
177 | struct exit_timing timing_exit; | ||
178 | struct exit_timing timing_last_enter; | ||
179 | u32 last_exit_type; | ||
180 | u32 timing_count_type[__NUMBER_OF_KVM_EXIT_TYPES]; | ||
181 | u64 timing_sum_duration[__NUMBER_OF_KVM_EXIT_TYPES]; | ||
182 | u64 timing_sum_quad_duration[__NUMBER_OF_KVM_EXIT_TYPES]; | ||
183 | u64 timing_min_duration[__NUMBER_OF_KVM_EXIT_TYPES]; | ||
184 | u64 timing_max_duration[__NUMBER_OF_KVM_EXIT_TYPES]; | ||
185 | u64 timing_last_exit; | ||
186 | struct dentry *debugfs_exit_timing; | ||
187 | #endif | ||
188 | |||
133 | u32 last_inst; | 189 | u32 last_inst; |
134 | ulong fault_dear; | 190 | ulong fault_dear; |
135 | ulong fault_esr; | 191 | ulong fault_esr; |