ia64/xen-unstable

changeset 2585:9d1a7223d45e

bitkeeper revision 1.1159.1.198 (415d8662Q0wZZexKh1EdIwW80jQLLg)

Rearrange time init so that xtime and processed_system_time don't start
out of sync. Update wall_to_monotonic when we update time from xen.
author cl349@freefall.cl.cam.ac.uk
date Fri Oct 01 16:31:30 2004 +0000 (2004-10-01)
parents f64b48547d69
children 1e99cd1cb3a3
files linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/time.c
line diff
     1.1 --- a/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/time.c	Fri Oct 01 15:00:37 2004 +0000
     1.2 +++ b/linux-2.6.8.1-xen-sparse/arch/xen/i386/kernel/time.c	Fri Oct 01 16:31:30 2004 +0000
     1.3 @@ -363,8 +363,10 @@ EXPORT_SYMBOL(monotonic_clock);
     1.4  static inline void do_timer_interrupt(int irq, void *dev_id,
     1.5  					struct pt_regs *regs)
     1.6  {
     1.7 -	s64 delta;
     1.8 -	long sec_diff;
     1.9 +	time_t wtm_sec, sec;
    1.10 +	s64 delta. nsec;
    1.11 +	long sec_diff, wtm_nsec;
    1.12 +	long wtm_nsec;
    1.13  
    1.14  	__get_time_values_from_xen();
    1.15  
    1.16 @@ -412,10 +414,17 @@ static inline void do_timer_interrupt(in
    1.17  		}
    1.18  
    1.19  		/* Update our unsynchronised xtime appropriately. */
    1.20 -		xtime.tv_sec  = shadow_tv.tv_sec;
    1.21 -		xtime.tv_nsec = shadow_tv.tv_usec * NSEC_PER_USEC;
    1.22 +		sec = shadow_tv.tv_sec;
    1.23 +		nsec = shadow_tv.tv_usec * NSEC_PER_USEC;
    1.24  
    1.25 -		last_update_from_xen = xtime.tv_sec;
    1.26 +		__normalize_time(&sec, &nsec);
    1.27 +		wtm_sec  = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
    1.28 +		wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);
    1.29 +
    1.30 +		set_normalized_timespec(&xtime, sec, nsec);
    1.31 +		set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec);
    1.32 +
    1.33 +		last_update_from_xen = sec;
    1.34  	}
    1.35  
    1.36  #ifdef CONFIG_XEN_PRIVILEGED_GUEST
    1.37 @@ -590,17 +599,16 @@ void __init time_init(void)
    1.38  		return;
    1.39  	}
    1.40  #endif
    1.41 -	xtime.tv_sec = HYPERVISOR_shared_info->wc_sec;
    1.42 +	__get_time_values_from_xen();
    1.43 +	xtime.tv_sec = shadow_tv.tv_sec;
    1.44  	wall_to_monotonic.tv_sec = -xtime.tv_sec;
    1.45 -	xtime.tv_nsec = HYPERVISOR_shared_info->wc_usec * NSEC_PER_USEC;
    1.46 +	xtime.tv_nsec = shadow_tv.tv_usec * NSEC_PER_USEC;
    1.47  	wall_to_monotonic.tv_nsec = -xtime.tv_nsec;
    1.48 +	processed_system_time = shadow_system_time;
    1.49  
    1.50  	cur_timer = select_timer();
    1.51  	printk(KERN_INFO "Using %s for high-res timesource\n",cur_timer->name);
    1.52  
    1.53 -	__get_time_values_from_xen();
    1.54 -	processed_system_time = shadow_system_time;
    1.55 -
    1.56  	time_irq = bind_virq_to_irq(VIRQ_TIMER);
    1.57  
    1.58  	(void)setup_irq(time_irq, &irq_timer);