[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [linux-2.6.18-xen] x86, xen: get_time_values_from_Xen() is not IRQ-safe.



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1218195837 -3600
# Node ID 2807d531d025ae0c57d73e2ed60c13cd4bb4e21b
# Parent  ff6ba016eed24c997b0dbe4bc0552864cb3a590a
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@xxxxxxxxxx>
---
 arch/i386/kernel/time-xen.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff -r ff6ba016eed2 -r 2807d531d025 arch/i386/kernel/time-xen.c
--- a/arch/i386/kernel/time-xen.c       Fri Aug 08 10:57:41 2008 +0100
+++ b/arch/i386/kernel/time-xen.c       Fri Aug 08 12:43:57 2008 +0100
@@ -314,21 +314,28 @@ static void get_time_values_from_xen(uns
 {
        struct vcpu_time_info   *src;
        struct shadow_time_info *dst;
+       unsigned long flags;
+       u32 pre_version, post_version;
 
        src = &vcpu_info(cpu)->time;
        dst = &per_cpu(shadow_time, cpu);
 
+       local_irq_save(flags);
+
        do {
-               dst->version = src->version;
+               pre_version = dst->version = src->version;
                rmb();
                dst->tsc_timestamp     = src->tsc_timestamp;
                dst->system_timestamp  = src->system_time;
                dst->tsc_to_nsec_mul   = src->tsc_to_system_mul;
                dst->tsc_shift         = src->tsc_shift;
                rmb();
-       } while ((src->version & 1) | (dst->version ^ src->version));
+               post_version = src->version;
+       } while ((pre_version & 1) | (pre_version ^ post_version));
 
        dst->tsc_to_usec_mul = dst->tsc_to_nsec_mul / 1000;
+
+       local_irq_restore(flags);
 }
 
 static inline int time_values_up_to_date(unsigned int cpu)

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.