This is a note to let you know that I've just added the patch titled
KVM: x86: apply kvmclock offset to guest wall clock time
to the 3.5-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
kvm-x86-apply-kvmclock-offset-to-guest-wall-clock-time.patch
and it can be found in the queue-3.5 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <[email protected]> know about it.
>From [email protected] Fri Aug 17 11:06:38 2012
From: Bruce Rogers <[email protected]>
Date: Wed, 15 Aug 2012 11:49:02 +0300
Subject: KVM: x86: apply kvmclock offset to guest wall clock time
To: [email protected]
Cc: Marcelo Tosatti <[email protected]>
Message-ID: <[email protected]>
From: Bruce Rogers <[email protected]>
(cherry picked from commit 4b6486659a7defef82ea51b276024b3aa357fefc)
When a guest migrates to a new host, the system time difference from the
previous host is used in the updates to the kvmclock system time visible
to the guest, resulting in a continuation of correct kvmclock based guest
timekeeping.
The wall clock component of the kvmclock provided time is currently not
updated with this same time offset. Since the Linux guest caches the
wall clock based time, this discrepency is not noticed until the guest is
rebooted. After reboot the guest's time calculations are off.
This patch adjusts the wall clock by the kvmclock_offset, resulting in
correct guest time after a reboot.
Cc: Zachary Amsden <[email protected]>
Signed-off-by: Bruce Rogers <[email protected]>
Signed-off-by: Marcelo Tosatti <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
arch/x86/kvm/x86.c | 4 ++++
1 file changed, 4 insertions(+)
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -907,6 +907,10 @@ static void kvm_write_wall_clock(struct
*/
getboottime(&boot);
+ if (kvm->arch.kvmclock_offset) {
+ struct timespec ts = ns_to_timespec(kvm->arch.kvmclock_offset);
+ boot = timespec_sub(boot, ts);
+ }
wc.sec = boot.tv_sec;
wc.nsec = boot.tv_nsec;
wc.version = version;
Patches currently in stable-queue which might be from [email protected] are
queue-3.5/kvm-x86-apply-kvmclock-offset-to-guest-wall-clock-time.patch
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html