ia64/linux-2.6.18-xen.hg

changeset 636:2807d531d025

x86, xen: get_time_values_from_Xen() is not IRQ-safe.
Also the loop header should act on local variables for safety.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Aug 08 12:43:57 2008 +0100 (2008-08-08)
parents ff6ba016eed2
children 59912a8aee53
files arch/i386/kernel/time-xen.c
line diff
     1.1 --- a/arch/i386/kernel/time-xen.c	Fri Aug 08 10:57:41 2008 +0100
     1.2 +++ b/arch/i386/kernel/time-xen.c	Fri Aug 08 12:43:57 2008 +0100
     1.3 @@ -314,21 +314,28 @@ static void get_time_values_from_xen(uns
     1.4  {
     1.5  	struct vcpu_time_info   *src;
     1.6  	struct shadow_time_info *dst;
     1.7 +	unsigned long flags;
     1.8 +	u32 pre_version, post_version;
     1.9  
    1.10  	src = &vcpu_info(cpu)->time;
    1.11  	dst = &per_cpu(shadow_time, cpu);
    1.12  
    1.13 +	local_irq_save(flags);
    1.14 +
    1.15  	do {
    1.16 -		dst->version = src->version;
    1.17 +		pre_version = dst->version = src->version;
    1.18  		rmb();
    1.19  		dst->tsc_timestamp     = src->tsc_timestamp;
    1.20  		dst->system_timestamp  = src->system_time;
    1.21  		dst->tsc_to_nsec_mul   = src->tsc_to_system_mul;
    1.22  		dst->tsc_shift         = src->tsc_shift;
    1.23  		rmb();
    1.24 -	} while ((src->version & 1) | (dst->version ^ src->version));
    1.25 +		post_version = src->version;
    1.26 +	} while ((pre_version & 1) | (pre_version ^ post_version));
    1.27  
    1.28  	dst->tsc_to_usec_mul = dst->tsc_to_nsec_mul / 1000;
    1.29 +
    1.30 +	local_irq_restore(flags);
    1.31  }
    1.32  
    1.33  static inline int time_values_up_to_date(unsigned int cpu)