On 09/30/2010 01:07 PM, Michael Tokarev wrote:
01.10.2010 03:02, Michael Tokarev wrote:
30.09.2010 23:05, Marcelo Tosatti wrote:
[]
Arjan, Michael, can you try the following:

 From 3823c018162dc708b543cbdc680a4c7d63533fee Mon Sep 17 00:00:00 2001
From: Zachary Amsden<[email protected]>
Date: Sat, 29 May 2010 17:52:46 -1000
Subject: [KVM V2 04/25] Fix SVM VMCB reset
Cc: Avi Kivity<[email protected]>,
     Marcelo Tosatti<[email protected]>,
     Glauber Costa<[email protected]>,
     [email protected]

On reset, VMCB TSC should be set to zero.  Instead, code was setting
tsc_offset to zero, which passes through the underlying TSC.

Signed-off-by: Zachary Amsden<[email protected]>
---
  arch/x86/kvm/svm.c |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 760c86e..46856d2 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -781,7 +781,7 @@ static void init_vmcb(struct vcpu_svm *svm)

        control->iopm_base_pa = iopm_base;
        control->msrpm_base_pa = __pa(svm->msrpm);
-       control->tsc_offset = 0;
+       guest_write_tsc(&svm->vcpu, 0);
        control->int_ctl = V_INTR_MASKING_MASK;
This fails to compile on 2.6.35.5:

arch/x86/kvm/svm.c: In function ‘init_vmcb’:
arch/x86/kvm/svm.c:769: error: implicit declaration of function 
‘guest_write_tsc’

I'll take a look tomorrow where that comes from.. hopefully ;)
Ok, that routine is static, defined in arch/x86/kvm/vmx.c
(not svm.c).  I'm not sure it's ok to use it in svm.c
directly, as it appears to be vmx-specific.

Thanks!

/mjt


Can you try this patch to see if it helps? I believe it is also safe for Xen, but cc'ing to double check.
Try to fix setup_percpu_clockdev by moving it before interrupts
are enabled.

Signed-off-by: Zachary Amsden <[email protected]>

diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 8b3bfc4..40a383b 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -351,6 +351,8 @@ notrace static void __cpuinit start_secondary(void *unused)
        unlock_vector_lock();
        ipi_call_unlock();
        per_cpu(cpu_state, smp_processor_id()) = CPU_ONLINE;
+       x86_cpuinit.setup_percpu_clockev();
+
        x86_platform.nmi_init();
 
        /* enable local interrupts */
@@ -359,8 +361,6 @@ notrace static void __cpuinit start_secondary(void *unused)
        /* to prevent fake stack check failure in clock setup */
        boot_init_stack_canary();
 
-       x86_cpuinit.setup_percpu_clockev();
-
        wmb();
        cpu_idle();
 }

Reply via email to