diff options
author | Amit Tomar <amittomer25@gmail.com> | 2015-11-26 05:09:43 -0500 |
---|---|---|
committer | Marc Zyngier <marc.zyngier@arm.com> | 2015-12-14 06:30:00 -0500 |
commit | b19e6892a90e7c9d15fde0a08516ec891a4e7d54 (patch) | |
tree | fb7416f7a164ef16e0280a56288d2cc79ab696f2 /arch/arm64/kvm | |
parent | 8cdb654abe5730654d0385382c4e877a011bb8c8 (diff) |
KVM: arm/arm64: Count guest exit due to various reasons
It would add guest exit statistics to debugfs, this can be helpful
while measuring KVM performance.
[ Renamed some of the field names - Christoffer ]
Signed-off-by: Amit Singh Tomar <amittomer25@gmail.com>
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
Diffstat (limited to 'arch/arm64/kvm')
-rw-r--r-- | arch/arm64/kvm/guest.c | 9 | ||||
-rw-r--r-- | arch/arm64/kvm/handle_exit.c | 3 |
2 files changed, 12 insertions, 0 deletions
diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c index d250160d32bc..115522ba2461 100644 --- a/arch/arm64/kvm/guest.c +++ b/arch/arm64/kvm/guest.c | |||
@@ -34,7 +34,16 @@ | |||
34 | 34 | ||
35 | #include "trace.h" | 35 | #include "trace.h" |
36 | 36 | ||
37 | #define VM_STAT(x) { #x, offsetof(struct kvm, stat.x), KVM_STAT_VM } | ||
38 | #define VCPU_STAT(x) { #x, offsetof(struct kvm_vcpu, stat.x), KVM_STAT_VCPU } | ||
39 | |||
37 | struct kvm_stats_debugfs_item debugfs_entries[] = { | 40 | struct kvm_stats_debugfs_item debugfs_entries[] = { |
41 | VCPU_STAT(hvc_exit_stat), | ||
42 | VCPU_STAT(wfe_exit_stat), | ||
43 | VCPU_STAT(wfi_exit_stat), | ||
44 | VCPU_STAT(mmio_exit_user), | ||
45 | VCPU_STAT(mmio_exit_kernel), | ||
46 | VCPU_STAT(exits), | ||
38 | { NULL } | 47 | { NULL } |
39 | }; | 48 | }; |
40 | 49 | ||
diff --git a/arch/arm64/kvm/handle_exit.c b/arch/arm64/kvm/handle_exit.c index 15f0477b0d2a..8bddae140461 100644 --- a/arch/arm64/kvm/handle_exit.c +++ b/arch/arm64/kvm/handle_exit.c | |||
@@ -39,6 +39,7 @@ static int handle_hvc(struct kvm_vcpu *vcpu, struct kvm_run *run) | |||
39 | 39 | ||
40 | trace_kvm_hvc_arm64(*vcpu_pc(vcpu), vcpu_get_reg(vcpu, 0), | 40 | trace_kvm_hvc_arm64(*vcpu_pc(vcpu), vcpu_get_reg(vcpu, 0), |
41 | kvm_vcpu_hvc_get_imm(vcpu)); | 41 | kvm_vcpu_hvc_get_imm(vcpu)); |
42 | vcpu->stat.hvc_exit_stat++; | ||
42 | 43 | ||
43 | ret = kvm_psci_call(vcpu); | 44 | ret = kvm_psci_call(vcpu); |
44 | if (ret < 0) { | 45 | if (ret < 0) { |
@@ -71,9 +72,11 @@ static int kvm_handle_wfx(struct kvm_vcpu *vcpu, struct kvm_run *run) | |||
71 | { | 72 | { |
72 | if (kvm_vcpu_get_hsr(vcpu) & ESR_ELx_WFx_ISS_WFE) { | 73 | if (kvm_vcpu_get_hsr(vcpu) & ESR_ELx_WFx_ISS_WFE) { |
73 | trace_kvm_wfx_arm64(*vcpu_pc(vcpu), true); | 74 | trace_kvm_wfx_arm64(*vcpu_pc(vcpu), true); |
75 | vcpu->stat.wfe_exit_stat++; | ||
74 | kvm_vcpu_on_spin(vcpu); | 76 | kvm_vcpu_on_spin(vcpu); |
75 | } else { | 77 | } else { |
76 | trace_kvm_wfx_arm64(*vcpu_pc(vcpu), false); | 78 | trace_kvm_wfx_arm64(*vcpu_pc(vcpu), false); |
79 | vcpu->stat.wfi_exit_stat++; | ||
77 | kvm_vcpu_block(vcpu); | 80 | kvm_vcpu_block(vcpu); |
78 | } | 81 | } |
79 | 82 | ||