From: Suleiman Souhlal <suleiman@google.com>
To: Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: John Stultz <john.stultz@linaro.org>,
sboyd@kernel.org, Linux Kernel <linux-kernel@vger.kernel.org>,
kvm@vger.kernel.org, Paolo Bonzini <pbonzini@redhat.com>,
rkrcmar@redhat.com, Thomas Gleixner <tglx@linutronix.de>,
Tomasz Figa <tfiga@google.com>
Subject: Re: [RFC 2/2] x86/kvmclock: Use host timekeeping.
Date: Tue, 24 Sep 2019 17:10:55 +0900 [thread overview]
Message-ID: <CABCjUKDPa1wrvp5zrjCa0tAQUO5UuFNgc00Z5kt_7rgakjApDw@mail.gmail.com> (raw)
In-Reply-To: <87woe38538.fsf@vitty.brq.redhat.com>
On Fri, Sep 20, 2019 at 10:33 PM Vitaly Kuznetsov <vkuznets@redhat.com> wrote:
>
> 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.
Fair enough. I'll do that in the next version of the patch.
The goal is to have a guest clock that gives the same
clock_gettime(CLOCK_MONOTONIC) as the host.
Thanks,
-- Suleiman
next prev parent reply other threads:[~2019-09-24 8:11 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
2019-09-24 8:10 ` Suleiman Souhlal [this message]
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=CABCjUKDPa1wrvp5zrjCa0tAQUO5UuFNgc00Z5kt_7rgakjApDw@mail.gmail.com \
--to=suleiman@google.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=tfiga@google.com \
--cc=tglx@linutronix.de \
--cc=vkuznets@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).