Signed-off-by: Gregory Haskins <[EMAIL PROTECTED]> --- drivers/kvm/kvm.h | 6 ++++++ drivers/kvm/kvm_main.c | 23 ++++++++++++++++++++--- drivers/kvm/svm.c | 2 ++ drivers/kvm/vmx.c | 2 ++ 4 files changed, 30 insertions(+), 3 deletions(-)
diff --git a/drivers/kvm/kvm.h b/drivers/kvm/kvm.h index 76582e2..57b6d14 100644 --- a/drivers/kvm/kvm.h +++ b/drivers/kvm/kvm.h @@ -279,6 +279,12 @@ struct kvm_stat { u32 irq_exits; u32 light_exits; u32 efer_reload; + u32 irq_posted; + u32 irq_ignored; + u32 irq_accepted; + u32 guest_preempt; + u32 apic_mmio; + u32 local_mmio; }; struct kvm_io_device { diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c index 2a1b376..79b6477 100644 --- a/drivers/kvm/kvm_main.c +++ b/drivers/kvm/kvm_main.c @@ -73,6 +73,12 @@ static struct kvm_stats_debugfs_item { { "irq_exits", STAT_OFFSET(irq_exits) }, { "light_exits", STAT_OFFSET(light_exits) }, { "efer_reload", STAT_OFFSET(efer_reload) }, + { "irq_posted", STAT_OFFSET(irq_posted) }, + { "irq_ignored", STAT_OFFSET(irq_ignored) }, + { "irq_accepted", STAT_OFFSET(irq_accepted) }, + { "guest_preempt", STAT_OFFSET(guest_preempt) }, + { "apic_mmio", STAT_OFFSET(apic_mmio) }, + { "local_mmio", STAT_OFFSET(local_mmio) }, { NULL } }; @@ -1136,13 +1142,19 @@ static struct kvm_io_device *vcpu_find_mmio_dev(struct kvm_vcpu *vcpu, /* * First check if the LAPIC will snarf this request */ - if (dev && dev->in_range(dev, addr)) + if (dev && dev->in_range(dev, addr)) { + ++vcpu->stat.apic_mmio; return dev; + } /* * And then fallback to allow any device to participate */ - return kvm_io_bus_find_dev(&vcpu->kvm->mmio_bus, addr); + dev = kvm_io_bus_find_dev(&vcpu->kvm->mmio_bus, addr); + if (dev) + ++vcpu->stat.local_mmio; + + return dev; } static int emulator_read_emulated(unsigned long addr, @@ -2446,6 +2458,8 @@ static void kvm_vcpu_intr(struct kvm_irqsink *this, struct kvm_vcpu *vcpu = (struct kvm_vcpu*)this->private; int direct_ipi = -1; + ++vcpu->stat.irq_posted; + spin_lock_irq(&vcpu->irq.lock); if (!test_bit(pin, &vcpu->irq.pending)) { @@ -2465,8 +2479,11 @@ static void kvm_vcpu_intr(struct kvm_irqsink *this, */ direct_ipi = vcpu->irq.guest_cpu; BUG_ON(direct_ipi == smp_processor_id()); + ++vcpu->stat.guest_preempt; } - } + } else + ++vcpu->stat.irq_ignored; + spin_unlock_irq(&vcpu->irq.lock); diff --git a/drivers/kvm/svm.c b/drivers/kvm/svm.c index ccc5856..61dfee2 100644 --- a/drivers/kvm/svm.c +++ b/drivers/kvm/svm.c @@ -1435,6 +1435,8 @@ static void do_intr_requests(struct kvm_vcpu *vcpu, control->int_ctl |= V_IRQ_MASK | ((/*control->int_vector >> 4*/ 0xf) << V_INTR_PRIO_SHIFT); + + ++vcpu->stat.irq_accepted; } } diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c index 7923a42..1dd8c9c 100644 --- a/drivers/kvm/vmx.c +++ b/drivers/kvm/vmx.c @@ -1545,6 +1545,8 @@ static void do_intr_requests(struct kvm_vcpu *vcpu, ack.vector | INTR_TYPE_EXT_INTR | INTR_INFO_VALID_MASK); + + ++vcpu->stat.irq_accepted; } } ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel