From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: Centrino Duo not working so hot Date: Tue, 12 Jun 2007 09:42:11 +0300 Message-ID: <466E4043.9070903@qumranet.com> References: <9c21eeae0706080923y4a049ff7v4176aa0041e772f1@mail.gmail.com> <466BAF7D.1080700@qumranet.com> <9c21eeae0706111737r4103dbd8x10e9e340f7e686fd@mail.gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------080602000001010709030300" Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org To: David Brown Return-path: In-Reply-To: <9c21eeae0706111737r4103dbd8x10e9e340f7e686fd-JsoAwUIsXosN+BqQ9rBEUg@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. --------------080602000001010709030300 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit David Brown wrote: >> Does the problem occur with 'taskset 1 qemu ...'? This pins the guest >> on one core. > > Sorry for the late response but yes that seems to be working fine now. > >> The core-not-2's main problem is that I don't test regularly with it. >> It is slightly strange (no 64-bit support, hence some important msrs are >> missing) so it has triggered a lot of kvm bugs. > > Ah okay good thing I have one and can test things then ;) > Please check the attached patch (without taskset). The patch attempts to keep the time stamp counter monotonic, even if the guest migrates from core to core. -- Do not meddle in the internals of kernels, for they are subtle and quick to panic. --------------080602000001010709030300 Content-Type: text/x-patch; name="vmx-tsc-sync.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="vmx-tsc-sync.patch" diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c index b909b54..6beb0f1 100644 --- a/drivers/kvm/vmx.c +++ b/drivers/kvm/vmx.c @@ -160,6 +160,7 @@ static void __vcpu_clear(void *arg) vmcs_clear(vcpu->vmcs); if (per_cpu(current_vmcs, cpu) == vcpu->vmcs) per_cpu(current_vmcs, cpu) = NULL; + rdtscll(vcpu->host_tsc); } static void vcpu_clear(struct kvm_vcpu *vcpu) @@ -376,11 +377,16 @@ static void vmx_vcpu_load(struct kvm_vcpu *vcpu) { u64 phys_addr = __pa(vcpu->vmcs); int cpu; + u64 tsc_this, delta; cpu = get_cpu(); - if (vcpu->cpu != cpu) + if (vcpu->cpu != cpu) { vcpu_clear(vcpu); + rdtscll(tsc_this); + delta = vcpu->host_tsc - tsc_this; + vmcs_write64(TSC_OFFSET, vmcs_read64(TSC_OFFSET) + delta); + } if (per_cpu(current_vmcs, cpu) != vcpu->vmcs) { u8 error; --------------080602000001010709030300 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------- 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/ --------------080602000001010709030300 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 --------------080602000001010709030300--