Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1486396

[PATCH 2/4] KVM: x86: initialize kvmclock_offset

From Paolo Bonzini <pbonzini@redhat.com>
Newsgroups linux.kernel
Subject [PATCH 2/4] KVM: x86: initialize kvmclock_offset
Date 2016-09-19 13:40 +0200
Message-ID <sj55w-4R9-19@gated-at.bofh.it> (permalink)
References <sj55v-4R9-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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.

Reviewed-by: Roman Kagan <rkagan@virtuozzo.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 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 d1e830715e40..00e569c3ca71 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -7779,6 +7779,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);
-- 
1.8.3.1

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/4] KVM: x86: kvmclock cleanups for Hyper-V TSC page Paolo Bonzini <pbonzini@redhat.com> - 2016-09-19 13:40 +0200
  [PATCH 2/4] KVM: x86: initialize kvmclock_offset Paolo Bonzini <pbonzini@redhat.com> - 2016-09-19 13:40 +0200
  [PATCH 4/4] KVM: x86: Hyper-V tsc page setup Paolo Bonzini <pbonzini@redhat.com> - 2016-09-19 13:50 +0200
  [PATCH 1/4] KVM: x86: always fill in vcpu->arch.hv_clock Paolo Bonzini <pbonzini@redhat.com> - 2016-09-19 13:50 +0200

csiph-web