aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/tsc.c
diff options
context:
space:
mode:
authorMarcelo Tosatti <mtosatti@redhat.com>2012-02-13 08:07:27 -0500
committerAvi Kivity <avi@redhat.com>2012-03-20 06:37:45 -0400
commitb74f05d61b73af584d0c39121980171389ecfaaa (patch)
tree1406185fb45430549b37ef3b4f62f9c5772ef139 /arch/x86/kernel/tsc.c
parent9587190107d0c0cbaccbf7bf6b0245d29095a9ae (diff)
x86: kvmclock: abstract save/restore sched_clock_state
Upon resume from hibernation, CPU 0's hvclock area contains the old values for system_time and tsc_timestamp. It is necessary for the hypervisor to update these values with uptodate ones before the CPU uses them. Abstract TSC's save/restore sched_clock_state functions and use restore_state to write to KVM_SYSTEM_TIME MSR, forcing an update. Also move restore_sched_clock_state before __restore_processor_state, since the later calls CONFIG_LOCK_STAT's lockstat_clock (also for TSC). Thanks to Igor Mammedov for tracking it down. Fixes suspend-to-disk with kvmclock. Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kernel/tsc.c')
-rw-r--r--arch/x86/kernel/tsc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index a62c201c97ec..aed2aa1088f1 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -629,7 +629,7 @@ static void set_cyc2ns_scale(unsigned long cpu_khz, int cpu)
629 629
630static unsigned long long cyc2ns_suspend; 630static unsigned long long cyc2ns_suspend;
631 631
632void save_sched_clock_state(void) 632void tsc_save_sched_clock_state(void)
633{ 633{
634 if (!sched_clock_stable) 634 if (!sched_clock_stable)
635 return; 635 return;
@@ -645,7 +645,7 @@ void save_sched_clock_state(void)
645 * that sched_clock() continues from the point where it was left off during 645 * that sched_clock() continues from the point where it was left off during
646 * suspend. 646 * suspend.
647 */ 647 */
648void restore_sched_clock_state(void) 648void tsc_restore_sched_clock_state(void)
649{ 649{
650 unsigned long long offset; 650 unsigned long long offset;
651 unsigned long flags; 651 unsigned long flags;