public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: "Radim Krčmář" <rkrcmar@redhat.com>
To: Andy Lutomirski <luto@amacapital.net>
Cc: Peter Hornyack <peterhornyack@google.com>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	Owen Hofmann <osh@google.com>, KVM General <kvm@vger.kernel.org>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: What time is it kvm-clock?
Date: Wed, 24 Feb 2016 21:53:23 +0100	[thread overview]
Message-ID: <20160224205323.GB6355@potion.redhat.com> (raw)
In-Reply-To: <CALCETrVJuZtqQ2OEv-TcCbgZhWFh11XTJ3cQEqsQUKSsBVHA7Q@mail.gmail.com>

2016-02-24 12:24-0800, Andy Lutomirski:
> On Wed, Feb 24, 2016 at 12:17 PM, Radim Krčmář <rkrcmar@redhat.com> wrote:
>> 2016-02-24 09:35-0800, Peter Hornyack:
>>> On Tue, Feb 23, 2016 at 7:57 PM, Marcelo Tosatti <mtosatti@redhat.com> wrote:
>>>> On Tue, Feb 23, 2016 at 06:31:59PM -0800, Owen Hofmann wrote:
>>>>> Regardless of my opinion, I think that a clear statement of the design
>>>>> goals for kvm-clock (and kvm's implementation of the reference TSC
>>>>> page) would be valuable.
>>>>
>>>> Documentation/virtual/kvm/timekeeping.txt
>>>>
>>>
>>> Hi Marcelo,
>>>
>>> While I appreciate all of the detail in timekeeping.txt, it is not a
>>> very good reference for what kvm-clock is or how it works. kvm-clock
>>> is only mentioned three times in different places throughout that
>>> document, and nowhere is there a very clear statement of what
>>> kvm-clock is supposed to do or how it does it.
>>>
>>> For somebody that does not already have a deep understanding of the
>>> core masterclock code, trying to understand how kvm-clock works is a
>>> real challenge.
>>
>> I agree.  Having an overview would be very helpful.
>>
>> Do you find anything incorrect with
>>  * kvmclock measures the flow of time.
>>  * time in kvmclock flows at the same rate as host's CLOCK_BOOTTIME.
>> ?
> 
> If we could supply CLOCK_REALTIME as well and advertise that fact to
> guest userspace (perhaps with a sysctl or similar in the guest to turn
> it on), it would be *awesome*.  Guests with access to this feature
> could simply not run ntpd/chronyd.

I think that pvclock_wall_clock interface is there to do that.
(If pvclock_vcpu_time_info can provide what is claimed above.)

If pvclock_wall_clock version field matches with pvclock_vcpu_time_info,
then the guest can add those two and get CLOCK_REALTIME.
(Based on observations of angry users, the implementation lacking.)

>> Maybe it would be better to say "best estimate of real time" instead of
>> "CLOCK_BOOTTIME", so people wouldn't jump to conclusion that
>> CLOCK_BOOTTIME has something to do with kvmclock ...
> 
> We still need to define what zero means, if anything.

I think it's better if only the difference between two reads has a
meaning (the number of nanoseconds that passed).  Zero is then an
arbitrary value.

(If we're talking about system_time.)

>> Then we could mention migration (why the time becomes imprecise) and
>> finish by explaining the TSC mechanism (that avoids a vmexit on every
>> read) and advantages of masterclock.
> 
> We should also explain what masterclock is, aside from being an
> implementation detail.  I've read the code and I still don't know.

Yeah, rewriting the code would be a good deed.

  reply	other threads:[~2016-02-24 20:53 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-24  2:31 What time is it kvm-clock? Owen Hofmann
2016-02-24  3:57 ` Marcelo Tosatti
2016-02-24 17:35   ` Peter Hornyack
2016-02-24 20:17     ` Radim Krčmář
2016-02-24 20:24       ` Andy Lutomirski
2016-02-24 20:53         ` Radim Krčmář [this message]
2016-02-25 11:13           ` Radim Krčmář
2016-02-25 11:22           ` Marcelo Tosatti
2016-02-24 23:35     ` Marcelo Tosatti
2016-02-24 23:36       ` Marcelo Tosatti
2016-02-25  1:19       ` Andy Lutomirski
2016-02-25  3:50         ` Owen Hofmann
2016-02-25 12:20           ` Radim Krčmář
2016-02-26 17:02             ` Andy Lutomirski
2016-02-26 19:30               ` Marcelo Tosatti
2016-02-27  0:00                 ` Andy Lutomirski
2016-02-25 11:36         ` Radim Krčmář
2016-02-25 12:12         ` Marcelo Tosatti
2016-02-24  3:59 ` Marcelo Tosatti
2016-02-24 14:14 ` Paolo Bonzini
2016-02-24 16:44   ` Andy Lutomirski
2016-02-24 17:38     ` Marcelo Tosatti
2016-02-24 19:38       ` Andy Lutomirski
2016-02-24 19:44         ` Paolo Bonzini
2016-02-24 19:52           ` Andy Lutomirski
2016-02-24 19:55         ` Owen Hofmann
2016-02-25 12:22           ` Joao Martins
2016-02-26 15:04 ` Marcelo Tosatti

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=20160224205323.GB6355@potion.redhat.com \
    --to=rkrcmar@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=mtosatti@redhat.com \
    --cc=osh@google.com \
    --cc=pbonzini@redhat.com \
    --cc=peterhornyack@google.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