ia64/xen-unstable

changeset 2022:bfb45374e4b3

bitkeeper revision 1.1108.48.1 (410e1948_L7KCN9h17cq5QeBniYH6g)

use the tsc to interpolate time values when the time structure in shared_info
isn't quite uptodate
author cl349@freefall.cl.cam.ac.uk
date Mon Aug 02 10:36:56 2004 +0000 (2004-08-02)
parents 4fc62e2234f4
children 7500d808bee1
files linux-2.4.26-xen-sparse/arch/xen/kernel/time.c linux-2.6.7-xen-sparse/arch/xen/i386/kernel/time.c linux-2.6.7-xen-sparse/arch/xen/i386/kernel/timers/timer_tsc.c
line diff
     1.1 --- a/linux-2.4.26-xen-sparse/arch/xen/kernel/time.c	Sun Aug 01 15:21:46 2004 +0000
     1.2 +++ b/linux-2.4.26-xen-sparse/arch/xen/kernel/time.c	Mon Aug 02 10:36:56 2004 +0000
     1.3 @@ -391,7 +391,8 @@ static inline void do_timer_interrupt(in
     1.4  
     1.5      __get_time_values_from_xen();
     1.6  
     1.7 -    if ( (delta = (s64)(shadow_system_time - processed_system_time)) < 0 )
     1.8 +    if ( (delta = (s64)(shadow_system_time + __get_time_delta_usecs() * 1000 -
     1.9 +						processed_system_time)) < 0 )
    1.10      {
    1.11          printk("Timer ISR: Time went backwards: %lld\n", delta);
    1.12          return;
     2.1 --- a/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/time.c	Sun Aug 01 15:21:46 2004 +0000
     2.2 +++ b/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/time.c	Mon Aug 02 10:36:56 2004 +0000
     2.3 @@ -88,6 +88,7 @@ EXPORT_SYMBOL(i8253_lock);
     2.4  struct timer_opts *cur_timer = &timer_none;
     2.5  
     2.6  extern u64 shadow_system_time;
     2.7 +extern u32 shadow_time_delta_usecs;
     2.8  extern void __get_time_values_from_xen(void);
     2.9  
    2.10  /* Keep track of last time we did processing/updating of jiffies and xtime. */
    2.11 @@ -300,7 +301,9 @@ irqreturn_t timer_interrupt(int irq, voi
    2.12  
    2.13  	__get_time_values_from_xen();
    2.14  
    2.15 -	delta = (s64)(shadow_system_time - processed_system_time);
    2.16 +	shadow_time_delta_usecs = cur_timer->get_offset() * NSEC_PER_USEC;
    2.17 +	delta = (s64)(shadow_system_time + shadow_time_delta_usecs -
    2.18 +		      processed_system_time);
    2.19  	if (delta < 0) {
    2.20  		printk("Timer ISR: Time went backwards: %lld\n", delta);
    2.21  		goto out;
     3.1 --- a/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/timers/timer_tsc.c	Sun Aug 01 15:21:46 2004 +0000
     3.2 +++ b/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/timers/timer_tsc.c	Mon Aug 02 10:36:56 2004 +0000
     3.3 @@ -85,6 +85,7 @@ static u32 shadow_tsc_stamp;
     3.4  u64 shadow_system_time;
     3.5  static u32 shadow_time_version;
     3.6  static struct timeval shadow_tv;
     3.7 +u32 shadow_time_delta_usecs;
     3.8  static unsigned int rdtsc_bitshift;
     3.9  extern u64 processed_system_time;
    3.10  
    3.11 @@ -192,7 +193,8 @@ static void mark_offset_tsc(void)
    3.12  
    3.13  	write_seqlock(&monotonic_lock);
    3.14  
    3.15 -	delta = (s64)(shadow_system_time - processed_system_time);
    3.16 +	delta = (s64)(shadow_system_time + shadow_time_delta_usecs -
    3.17 +		      processed_system_time);
    3.18  
    3.19  	/* Process elapsed jiffies since last call. */
    3.20  	while (delta >= NS_PER_TICK) {