KVM: Add statistics for guest irq injections
authorAvi Kivity <avi@qumranet.com>
Mon, 1 Sep 2008 12:57:51 +0000 (15:57 +0300)
committerAvi Kivity <avi@qumranet.com>
Wed, 15 Oct 2008 08:15:25 +0000 (10:15 +0200)
These can help show whether a guest is making progress or not.

Signed-off-by: Avi Kivity <avi@qumranet.com>
arch/x86/kvm/svm.c
arch/x86/kvm/vmx.c
arch/x86/kvm/x86.c
include/asm-x86/kvm_host.h

index 60228888d1b5c517deaf6d179a5031bae1af9767..9b54550fa4d24d59eeb014b572d2a8ff40ca2a99 100644 (file)
@@ -1519,6 +1519,7 @@ static inline void svm_inject_irq(struct vcpu_svm *svm, int irq)
 
        KVMTRACE_1D(INJ_VIRQ, &svm->vcpu, (u32)irq, handler);
 
+       ++svm->vcpu.stat.irq_injections;
        control = &svm->vmcb->control;
        control->int_vector = irq;
        control->int_ctl &= ~V_INTR_PRIO_MASK;
index 71e57ae1cab70ea739d452ecd0a3a5d041559802..e7e8c86f1b7dfb73d280c6f6ee7bbc723e2e8580 100644 (file)
@@ -2341,6 +2341,7 @@ static void vmx_inject_irq(struct kvm_vcpu *vcpu, int irq)
 
        KVMTRACE_1D(INJ_VIRQ, vcpu, (u32)irq, handler);
 
+       ++vcpu->stat.irq_injections;
        if (vcpu->arch.rmode.active) {
                vmx->rmode.irq.pending = true;
                vmx->rmode.irq.vector = irq;
index e3b89662cf6d6746adafd65b5e38117cef070c22..3f3cb7107c03179f8b46fc45488b72ce21075d66 100644 (file)
@@ -92,6 +92,7 @@ struct kvm_stats_debugfs_item debugfs_entries[] = {
        { "fpu_reload", VCPU_STAT(fpu_reload) },
        { "insn_emulation", VCPU_STAT(insn_emulation) },
        { "insn_emulation_fail", VCPU_STAT(insn_emulation_fail) },
+       { "irq_injections", VCPU_STAT(irq_injections) },
        { "mmu_shadow_zapped", VM_STAT(mmu_shadow_zapped) },
        { "mmu_pte_write", VM_STAT(mmu_pte_write) },
        { "mmu_pte_updated", VM_STAT(mmu_pte_updated) },
index b6d26b80b75bb5ed07c4f36959e7f2985358b532..68a3ac13afce3acb77980a06301e626431b81550 100644 (file)
@@ -413,6 +413,7 @@ struct kvm_vcpu_stat {
        u32 insn_emulation;
        u32 insn_emulation_fail;
        u32 hypercalls;
+       u32 irq_injections;
 };
 
 struct descriptor_table {