]> git.ipfire.org Git - people/arne_f/kernel.git/commit
KVM: x86: Fix a possible backwards warp of kvmclock
authorZachary Amsden <zamsden@redhat.com>
Wed, 4 May 2011 12:31:28 +0000 (09:31 -0300)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 9 May 2011 22:55:42 +0000 (15:55 -0700)
commitad2088cabe0fd7f633f38ba106025d33ed9a2105
treef0de73f4a487e14b517743819d7e8bdaff6e7c2a
parent64c8f7b9a24b1de710ad8413da503d61ede6ae45
KVM: x86: Fix a possible backwards warp of kvmclock

(backported from commit 1d5f066e0b63271b67eac6d3752f8aa96adcbddb)

Kernel time, which advances in discrete steps may progress much slower
than TSC.  As a result, when kvmclock is adjusted to a new base, the
apparent time to the guest, which runs at a much higher, nsec scaled
rate based on the current TSC, may have already been observed to have
a larger value (kernel_ns + scaled tsc) than the value to which we are
setting it (kernel_ns + 0).

We must instead compute the clock as potentially observed by the guest
for kernel_ns to make sure it does not go backwards.

Signed-off-by: Zachary Amsden <zamsden@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
BugLink: http://bugs.launchpad.net/bugs/714335
Signed-off-by: Serge E. Hallyn <serge.hallyn@canonical.com>
Reviewed-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
arch/x86/include/asm/kvm_host.h
arch/x86/kvm/x86.c