All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Mackerras <paulus@ozlabs.org>
To: kvm@vger.kernel.org, linuxppc-dev@ozlabs.org
Cc: kvm-ppc@vger.kernel.org
Subject: [PATCH 13/13] KVM: PPC: Book3S HV: Counters for passthrough IRQ stats
Date: Fri, 19 Aug 2016 15:35:57 +1000	[thread overview]
Message-ID: <1471584957-21484-14-git-send-email-paulus@ozlabs.org> (raw)
In-Reply-To: <1471584957-21484-1-git-send-email-paulus@ozlabs.org>

From: Suresh Warrier <warrier@linux.vnet.ibm.com>

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  |  3 +++
 arch/powerpc/kvm/book3s.c            |  3 +++
 arch/powerpc/kvm/book3s_hv_rm_xics.c | 18 +++++++++++++-----
 3 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h
index 3eb5092..f371a23 100644
--- a/arch/powerpc/include/asm/kvm_host.h
+++ b/arch/powerpc/include/asm/kvm_host.h
@@ -131,6 +131,9 @@ struct kvm_vcpu_stat {
 	u32 ld_slow;
 	u32 st_slow;
 #endif
+	u32 pthru_all;
+	u32 pthru_host;
+	u32 pthru_bad_aff;
 };
 
 enum kvm_exit_types {
diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c
index 47018fc..6d0c45b 100644
--- a/arch/powerpc/kvm/book3s.c
+++ b/arch/powerpc/kvm/book3s.c
@@ -64,6 +64,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 }
 };
 
diff --git a/arch/powerpc/kvm/book3s_hv_rm_xics.c b/arch/powerpc/kvm/book3s_hv_rm_xics.c
index 5f7527e..82ff5de 100644
--- a/arch/powerpc/kvm/book3s_hv_rm_xics.c
+++ b/arch/powerpc/kvm/book3s_hv_rm_xics.c
@@ -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);
-- 
2.8.1


WARNING: multiple messages have this Message-ID (diff)
From: Paul Mackerras <paulus@ozlabs.org>
To: kvm@vger.kernel.org, linuxppc-dev@ozlabs.org
Cc: kvm-ppc@vger.kernel.org
Subject: [PATCH 13/13] KVM: PPC: Book3S HV: Counters for passthrough IRQ stats
Date: Fri, 19 Aug 2016 05:35:57 +0000	[thread overview]
Message-ID: <1471584957-21484-14-git-send-email-paulus@ozlabs.org> (raw)
In-Reply-To: <1471584957-21484-1-git-send-email-paulus@ozlabs.org>

From: Suresh Warrier <warrier@linux.vnet.ibm.com>

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  |  3 +++
 arch/powerpc/kvm/book3s.c            |  3 +++
 arch/powerpc/kvm/book3s_hv_rm_xics.c | 18 +++++++++++++-----
 3 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h
index 3eb5092..f371a23 100644
--- a/arch/powerpc/include/asm/kvm_host.h
+++ b/arch/powerpc/include/asm/kvm_host.h
@@ -131,6 +131,9 @@ struct kvm_vcpu_stat {
 	u32 ld_slow;
 	u32 st_slow;
 #endif
+	u32 pthru_all;
+	u32 pthru_host;
+	u32 pthru_bad_aff;
 };
 
 enum kvm_exit_types {
diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c
index 47018fc..6d0c45b 100644
--- a/arch/powerpc/kvm/book3s.c
+++ b/arch/powerpc/kvm/book3s.c
@@ -64,6 +64,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 }
 };
 
diff --git a/arch/powerpc/kvm/book3s_hv_rm_xics.c b/arch/powerpc/kvm/book3s_hv_rm_xics.c
index 5f7527e..82ff5de 100644
--- a/arch/powerpc/kvm/book3s_hv_rm_xics.c
+++ b/arch/powerpc/kvm/book3s_hv_rm_xics.c
@@ -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);
-- 
2.8.1


  parent reply	other threads:[~2016-08-19  5:36 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-19  5:35 [PATCH 00/13] Real-mode acceleration of device interrupts in HV KVM Paul Mackerras
2016-08-19  5:35 ` Paul Mackerras
2016-08-19  5:35 ` [PATCH 01/13] powerpc: Add simple cache inhibited MMIO accessors Paul Mackerras
2016-08-19  5:35   ` Paul Mackerras
2016-08-19  5:35 ` [PATCH 02/13] KVM: PPC: Book3S HV: Convert kvmppc_read_intr to a C function Paul Mackerras
2016-08-19  5:35   ` Paul Mackerras
2016-08-19  5:35 ` [PATCH 03/13] KVM: PPC: select IRQ_BYPASS_MANAGER Paul Mackerras
2016-08-19  5:35   ` Paul Mackerras
2016-08-19  5:35 ` [PATCH 04/13] KVM: PPC: Book3S HV: Introduce kvmppc_passthru_irqmap Paul Mackerras
2016-08-19  5:35   ` Paul Mackerras
2016-08-19  5:35 ` [PATCH 05/13] powerpc/powernv: Provide facilities for EOI, usable from real mode Paul Mackerras
2016-08-19  5:35   ` Paul Mackerras
2016-08-19  5:35 ` [PATCH 06/13] KVM: PPC: Book3S HV: Enable IRQ bypass Paul Mackerras
2016-08-19  5:35   ` Paul Mackerras
2016-08-19  5:35 ` [PATCH 07/13] KVM: PPC: Book3S HV: Handle passthrough interrupts in guest Paul Mackerras
2016-08-19  5:35   ` Paul Mackerras
2016-09-12  0:53   ` [PATCH v2 " Paul Mackerras
2016-09-12  0:53     ` Paul Mackerras
2016-08-19  5:35 ` [PATCH 08/13] KVM: PPC: Book3S HV: Complete passthrough interrupt in host Paul Mackerras
2016-08-19  5:35   ` Paul Mackerras
2016-08-19  5:35 ` [PATCH 09/13] KVM: PPC: Book3S HV: Dump irqmap in debugfs Paul Mackerras
2016-08-19  5:35   ` Paul Mackerras
2016-08-19  5:35 ` [PATCH 10/13] KVM: PPC: Book3S HV: Tunable to disable KVM IRQ bypass Paul Mackerras
2016-08-19  5:35   ` Paul Mackerras
2016-08-19  5:35 ` [PATCH 11/13] KVM: PPC: Book3S HV: Update irq stats for IRQs handled in real mode Paul Mackerras
2016-08-19  5:35   ` Paul Mackerras
2016-08-19  5:35 ` [PATCH 12/13] KVM: PPC: Book3S HV: Set server for passed-through interrupts Paul Mackerras
2016-08-19  5:35   ` Paul Mackerras
2016-08-19  5:35 ` Paul Mackerras [this message]
2016-08-19  5:35   ` [PATCH 13/13] KVM: PPC: Book3S HV: Counters for passthrough IRQ stats Paul Mackerras
2016-09-12  0:55 ` [PATCH 00/13] Real-mode acceleration of device interrupts in HV KVM Paul Mackerras
2016-09-12  0:55   ` Paul Mackerras

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1471584957-21484-14-git-send-email-paulus@ozlabs.org \
    --to=paulus@ozlabs.org \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.