All of lore.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
To: David Brown <dmlb2000-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: Re: Centrino Duo not working so hot
Date: Tue, 12 Jun 2007 09:42:11 +0300	[thread overview]
Message-ID: <466E4043.9070903@qumranet.com> (raw)
In-Reply-To: <9c21eeae0706111737r4103dbd8x10e9e340f7e686fd-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 699 bytes --]

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.


[-- Attachment #2: vmx-tsc-sync.patch --]
[-- Type: text/x-patch, Size: 806 bytes --]

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;

[-- Attachment #3: Type: text/plain, Size: 286 bytes --]

-------------------------------------------------------------------------
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/

[-- Attachment #4: Type: text/plain, Size: 186 bytes --]

_______________________________________________
kvm-devel mailing list
kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/kvm-devel

  parent reply	other threads:[~2007-06-12  6:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-08 16:23 Centrino Duo not working so hot David Brown
     [not found] ` <9c21eeae0706080923y4a049ff7v4176aa0041e772f1-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2007-06-10  7:59   ` Avi Kivity
     [not found]     ` <466BAF7D.1080700-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-06-12  0:37       ` David Brown
     [not found]         ` <9c21eeae0706111737r4103dbd8x10e9e340f7e686fd-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2007-06-12  6:42           ` Avi Kivity [this message]
     [not found]             ` <466E4043.9070903-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-06-13  0:00               ` David Brown
     [not found]                 ` <9c21eeae0706121700x259f5709v68cac6ef021dc3b-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2007-06-13  0:03                   ` David Brown
     [not found]                     ` <9c21eeae0706121703t1ce33b07l93cf3b75610368c2-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2007-06-13  0:14                       ` David Brown
     [not found]                         ` <9c21eeae0706121714t12ca79a0lfbfa6445e94d015e-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2007-06-13  8:04                           ` Avi Kivity
     [not found]                             ` <466FA527.8090808-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-06-13 16:51                               ` David Brown

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=466E4043.9070903@qumranet.com \
    --to=avi-atkuwr5tajbwk0htik3j/w@public.gmane.org \
    --cc=dmlb2000-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.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.