ia64/xen-unstable

changeset 18063:64b55f15a055

x86: Ensure TSC calibration stats are same across all CPUs when
running with clocksource=tsc.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Jul 15 17:57:00 2008 +0100 (2008-07-15)
parents 64d8a24d28f6
children b38bceff087a
files xen/arch/x86/time.c
line diff
     1.1 --- a/xen/arch/x86/time.c	Tue Jul 15 17:56:25 2008 +0100
     1.2 +++ b/xen/arch/x86/time.c	Tue Jul 15 17:57:00 2008 +0100
     1.3 @@ -496,11 +496,27 @@ static u64 read_tsc_count(void)
     1.4  
     1.5  static int init_tsctimer(struct platform_timesource *pts)
     1.6  {
     1.7 -    /* TODO: evaluate stability of TSC here, return 0 if not stable. */
     1.8 +    unsigned int cpu;
     1.9 +
    1.10 +    /*
    1.11 +     * TODO: evaluate stability of TSC here, return 0 if not stable.
    1.12 +     * For now we assume all TSCs are synchronised and hence can all share
    1.13 +     * CPU 0's calibration values.
    1.14 +     */
    1.15 +    for_each_cpu ( cpu )
    1.16 +    {
    1.17 +        if ( cpu == 0 )
    1.18 +            continue;
    1.19 +        memcpy(&per_cpu(cpu_time, cpu),
    1.20 +               &per_cpu(cpu_time, 0),
    1.21 +               sizeof(struct cpu_time));
    1.22 +    }
    1.23 +
    1.24      pts->name = "TSC";
    1.25      pts->frequency = tsc_freq;
    1.26      pts->read_counter = read_tsc_count;
    1.27      pts->counter_bits = 64;
    1.28 +
    1.29      return 1;
    1.30  }
    1.31  
    1.32 @@ -1130,11 +1146,12 @@ int time_suspend(void)
    1.33  
    1.34  int time_resume(void)
    1.35  {
    1.36 -    u64 tmp = init_pit_and_calibrate_tsc();
    1.37 +    /*u64 tmp = */init_pit_and_calibrate_tsc();
    1.38  
    1.39      disable_pit_irq();
    1.40  
    1.41 -    set_time_scale(&this_cpu(cpu_time).tsc_scale, tmp);
    1.42 +    /* Disable this while calibrate_tsc_ap() also is skipped. */
    1.43 +    /*set_time_scale(&this_cpu(cpu_time).tsc_scale, tmp);*/
    1.44  
    1.45      resume_platform_timer();
    1.46