kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Cc: peterhornyack@google.com, rkrcmar@redhat.com, den@openvz.org,
	rkagan@virtuozzo.com
Subject: [PATCH 2/4] KVM: x86: initialize kvmclock_offset
Date: Thu,  1 Sep 2016 17:26:13 +0200	[thread overview]
Message-ID: <1472743575-123756-3-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1472743575-123756-1-git-send-email-pbonzini@redhat.com>

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>
---
 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 65974dd0565f..b5853b86b67d 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -7774,6 +7774,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

  parent reply	other threads:[~2016-09-01 15:26 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-01 15:26 [PATCH 0/4] KVM: x86: kvmclock cleanups for Hyper-V TSC page Paolo Bonzini
2016-09-01 15:26 ` [PATCH 1/4] KVM: x86: always fill in vcpu->arch.hv_clock Paolo Bonzini
2016-09-02 13:31   ` Roman Kagan
2016-09-02 13:48     ` Paolo Bonzini
2016-09-01 15:26 ` Paolo Bonzini [this message]
2016-09-02 13:32   ` [PATCH 2/4] KVM: x86: initialize kvmclock_offset Roman Kagan
2016-09-01 15:26 ` [PATCH 3/4] KVM: x86: introduce get_kvmclock_ns Paolo Bonzini
2016-09-02 13:52   ` Roman Kagan
2016-09-02 14:09     ` Paolo Bonzini
2016-09-02 14:51       ` Roman Kagan
2016-09-02 16:37         ` Paolo Bonzini
2016-09-02 16:55           ` Roman Kagan
2016-09-02 16:57             ` Paolo Bonzini
2016-09-02 17:07               ` Roman Kagan
2016-09-02 15:24   ` Roman Kagan
2016-09-05 13:59     ` Paolo Bonzini
2016-09-01 15:26 ` [PATCH 4/4] KVM: x86: Hyper-V tsc page setup Paolo Bonzini
2016-09-02 14:17   ` Roman Kagan
  -- strict thread matches above, loose matches on Subject: below --
2016-09-19 11:39 [PATCH v2 0/4] KVM: x86: kvmclock cleanups for Hyper-V TSC page Paolo Bonzini
2016-09-19 11:39 ` [PATCH 2/4] KVM: x86: initialize kvmclock_offset Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1472743575-123756-3-git-send-email-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=den@openvz.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterhornyack@google.com \
    --cc=rkagan@virtuozzo.com \
    --cc=rkrcmar@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).