x86: kvmclock: abstract save/restore sched_clock_state
authorMarcelo Tosatti <mtosatti@redhat.com>
Mon, 13 Feb 2012 13:07:27 +0000 (11:07 -0200)
committerAvi Kivity <avi@redhat.com>
Tue, 20 Mar 2012 10:37:45 +0000 (12:37 +0200)
commitb74f05d61b73af584d0c39121980171389ecfaaa
tree1406185fb45430549b37ef3b4f62f9c5772ef139
parent9587190107d0c0cbaccbf7bf6b0245d29095a9ae
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>
arch/x86/include/asm/tsc.h
arch/x86/include/asm/x86_init.h
arch/x86/kernel/kvmclock.c
arch/x86/kernel/tsc.c
arch/x86/kernel/x86_init.c
arch/x86/power/cpu.c