]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
KVM: PPC: Book3S HV: Counters for passthrough IRQ stats
authorSuresh Warrier <warrier@linux.vnet.ibm.com>
Fri, 19 Aug 2016 05:35:57 +0000 (15:35 +1000)
committerPaul Mackerras <paulus@ozlabs.org>
Mon, 12 Sep 2016 00:12:34 +0000 (10:12 +1000)
Add VCPU stat counters to track affinity for passthrough
interrupts.

pthru_all: Counts all passthrough interrupts whose IRQ mappings are
           in the kvmppc_passthru_irq_map structure.
pthru_host: Counts all cached passthrough interrupts that were injected
    from the host through kvm_set_irq (i.e. not handled in
    real mode).
pthru_bad_aff: Counts how many cached passthrough interrupts have
               bad affinity (receiving CPU is not running VCPU that is
       the target of the virtual interrupt in the guest).

Signed-off-by: Suresh Warrier <warrier@linux.vnet.ibm.com>
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
arch/powerpc/include/asm/kvm_host.h
arch/powerpc/kvm/book3s.c
arch/powerpc/kvm/book3s_hv_rm_xics.c

index 89ac1f6c2cb2cbf1f650b4bda7eb0adfde4c6a21..ed30d2ea21b7b3a5630b6965591427172776bf11 100644 (file)
@@ -137,6 +137,9 @@ struct kvm_vcpu_stat {
        u64 ld_slow;
        u64 st_slow;
 #endif
+       u64 pthru_all;
+       u64 pthru_host;
+       u64 pthru_bad_aff;
 };
 
 enum kvm_exit_types {
index 71eb8f3d3b54ccdd206843f01825f41193774830..ba231a1d43d46835bda1ef4664a91f77e122bc91 100644 (file)
@@ -68,6 +68,9 @@ struct kvm_stats_debugfs_item debugfs_entries[] = {
        { "ld_slow",     VCPU_STAT(ld_slow) },
        { "st",          VCPU_STAT(st) },
        { "st_slow",     VCPU_STAT(st_slow) },
+       { "pthru_all",       VCPU_STAT(pthru_all) },
+       { "pthru_host",      VCPU_STAT(pthru_host) },
+       { "pthru_bad_aff",   VCPU_STAT(pthru_bad_aff) },
        { NULL }
 };
 
index 5f7527ec4ad58d7e7c2f9987446452b3bada7e85..82ff5de8b1e7a5564df01dd323c0662ab6457b3b 100644 (file)
@@ -716,11 +716,19 @@ int kvmppc_rm_h_eoi(struct kvm_vcpu *vcpu, unsigned long xirr)
                icp->rm_eoied_irq = irq;
        }
 
-       if (state->host_irq && state->intr_cpu != -1) {
-               int pcpu = cpu_first_thread_sibling(raw_smp_processor_id());
-               if (state->intr_cpu != pcpu)
-                       xics_opal_rm_set_server(state->host_irq, pcpu);
-               state->intr_cpu = -1;
+       if (state->host_irq) {
+               ++vcpu->stat.pthru_all;
+               if (state->intr_cpu != -1) {
+                       int pcpu = raw_smp_processor_id();
+
+                       pcpu = cpu_first_thread_sibling(pcpu);
+                       ++vcpu->stat.pthru_host;
+                       if (state->intr_cpu != pcpu) {
+                               ++vcpu->stat.pthru_bad_aff;
+                               xics_opal_rm_set_server(state->host_irq, pcpu);
+                       }
+                       state->intr_cpu = -1;
+               }
        }
  bail:
        return check_too_hard(xics, icp);