ia64/xen-unstable

changeset 2430:d1f4d611f5ae

bitkeeper revision 1.1159.69.12 (413a4a15Z23E3TdWcslHMKLH4O-Gww)

Fix timestamp-scaling calculations in Linux 2.4.
Time now progresses at the correct rate!
author kaf24@scramble.cl.cam.ac.uk
date Sat Sep 04 23:04:53 2004 +0000 (2004-09-04)
parents 6b7809060d4a
children a6c74b209bdd
files linux-2.4.27-xen-sparse/arch/xen/kernel/time.c
line diff
     1.1 --- a/linux-2.4.27-xen-sparse/arch/xen/kernel/time.c	Sat Sep 04 21:37:22 2004 +0000
     1.2 +++ b/linux-2.4.27-xen-sparse/arch/xen/kernel/time.c	Sat Sep 04 23:04:53 2004 +0000
     1.3 @@ -604,12 +604,15 @@ static struct irqaction dbg_time = {
     1.4  void __init time_init(void)
     1.5  {
     1.6      unsigned long long alarm;
     1.7 -    u64 __cpu_khz, cpu_freq, scale, scale2;
     1.8 +    u64 __cpu_khz, __cpu_ghz, cpu_freq, scale, scale2;
     1.9      unsigned int cpu_ghz;
    1.10  
    1.11 -    __cpu_khz = HYPERVISOR_shared_info->cpu_freq;
    1.12 -    do_div(__cpu_khz, 1000);
    1.13 +    __cpu_khz = __cpu_ghz = cpu_freq = HYPERVISOR_shared_info->cpu_freq;
    1.14 +    do_div(__cpu_khz, 1000UL);
    1.15      cpu_khz = (u32)__cpu_khz;
    1.16 +    do_div(__cpu_ghz, 1000000000UL);
    1.17 +    cpu_ghz = (unsigned int)__cpu_ghz;
    1.18 +
    1.19      printk("Xen reported: %lu.%03lu MHz processor.\n", 
    1.20             cpu_khz / 1000, cpu_khz % 1000);
    1.21  
    1.22 @@ -617,9 +620,6 @@ void __init time_init(void)
    1.23      xtime.tv_usec = HYPERVISOR_shared_info->wc_usec;
    1.24      processed_system_time = shadow_system_time;
    1.25  
    1.26 -    cpu_freq = HYPERVISOR_shared_info->cpu_freq;
    1.27 -
    1.28 -    cpu_ghz = do_div(cpu_freq, 1000000000UL);
    1.29      for ( rdtsc_bitshift = 0; cpu_ghz != 0; rdtsc_bitshift++, cpu_ghz >>= 1 )
    1.30          continue;
    1.31