Re: [PATCH 3/4] KVM: x86: introduce get_kvmclock_ns

From: Roman Kagan
Date: Mon Sep 19 2016 - 15:05:07 EST


On Mon, Sep 19, 2016 at 01:39:12PM +0200, Paolo Bonzini wrote:
> Introduce a function that reads the exact nanoseconds value that is
> provided to the guest in kvmclock. This crystallizes the notion of
> kvmclock as a thin veneer over a stable TSC, that the guest will
> (hopefully) convert with NTP. In other words, kvmclock is *not* a
> paravirtualized host-to-guest NTP.
>
> Drop the get_kernel_ns() function, that was used both to get the base
> value of the master clock and to get the current value of kvmclock.
> The former use is replaced by ktime_get_boot_ns(), the latter is
> the purpose of get_kernel_ns().
>
> This also allows KVM to provide a Hyper-V time reference counter that
> is synchronized with the time that is computed from the TSC page.
>
> Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>
> ---
> arch/x86/entry/vdso/vclock_gettime.c | 2 +-
> arch/x86/include/asm/pvclock.h | 5 ++--
> arch/x86/kernel/pvclock.c | 2 +-
> arch/x86/kvm/hyperv.c | 2 +-
> arch/x86/kvm/x86.c | 48 +++++++++++++++++++++++++++---------
> arch/x86/kvm/x86.h | 6 +----
> 6 files changed, 43 insertions(+), 22 deletions(-)

Reviewed-by: Roman Kagan <rkagan@xxxxxxxxxxxxx>