aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/kvm/kvm.h2
-rw-r--r--drivers/kvm/x86.c4
2 files changed, 6 insertions, 0 deletions
diff --git a/drivers/kvm/kvm.h b/drivers/kvm/kvm.h
index a85c5903591f..5a8a9af3593a 100644
--- a/drivers/kvm/kvm.h
+++ b/drivers/kvm/kvm.h
@@ -249,6 +249,8 @@ struct kvm_stat {
249 u32 host_state_reload; 249 u32 host_state_reload;
250 u32 efer_reload; 250 u32 efer_reload;
251 u32 fpu_reload; 251 u32 fpu_reload;
252 u32 insn_emulation;
253 u32 insn_emulation_fail;
252}; 254};
253 255
254struct kvm_io_device { 256struct kvm_io_device {
diff --git a/drivers/kvm/x86.c b/drivers/kvm/x86.c
index c1211e125b43..a46b95b3651c 100644
--- a/drivers/kvm/x86.c
+++ b/drivers/kvm/x86.c
@@ -63,6 +63,8 @@ struct kvm_stats_debugfs_item debugfs_entries[] = {
63 { "host_state_reload", STAT_OFFSET(host_state_reload) }, 63 { "host_state_reload", STAT_OFFSET(host_state_reload) },
64 { "efer_reload", STAT_OFFSET(efer_reload) }, 64 { "efer_reload", STAT_OFFSET(efer_reload) },
65 { "fpu_reload", STAT_OFFSET(fpu_reload) }, 65 { "fpu_reload", STAT_OFFSET(fpu_reload) },
66 { "insn_emulation", STAT_OFFSET(insn_emulation) },
67 { "insn_emulation_fail", STAT_OFFSET(insn_emulation_fail) },
66 { NULL } 68 { NULL }
67}; 69};
68 70
@@ -1381,7 +1383,9 @@ int emulate_instruction(struct kvm_vcpu *vcpu,
1381 get_segment_base(vcpu, VCPU_SREG_FS); 1383 get_segment_base(vcpu, VCPU_SREG_FS);
1382 1384
1383 r = x86_decode_insn(&vcpu->emulate_ctxt, &emulate_ops); 1385 r = x86_decode_insn(&vcpu->emulate_ctxt, &emulate_ops);
1386 ++vcpu->stat.insn_emulation;
1384 if (r) { 1387 if (r) {
1388 ++vcpu->stat.insn_emulation_fail;
1385 if (kvm_mmu_unprotect_page_virt(vcpu, cr2)) 1389 if (kvm_mmu_unprotect_page_virt(vcpu, cr2))
1386 return EMULATE_DONE; 1390 return EMULATE_DONE;
1387 return EMULATE_FAIL; 1391 return EMULATE_FAIL;