[Devel,RHEL7,COMMIT] ms/KVM: x86: initialize kvmclock_offset

Submitted by Konstantin Khorenko on Oct. 24, 2016, 12:07 p.m.

Details

Message ID 201610241207.u9OC78ki023006@finist_cl7.x64_64.work.ct
State New
Series "ms/KVM: x86: initialize kvmclock_offset"
Headers show

Commit Message

Konstantin Khorenko Oct. 24, 2016, 12:07 p.m.
The commit is pushed to "branch-rh7-3.10.0-327.36.1.vz7.19.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-327.36.1.vz7.19.3
------>
commit daf2baed0544023dde45e35828c33bbea1f603f2
Author: Paolo Bonzini <pbonzini@redhat.com>
Date:   Mon Oct 24 16:07:08 2016 +0400

    ms/KVM: x86: initialize kvmclock_offset
    
    Make the guest's kvmclock count up from zero, not from the host boot
    time.  The guest cannot rely on that anyway because it changes on
    migration, the numbers are easier on the eye and finally it matches the
    desired semantics of the Hyper-V time reference counter.
    
    Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
    (cherry picked from commit 67198ac3f37ffb150f1c95fae16b597339eabc9d)
    Signed-off-by: Denis Plotnikov <dplotnikov@virtuozzo.com>
    Reviewed-by: Roman Kagan <rkagan@virtuozzo.com>
    Signed-off-by: "Denis V. Lunev" <den@openvz.org>
---
 arch/x86/kvm/x86.c | 1 +
 1 file changed, 1 insertion(+)

Patch hide | download patch | download mbox

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 3d5888c..31b59bf 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -7579,6 +7579,7 @@  int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
 	mutex_init(&kvm->arch.apic_map_lock);
 	spin_lock_init(&kvm->arch.pvclock_gtod_sync_lock);
 
+	kvm->arch.kvmclock_offset = -get_kernel_ns();
 	pvclock_update_vm_gtod_copy(kvm);
 
 	INIT_DELAYED_WORK(&kvm->arch.kvmclock_update_work, kvmclock_update_fn);