[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87woe38538.fsf@vitty.brq.redhat.com>
Date: Fri, 20 Sep 2019 15:33:47 +0200
From: Vitaly Kuznetsov <vkuznets@...hat.com>
To: Suleiman Souhlal <suleiman@...gle.com>
Cc: john.stultz@...aro.org, sboyd@...nel.org,
linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
Suleiman Souhlal <suleiman@...gle.com>, pbonzini@...hat.com,
rkrcmar@...hat.com, tglx@...utronix.de
Subject: Re: [RFC 2/2] x86/kvmclock: Use host timekeeping.
Suleiman Souhlal <suleiman@...gle.com> writes:
> When CONFIG_KVMCLOCK_HOST_TIMEKEEPING is enabled, and the host
> supports it, update our timekeeping parameters to be the same as
> the host. This lets us have our time synchronized with the host's,
> even in the presence of host NTP or suspend.
>
> When enabled, kvmclock uses raw tsc instead of pvclock.
>
> When enabled, syscalls that can change time, such as settimeofday(2)
> or adj_timex(2) are disabled in the guest.
>
> Signed-off-by: Suleiman Souhlal <suleiman@...gle.com>
> ---
> arch/x86/Kconfig | 9 +++
> arch/x86/include/asm/kvmclock.h | 2 +
> arch/x86/kernel/kvmclock.c | 127 +++++++++++++++++++++++++++++++-
> kernel/time/timekeeping.c | 21 ++++++
> 4 files changed, 155 insertions(+), 4 deletions(-)
>
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index 4195f44c6a09..37299377d9d7 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -837,6 +837,15 @@ config PARAVIRT_TIME_ACCOUNTING
> config PARAVIRT_CLOCK
> bool
>
> +config KVMCLOCK_HOST_TIMEKEEPING
> + bool "kvmclock uses host timekeeping"
> + depends on KVM_GUEST
> + ---help---
> + Select this option to make the guest use the same timekeeping
> + parameters as the host. This means that time will be almost
> + exactly the same between the two. Only works if the host uses "tsc"
> + clocksource.
> +
I'd also like to speak up against this config, it is confusing. In case
the goal is to come up with a TSC-based clock for guests which will
return the same as clock_gettime() on the host (or, is the goal to just
have the same reading for all guests on the host?) I'd suggest we create
a separate (from KVMCLOCK) clocksource (mirroring host timekeeper) and
guests will be free to pick the one they like.
--
Vitaly
Powered by blists - more mailing lists