ia64/xen-unstable

changeset 656:fb6f05624b37

bitkeeper revision 1.371 (3f1c0123prSxle5gTZG2N22fARNHXA)

time.c:
Tabbing fixes.
author kaf24@scramble.cl.cam.ac.uk
date Mon Jul 21 15:05:07 2003 +0000 (2003-07-21)
parents 3c7d3bff01da
children c82a216f0773
files xenolinux-2.4.21-sparse/arch/xeno/kernel/time.c
line diff
     1.1 --- a/xenolinux-2.4.21-sparse/arch/xeno/kernel/time.c	Mon Jul 21 14:09:51 2003 +0000
     1.2 +++ b/xenolinux-2.4.21-sparse/arch/xeno/kernel/time.c	Mon Jul 21 15:05:07 2003 +0000
     1.3 @@ -96,15 +96,15 @@ static inline s64 __get_s_time(void)
     1.4  {
     1.5      s32 delta_tsc;
     1.6      u32 low;
     1.7 -	u64 delta, tsc;
     1.8 +    u64 delta, tsc;
     1.9  
    1.10      rdtscll(tsc);
    1.11      low = (u32)(tsc >> rdtsc_bitshift);
    1.12      delta_tsc = (s32)(low - shadow_st_pcc);
    1.13      if ( unlikely(delta_tsc < 0) ) delta_tsc = 0;
    1.14 -	delta = ((u64)delta_tsc * st_scale_f);
    1.15 -	delta >>= 32;
    1.16 -	delta += ((u64)delta_tsc * st_scale_i);
    1.17 +    delta = ((u64)delta_tsc * st_scale_f);
    1.18 +    delta >>= 32;
    1.19 +    delta += ((u64)delta_tsc * st_scale_i);
    1.20  
    1.21      return shadow_st + delta;
    1.22  }
    1.23 @@ -121,24 +121,24 @@ static long       shadow_tv_usec;
    1.24  static long long  shadow_wc_timestamp;
    1.25  void do_gettimeofday(struct timeval *tv)
    1.26  {
    1.27 -	unsigned long flags;
    1.28 +    unsigned long flags;
    1.29      long          usec, sec;
    1.30 -	u32	          version;
    1.31 -	u64           now, cpu_freq, scale;
    1.32 +    u32	          version;
    1.33 +    u64           now, cpu_freq, scale;
    1.34  
    1.35 -	spin_lock_irqsave(&hyp_time_lock, flags);
    1.36 +    spin_lock_irqsave(&hyp_time_lock, flags);
    1.37  
    1.38 -	while ( (version = HYPERVISOR_shared_info->wc_version) != 
    1.39 +    while ( (version = HYPERVISOR_shared_info->wc_version) != 
    1.40              shadow_wc_version )
    1.41 -	{
    1.42 -		barrier();
    1.43 +    {
    1.44 +        barrier();
    1.45  
    1.46 -		shadow_wc_version   = version;
    1.47 -		shadow_tv_sec       = HYPERVISOR_shared_info->tv_sec;
    1.48 -		shadow_tv_usec      = HYPERVISOR_shared_info->tv_usec;
    1.49 -		shadow_wc_timestamp = HYPERVISOR_shared_info->wc_timestamp;
    1.50 -		shadow_st_pcc       = HYPERVISOR_shared_info->st_timestamp;
    1.51 -		shadow_st           = HYPERVISOR_shared_info->system_time;
    1.52 +        shadow_wc_version   = version;
    1.53 +        shadow_tv_sec       = HYPERVISOR_shared_info->tv_sec;
    1.54 +        shadow_tv_usec      = HYPERVISOR_shared_info->tv_usec;
    1.55 +        shadow_wc_timestamp = HYPERVISOR_shared_info->wc_timestamp;
    1.56 +        shadow_st_pcc       = HYPERVISOR_shared_info->st_timestamp;
    1.57 +        shadow_st           = HYPERVISOR_shared_info->system_time;
    1.58  
    1.59          rdtsc_bitshift      = HYPERVISOR_shared_info->rdtsc_bitshift;
    1.60          cpu_freq            = HYPERVISOR_shared_info->cpu_freq;
    1.61 @@ -149,13 +149,13 @@ void do_gettimeofday(struct timeval *tv)
    1.62          st_scale_f = scale & 0xffffffff;
    1.63          st_scale_i = scale >> 32;
    1.64  
    1.65 -		barrier();
    1.66 +        barrier();
    1.67  	}
    1.68  
    1.69 -	now   = __get_s_time();
    1.70 -	usec  = ((unsigned long)(now-shadow_wc_timestamp))/1000;
    1.71 -	sec   = shadow_tv_sec;
    1.72 -	usec += shadow_tv_usec;
    1.73 +    now   = __get_s_time();
    1.74 +    usec  = ((unsigned long)(now-shadow_wc_timestamp))/1000;
    1.75 +    sec   = shadow_tv_sec;
    1.76 +    usec += shadow_tv_usec;
    1.77  
    1.78      while ( usec >= 1000000 ) 
    1.79      {
    1.80 @@ -166,33 +166,32 @@ void do_gettimeofday(struct timeval *tv)
    1.81      tv->tv_sec = sec;
    1.82      tv->tv_usec = usec;
    1.83  
    1.84 -	spin_unlock_irqrestore(&hyp_time_lock, flags);
    1.85 +    spin_unlock_irqrestore(&hyp_time_lock, flags);
    1.86  
    1.87  #ifdef XENO_TIME_DEBUG
    1.88 -	{
    1.89 -		static long long old_now=0;
    1.90 -		static long long wct=0, old_wct=0;
    1.91 +    {
    1.92 +        static long long old_now=0;
    1.93 +        static long long wct=0, old_wct=0;
    1.94  
    1.95 -		/* This debug code checks if time increase over two subsequent calls */
    1.96 -		wct=(((long long)sec) * 1000000) + usec;
    1.97 -		/* wall clock time going backwards */
    1.98 -		if ((wct < old_wct) ) {	
    1.99 -			printk("Urgh1: wc diff=%6ld, usec = %ld (0x%lX)\n",
   1.100 -				   (long)(wct-old_wct), usec, usec);		
   1.101 -			printk("       st diff=%lld cur st=0x%016llX old st=0x%016llX\n",
   1.102 -				   now-old_now, now, old_now);
   1.103 -		}
   1.104 +        /* This debug code checks if time increase over two subsequent calls */
   1.105 +        wct=(((long long)sec) * 1000000) + usec;
   1.106 +        /* wall clock time going backwards */
   1.107 +        if ((wct < old_wct) ) {	
   1.108 +            printk("Urgh1: wc diff=%6ld, usec = %ld (0x%lX)\n",
   1.109 +                   (long)(wct-old_wct), usec, usec);		
   1.110 +            printk("       st diff=%lld cur st=0x%016llX old st=0x%016llX\n",
   1.111 +                   now-old_now, now, old_now);
   1.112 +        }
   1.113  
   1.114 -		/* system time going backwards */
   1.115 -		if (now<=old_now) {
   1.116 -			printk("Urgh2: st diff=%lld cur st=0x%016llX old st=0x%016llX\n",
   1.117 -				   now-old_now, now, old_now);
   1.118 -		}
   1.119 -		old_wct  = wct;
   1.120 -		old_now  = now;
   1.121 -	}
   1.122 +        /* system time going backwards */
   1.123 +        if (now<=old_now) {
   1.124 +            printk("Urgh2: st diff=%lld cur st=0x%016llX old st=0x%016llX\n",
   1.125 +                   now-old_now, now, old_now);
   1.126 +        }
   1.127 +        old_wct  = wct;
   1.128 +        old_now  = now;
   1.129 +    }
   1.130  #endif
   1.131 -
   1.132  }
   1.133  
   1.134  void do_settimeofday(struct timeval *tv)
   1.135 @@ -236,11 +235,11 @@ void do_settimeofday(struct timeval *tv)
   1.136  static long long us_per_tick=1000000/HZ;
   1.137  static long long last_irq;
   1.138  static inline void do_timer_interrupt(int irq, void *dev_id,
   1.139 -									  struct pt_regs *regs)
   1.140 +                                      struct pt_regs *regs)
   1.141  {
   1.142 -	struct timeval tv;
   1.143 -	long long time, delta;
   1.144 -	
   1.145 +    struct timeval tv;
   1.146 +    long long time, delta;
   1.147 +
   1.148      /*
   1.149       * The next bit really sucks:
   1.150       * Linux not only uses do_gettimeofday() to keep a notion of
   1.151 @@ -255,19 +254,19 @@ static inline void do_timer_interrupt(in
   1.152       * updates xtime accordingly. Yuck!
   1.153       */
   1.154  
   1.155 -	/* Work out the number of jiffy intervals passed and update them. */
   1.156 -	do_gettimeofday(&tv);
   1.157 -	time = (((long long)tv.tv_sec) * 1000000) + tv.tv_usec;
   1.158 -	delta = time - last_irq;
   1.159 -	if (delta <= 0) {
   1.160 -		printk ("Timer ISR: Time went backwards: %lld\n", delta);
   1.161 -		return;
   1.162 -	}
   1.163 -	while (delta >= us_per_tick) {
   1.164 -		do_timer(regs);
   1.165 -		delta    -= us_per_tick;
   1.166 -		last_irq += us_per_tick;
   1.167 -	}
   1.168 +    /* Work out the number of jiffy intervals passed and update them. */
   1.169 +    do_gettimeofday(&tv);
   1.170 +    time = (((long long)tv.tv_sec) * 1000000) + tv.tv_usec;
   1.171 +    delta = time - last_irq;
   1.172 +    if (delta <= 0) {
   1.173 +        printk ("Timer ISR: Time went backwards: %lld\n", delta);
   1.174 +        return;
   1.175 +    }
   1.176 +    while (delta >= us_per_tick) {
   1.177 +        do_timer(regs);
   1.178 +        delta    -= us_per_tick;
   1.179 +        last_irq += us_per_tick;
   1.180 +    }
   1.181  
   1.182  #if 0
   1.183      if (!user_mode(regs))
   1.184 @@ -299,20 +298,19 @@ void __init time_init(void)
   1.185      __cpu_khz = HYPERVISOR_shared_info->cpu_freq;
   1.186      do_div(__cpu_khz, 1000);
   1.187      cpu_khz = (u32)__cpu_khz;
   1.188 -	printk("Xen reported: %lu.%03lu MHz processor.\n", 
   1.189 -		   cpu_khz / 1000, cpu_khz % 1000);
   1.190 +    printk("Xen reported: %lu.%03lu MHz processor.\n", 
   1.191 +           cpu_khz / 1000, cpu_khz % 1000);
   1.192  
   1.193 -	do_gettimeofday(&xtime);
   1.194 -	last_irq = (((long long)xtime.tv_sec) * 1000000) + xtime.tv_usec;
   1.195 +    do_gettimeofday(&xtime);
   1.196 +    last_irq = (((long long)xtime.tv_sec) * 1000000) + xtime.tv_usec;
   1.197  
   1.198      setup_irq(TIMER_IRQ, &irq_timer);
   1.199  
   1.200      /*
   1.201 -     * Start ticker. Note that timing runs of wall clock, not virtual
   1.202 -     * 'domain' time. This means that clock sshould run at the correct
   1.203 -     * rate. For things like scheduling, it's not clear whether it
   1.204 -     * matters which sort of time we use.
   1.205 -	 * XXX RN: unimplemented.
   1.206 +     * Start ticker. Note that timing runs of wall clock, not virtual 'domain' 
   1.207 +     * time. This means that clock sshould run at the correct rate. For things 
   1.208 +     * like scheduling, it's not clear whether it matters which sort of time 
   1.209 +     * we use. XXX RN: unimplemented.
   1.210       */
   1.211  
   1.212      rdtscll(alarm);