From mboxrd@z Thu Jan 1 00:00:00 1970 From: Leonard Norrgard Subject: [PATCH 2/3] Add a vcpu_migrated statistic Date: Fri, 02 Mar 2007 18:53:16 +0200 Message-ID: <45E8567C.6080704@refactor.fi> References: <45E853A0.3080207@refactor.fi> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------050807060407000309090202" To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Return-path: In-Reply-To: <45E853A0.3080207-g2GXA8XeJSExHbG02/KK1g@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org This is a multi-part message in MIME format. --------------050807060407000309090202 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable The previous patch introduces an IPI on every vcpu migration on SMP machines to find out the TSC value on the previous cpu. We might be able to avoid this IPI on systems that have a synchronized TSC by checking for it in svm/vmx_vcpu_load: + /* If this isn't the first vcpu_load and if the TSC + doesn't run at a constant rate, we must handle TSC + offsets. */ + if (vcpu->cpu !=3D -1 + && !boot_cpu_has(X86_FEATURE_CONSTANT_TSC)) { Wether this is actually reliable and working in the intended way is not know yet. In the meantime, introduce a statistic for vcpu migration, so we get some decision support for the needs for such an optimization. Signed-off-by: Leonard Norrg=C3=A5rd --------------050807060407000309090202 Content-Type: text/x-diff; name="02_add_vcpu_migrated_statistic.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="02_add_vcpu_migrated_statistic.patch" Index: linux-2.6/drivers/kvm/kvm_main.c =================================================================== --- linux-2.6.orig/drivers/kvm/kvm_main.c 2007-03-02 17:31:59.000000000 +0200 +++ linux-2.6/drivers/kvm/kvm_main.c 2007-03-02 17:34:13.000000000 +0200 @@ -67,6 +67,7 @@ { "halt_exits", &kvm_stat.halt_exits }, { "request_irq", &kvm_stat.request_irq_exits }, { "irq_exits", &kvm_stat.irq_exits }, + { "vcpu_migrated", &kvm_stat.vcpu_migrated }, { NULL, NULL } }; Index: linux-2.6/drivers/kvm/svm.c =================================================================== --- linux-2.6.orig/drivers/kvm/svm.c 2007-03-02 17:32:02.000000000 +0200 +++ linux-2.6/drivers/kvm/svm.c 2007-03-02 17:33:13.000000000 +0200 @@ -621,6 +621,8 @@ if (vcpu->cpu != -1) { u64 tsc_this, tsc_previous; + ++kvm_stat.vcpu_migrated; + /* Get TSC value for this and the previous cpu. */ rdtscll(tsc_this); smp_call_function_single(vcpu->cpu, ipi_rdtscll, Index: linux-2.6/drivers/kvm/vmx.c =================================================================== --- linux-2.6.orig/drivers/kvm/vmx.c 2007-03-02 17:32:06.000000000 +0200 +++ linux-2.6/drivers/kvm/vmx.c 2007-03-02 17:33:34.000000000 +0200 @@ -242,6 +242,8 @@ if (vcpu->cpu != -1) { u64 tsc_this, tsc_previous, guest_tsc_offset; + ++kvm_stat.vcpu_migrated; + /* Get TSC value for this and the previous cpu. */ rdtscll(tsc_this); smp_call_function_single(vcpu->cpu, ipi_rdtscll, --------------050807060407000309090202 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV --------------050807060407000309090202 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ kvm-devel mailing list kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org https://lists.sourceforge.net/lists/listinfo/kvm-devel --------------050807060407000309090202--