ia64/xen-unstable

changeset 2125:513263463666

bitkeeper revision 1.1159.1.14 (4117467elQav6yf21P_6arzR_7_87A)

Adjust timeofday for tick interrupts that we haven't taken yet.
author kaf24@scramble.cl.cam.ac.uk
date Mon Aug 09 09:40:14 2004 +0000 (2004-08-09)
parents c43fdad0eca0
children cea3cbf1c374 452bfe2b4c6d
files linux-2.6.7-xen-sparse/arch/xen/i386/kernel/time.c
line diff
     1.1 --- a/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/time.c	Mon Aug 09 09:19:31 2004 +0000
     1.2 +++ b/linux-2.6.7-xen-sparse/arch/xen/i386/kernel/time.c	Mon Aug 09 09:40:14 2004 +0000
     1.3 @@ -174,6 +174,7 @@ void do_gettimeofday(struct timeval *tv)
     1.4  	unsigned long seq;
     1.5  	unsigned long usec, sec;
     1.6  	unsigned long max_ntp_tick;
     1.7 +	unsigned long flags;
     1.8  
     1.9  	do {
    1.10  		unsigned long lost;
    1.11 @@ -198,6 +199,9 @@ void do_gettimeofday(struct timeval *tv)
    1.12  		else if (unlikely(lost))
    1.13  			usec += lost * (USEC_PER_SEC / HZ);
    1.14  
    1.15 +		usec += (unsigned long)((shadow_system_time -
    1.16 +			processed_system_time) / NSEC_PER_USEC);
    1.17 +
    1.18  		sec = xtime.tv_sec;
    1.19  		usec += (xtime.tv_nsec / NSEC_PER_USEC);
    1.20  
    1.21 @@ -209,9 +213,9 @@ void do_gettimeofday(struct timeval *tv)
    1.22  			 * overflowed). Detect that and recalculate
    1.23  			 * with fresh values.
    1.24  			 */
    1.25 -			write_seqlock_irq(&xtime_lock);
    1.26 +			write_seqlock_irqsave(&xtime_lock, flags);
    1.27  			__get_time_values_from_xen();
    1.28 -			write_sequnlock_irq(&xtime_lock);
    1.29 +			write_sequnlock_irqrestore(&xtime_lock, flags);
    1.30  			continue;
    1.31  		}
    1.32  	} while (read_seqretry(&xtime_lock, seq));
    1.33 @@ -273,6 +277,8 @@ int do_settimeofday(struct timespec *tv)
    1.34  	 */
    1.35  	nsec -= (jiffies - wall_jiffies) * TICK_NSEC;
    1.36  
    1.37 +	nsec -= (unsigned long)(shadow_system_time - processed_system_time);
    1.38 +
    1.39  	wtm_sec  = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
    1.40  	wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);
    1.41