From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: Suleiman Souhlal <suleiman@google.com>
Cc: john.stultz@linaro.org, sboyd@kernel.org,
linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
Suleiman Souhlal <suleiman@google.com>,
pbonzini@redhat.com, rkrcmar@redhat.com, tglx@linutronix.de
Subject: Re: [RFC 2/2] x86/kvmclock: Use host timekeeping.
Date: Fri, 20 Sep 2019 15:33:47 +0200 [thread overview]
Message-ID: <87woe38538.fsf@vitty.brq.redhat.com> (raw)
In-Reply-To: <20190920062713.78503-3-suleiman@google.com>
Suleiman Souhlal <suleiman@google.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@google.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
next prev parent reply other threads:[~2019-09-20 13:33 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-20 6:27 [RFC 0/2] kvm: Use host timekeeping in guest Suleiman Souhlal
2019-09-20 6:27 ` [RFC 1/2] kvm: Mechanism to copy host timekeeping parameters into guest Suleiman Souhlal
2019-09-20 6:27 ` [RFC 2/2] x86/kvmclock: Use host timekeeping Suleiman Souhlal
2019-09-20 13:33 ` Vitaly Kuznetsov [this message]
2019-09-24 8:10 ` Suleiman Souhlal
2019-09-24 11:14 ` Vitaly Kuznetsov
2019-09-20 7:48 ` [RFC 0/2] kvm: Use host timekeeping in guest Paolo Bonzini
2019-09-20 10:23 ` Thomas Gleixner
2019-09-24 8:08 ` Suleiman Souhlal
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=87woe38538.fsf@vitty.brq.redhat.com \
--to=vkuznets@redhat.com \
--cc=john.stultz@linaro.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=rkrcmar@redhat.com \
--cc=sboyd@kernel.org \
--cc=suleiman@google.com \
--cc=tglx@linutronix.de \
/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).