KVM: x86: Fix kvmclock bug
commitf413fc28a1db54519b75f731a6e57d1ef0269d78
authorZachary Amsden <zamsden@redhat.com>
Wed, 4 May 2011 12:31:29 +0000 (4 09:31 -0300)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 9 May 2011 22:55:42 +0000 (9 15:55 -0700)
tree7ee28526ce50141217b8dc820f15625164d245d5
parentad2088cabe0fd7f633f38ba106025d33ed9a2105
KVM: x86: Fix kvmclock bug

(backported from commit 28e4639adf0c9f26f6bb56149b7ab547bf33bb95)

If preempted after kvmclock values are updated, but before hardware
virtualization is entered, the last tsc time as read by the guest is
never set.  It underflows the next time kvmclock is updated if there
has not yet been a successful entry / exit into hardware virt.

Fix this by simply setting last_tsc to the newly read tsc value so
that any computed nsec advance of kvmclock is nulled.

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/kvm/x86.c