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 a9ee8bd..efc9be5 100644
--- a/drivers/kvm/kvm.h
+++ b/drivers/kvm/kvm.h
@@ -276,6 +276,12 @@ struct kvm_stat {
        u32 request_irq_exits;
        u32 irq_exits;
        u32 light_exits;
+       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 941a4c6..a4c180f 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -72,6 +72,12 @@ static struct kvm_stats_debugfs_item {
        { "request_irq", STAT_OFFSET(request_irq_exits) },
        { "irq_exits", STAT_OFFSET(irq_exits) },
        { "light_exits", STAT_OFFSET(light_exits) },
+       { "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/vmx.c b/drivers/kvm/vmx.c
index f532c87..357fb86 100644
--- a/drivers/kvm/vmx.c
+++ b/drivers/kvm/vmx.c
@@ -1522,6 +1522,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

Reply via email to