]> git.ipfire.org Git - thirdparty/qemu.git/commit
kvmclock: clock should count only if vm is running
authorMarcelo Tosatti <mtosatti@redhat.com>
Tue, 18 Jun 2013 23:38:25 +0000 (20:38 -0300)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Mon, 12 Aug 2013 22:21:01 +0000 (17:21 -0500)
commit1eeacd413af165d672b474c5420a3877052b573a
treea4bc8e124332489353f33670b0f2ff3fc93cac8e
parentf7fe3d2f7733648b6f0d36e617180622634fe00e
kvmclock: clock should count only if vm is running

kvmclock should not count while vm is paused, because:

1) if the vm is paused for long periods, timekeeping
math can overflow while converting the (large) clocksource
delta to nanoseconds.

2) Users rely on CLOCK_MONOTONIC to count run time, that is,
time which OS has been in a runnable state (see CLOCK_BOOTTIME).

Change kvmclock driver so as to save clock value when vm transitions
from runnable to stopped state, and to restore clock value from stopped
to runnable transition.

Cc: qemu-stable@nongnu.org
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 00f4d64ee76e873be881a82d893a591487aa7950)

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
hw/i386/kvm/clock.c