]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
x86/pvclock: Zero last_value on resume
authorJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Mon, 25 Oct 2010 23:53:46 +0000 (16:53 -0700)
committerAK <andi@firstfloor.org>
Thu, 31 Mar 2011 18:58:04 +0000 (11:58 -0700)
commit e7a3481c0246c8e45e79c629efd63b168e91fcda upstream.

If the guest domain has been suspend/resumed or migrated, then the
system clock backing the pvclock clocksource may revert to a smaller
value (ie, can be non-monotonic across the migration/save-restore).

Make sure we zero last_value in that case so that the domain
continues to see clock updates.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
arch/x86/include/asm/pvclock.h
arch/x86/kernel/pvclock.c
arch/x86/xen/time.c

index cd02f324aa6b39c8ba1d149b7646f356043fa77c..6226870d11cde67393bb331c415ac7d5c5d6ad5c 100644 (file)
@@ -11,5 +11,6 @@ unsigned long pvclock_tsc_khz(struct pvclock_vcpu_time_info *src);
 void pvclock_read_wallclock(struct pvclock_wall_clock *wall,
                            struct pvclock_vcpu_time_info *vcpu,
                            struct timespec *ts);
+void pvclock_resume(void);
 
 #endif /* _ASM_X86_PVCLOCK_H */
index 239427ca02af05f8671aacaf9820aa298e94bff1..a4f07c1cfc87ae24ce34ee01d03e8590e5169afe 100644 (file)
@@ -120,6 +120,11 @@ unsigned long pvclock_tsc_khz(struct pvclock_vcpu_time_info *src)
 
 static atomic64_t last_value = ATOMIC64_INIT(0);
 
+void pvclock_resume(void)
+{
+       atomic64_set(&last_value, 0);
+}
+
 cycle_t pvclock_clocksource_read(struct pvclock_vcpu_time_info *src)
 {
        struct pvclock_shadow_time shadow;
index a86df42e46adb27151d4d04205acd7d64e0af716..41eb583adc8dc9cd73b17819a7180ce187c69896 100644 (file)
@@ -425,6 +425,8 @@ void xen_timer_resume(void)
 {
        int cpu;
 
+       pvclock_resume();
+
        if (xen_clockevent != &xen_vcpuop_clockevent)
                return;