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

Konstantin Khorenko khorenko at virtuozzo.com
Mon Oct 24 05:07:08 PDT 2016


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 at 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 at redhat.com>
    (cherry picked from commit 67198ac3f37ffb150f1c95fae16b597339eabc9d)
    Signed-off-by: Denis Plotnikov <dplotnikov at virtuozzo.com>
    Reviewed-by: Roman Kagan <rkagan at virtuozzo.com>
    Signed-off-by: "Denis V. Lunev" <den at openvz.org>
---
 arch/x86/kvm/x86.c | 1 +
 1 file changed, 1 insertion(+)

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);


More information about the Devel mailing list