Signed-off-by: Gregory Haskins <[EMAIL PROTECTED]> --- drivers/kvm/kvm.h | 6 ++++++ drivers/kvm/kvm_main.c | 23 ++++++++++++++++++++--- drivers/kvm/vmx.c | 2 ++ 3 files changed, 28 insertions(+), 3 deletions(-)
diff --git a/drivers/kvm/kvm.h b/drivers/kvm/kvm.h index b417d80..31b3adf 100644 --- a/drivers/kvm/kvm.h +++ b/drivers/kvm/kvm.h @@ -277,6 +277,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 6fd335e..f12ea83 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 } }; @@ -1137,13 +1143,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, @@ -2447,6 +2459,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)) { @@ -2466,8 +2480,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/vmx.c b/drivers/kvm/vmx.c index e6b6cd9..f7d72d9 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