From patchwork Thu Jul 5 21:50:37 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Theurer X-Patchwork-Id: 1162281 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 0EA8DDFB7C for ; Thu, 5 Jul 2012 21:51:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755708Ab2GEVvr (ORCPT ); Thu, 5 Jul 2012 17:51:47 -0400 Received: from e7.ny.us.ibm.com ([32.97.182.137]:42926 "EHLO e7.ny.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755539Ab2GEVvq (ORCPT ); Thu, 5 Jul 2012 17:51:46 -0400 Received: from /spool/local by e7.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 5 Jul 2012 17:51:45 -0400 Received: from d01dlp02.pok.ibm.com (9.56.224.85) by e7.ny.us.ibm.com (192.168.1.107) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 5 Jul 2012 17:50:42 -0400 Received: from d01relay06.pok.ibm.com (d01relay06.pok.ibm.com [9.56.227.116]) by d01dlp02.pok.ibm.com (Postfix) with ESMTP id ACF816E8051 for ; Thu, 5 Jul 2012 17:50:41 -0400 (EDT) Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by d01relay06.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q65Lofph9961920 for ; Thu, 5 Jul 2012 17:50:41 -0400 Received: from d01av02.pok.ibm.com (loopback [127.0.0.1]) by d01av02.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q65LodVd015085 for ; Thu, 5 Jul 2012 18:50:40 -0300 Received: from [9.41.149.58] (oc2024037011.ibm.com.austin.ibm.com [9.41.149.58]) by d01av02.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q65LobnV014957 for ; Thu, 5 Jul 2012 18:50:37 -0300 Subject: [PATCH] add PLE stats to kvmstat From: Andrew Theurer Reply-To: habanero@linux.vnet.ibm.com To: kvm@vger.kernel.org Date: Thu, 05 Jul 2012 16:50:37 -0500 Message-ID: <1341525037.12425.46.camel@oc2024037011.ibm.com> Mime-Version: 1.0 X-Mailer: Evolution 2.28.3 (2.28.3-24.el6) X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12070521-5806-0000-0000-00001703E94C Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org I, and I expect others, have a keen interest in knowing how often we exit for PLE, and also how often that includes a yielding to another vcpu. The following adds two more counters to kvmstat to track the exits and the vcpu yields. This in no way changes PLE behavior, just helps us track what's going on. -Andrew Theurer Signed-off-by: Andrew Theurer arch/x86/include/asm/kvm_host.h | 2 ++ arch/x86/kvm/svm.c | 1 + arch/x86/kvm/vmx.c | 1 + arch/x86/kvm/x86.c | 2 ++ virt/kvm/kvm_main.c | 1 + 5 files changed, 7 insertions(+), 0 deletions(-) --- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index 24b7647..aebba8a 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h @@ -593,6 +593,8 @@ struct kvm_vcpu_stat { u32 hypercalls; u32 irq_injections; u32 nmi_injections; + u32 pause_exits; + u32 vcpu_yield_to; }; struct x86_instruction_info; diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 7a41878..1c1b81e 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -3264,6 +3264,7 @@ static int interrupt_window_interception(struct vcpu_svm *svm) static int pause_interception(struct vcpu_svm *svm) { + ++svm->vcpu.stat.pause_exits; kvm_vcpu_on_spin(&(svm->vcpu)); return 1; } diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index eeeb4a2..1309578 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -5004,6 +5004,7 @@ out: */ static int handle_pause(struct kvm_vcpu *vcpu) { + ++vcpu->stat.pause_exits; skip_emulated_instruction(vcpu); kvm_vcpu_on_spin(vcpu); diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 8eacb2e..ad85403 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -143,6 +143,8 @@ struct kvm_stats_debugfs_item debugfs_entries[] = { { "insn_emulation_fail", VCPU_STAT(insn_emulation_fail) }, { "irq_injections", VCPU_STAT(irq_injections) }, { "nmi_injections", VCPU_STAT(nmi_injections) }, + { "pause_exits", VCPU_STAT(pause_exits) }, + { "vcpu_yield_to", VCPU_STAT(vcpu_yield_to) }, { "mmu_shadow_zapped", VM_STAT(mmu_shadow_zapped) }, { "mmu_pte_write", VM_STAT(mmu_pte_write) }, { "mmu_pte_updated", VM_STAT(mmu_pte_updated) }, diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 636bd08..d80b6cd 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -1610,6 +1610,7 @@ void kvm_vcpu_on_spin(struct kvm_vcpu *me) if (kvm_vcpu_yield_to(vcpu)) { kvm->last_boosted_vcpu = i; yielded = 1; + ++vcpu->stat.vcpu_yield_to; break; } }