Chris Wright wrote:
> * Anthony Liguori ([EMAIL PROTECTED]) wrote:
>   
>>  From a quick look, I suspect that the number of wildly off TSC 
>> calibrations correspond to the VMs that are misbehaving.  I think this 
>> may mean that we have to re-examine the tsc delta computation.
>>
>> 10_serial.log:time.c: Detected 1995.038 MHz processor.
>> 11_serial.log:time.c: Detected 2363.195 MHz processor.
>> 12_serial.log:time.c: Detected 2492.675 MHz processor.
>> 13_serial.log:time.c: Detected 1995.061 MHz processor.
>> 14_serial.log:time.c: Detected 1994.917 MHz processor.
>> 15_serial.log:time.c: Detected 4100.735 MHz processor.
>> 16_serial.log:time.c: Detected 2075.800 MHz processor.
>> 17_serial.log:time.c: Detected 2674.350 MHz processor.
>> 18_serial.log:time.c: Detected 1995.002 MHz processor.
>> 19_serial.log:time.c: Detected 1994.978 MHz processor.
>> 1_serial.log:time.c: Detected 4384.310 MHz processor.
>>     
>
> Is this with pinning?  We at least know we're losing small bits on
> migration.  From my measurements it's ~3000 (outliers are 10-20k).
>
> Also, what happens if you roll back to kvm-userspace 7f5c4d15ece5?
>
> I'm using this:
>
> diff -up arch/x86/kvm/svm.c~svm arch/x86/kvm/svm.c
> --- arch/x86/kvm/svm.c~svm    2008-04-16 19:49:44.000000000 -0700
> +++ arch/x86/kvm/svm.c        2008-05-14 23:44:18.000000000 -0700
> @@ -621,6 +621,13 @@ static void svm_free_vcpu(struct kvm_vcp
>       kmem_cache_free(kvm_vcpu_cache, svm);
>  }
>  
> +static void svm_tsc_update(void *arg)
> +{
> +     struct vcpu_svm *svm = arg;
> +     rdtscll(svm->vcpu.arch.host_tsc);
> +
> +}
> +
>  static void svm_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
>  {
>       struct vcpu_svm *svm = to_svm(vcpu);
> @@ -633,6 +640,9 @@ static void svm_vcpu_load(struct kvm_vcp
>                * Make sure that the guest sees a monotonically
>                * increasing TSC.
>                */
> +             if (vcpu->cpu != -1)
> +                     smp_call_function_single(vcpu->cpu, svm_tsc_update,
> +                                              svm, 0, 1);
>   

I like this approach because of its simplicity although the IPI is not 
wonderful.  I was also thinking of using cpu_clock() to take a timestamp 
on vcpu_put, then on vcpu_load, take another timestamp and use the 
cyc2ns conversion to try and estimate the elapsed tsc ticks on the new cpu.

Regards,

Anthony Liguori

>               rdtscll(tsc_this);
>               delta = vcpu->arch.host_tsc - tsc_this;
>               svm->vmcb->control.tsc_offset += delta;
>
>   


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel

Reply via email to