From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: Re: What time is it kvm-clock? Date: Thu, 25 Feb 2016 08:22:38 -0300 Message-ID: <20160225112238.GA28965@amt.cnet> References: <20160224035753.GA6681@amt.cnet> <20160224201757.GA6355@potion.redhat.com> <20160224205323.GB6355@potion.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Andy Lutomirski , Peter Hornyack , Owen Hofmann , KVM General , Paolo Bonzini To: Radim =?utf-8?B?S3LEjW3DocWZ?= Return-path: Received: from mx1.redhat.com ([209.132.183.28]:54842 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759227AbcBYLXF (ORCPT ); Thu, 25 Feb 2016 06:23:05 -0500 Content-Disposition: inline In-Reply-To: <20160224205323.GB6355@potion.redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, Feb 24, 2016 at 09:53:23PM +0100, Radim Kr=C4=8Dm=C3=A1=C5=99 w= rote: > 2016-02-24 12:24-0800, Andy Lutomirski: > > On Wed, Feb 24, 2016 at 12:17 PM, Radim Kr=C4=8Dm=C3=A1=C5=99 wrote: > >> 2016-02-24 09:35-0800, Peter Hornyack: > >>> On Tue, Feb 23, 2016 at 7:57 PM, Marcelo Tosatti 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 no= t a > >>> very good reference for what kvm-clock is or how it works. kvm-cl= ock > >>> 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 t= he > >>> core masterclock code, trying to understand how kvm-clock works i= s 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_BOOTTIM= E. > >> ? > >=20 > > If we could supply CLOCK_REALTIME as well and advertise that fact t= o > > guest userspace (perhaps with a sysctl or similar in the guest to t= urn > > it on), it would be *awesome*. Guests with access to this feature > > could simply not run ntpd/chronyd. >=20 > I think that pvclock_wall_clock interface is there to do that. > (If pvclock_vcpu_time_info can provide what is claimed above.) >=20 > If pvclock_wall_clock version field matches with pvclock_vcpu_time_in= fo, > then the guest can add those two and get CLOCK_REALTIME. > (Based on observations of angry users, the implementation lacking.) >=20 > >> Maybe it would be better to say "best estimate of real time" inste= ad of > >> "CLOCK_BOOTTIME", so people wouldn't jump to conclusion that > >> CLOCK_BOOTTIME has something to do with kvmclock ... > >=20 > > We still need to define what zero means, if anything. >=20 > 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. >=20 > (If we're talking about system_time.) >=20 > >> Then we could mention migration (why the time becomes imprecise) a= nd > >> finish by explaining the TSC mechanism (that avoids a vmexit on ev= ery > >> read) and advantages of masterclock. > >=20 > > We should also explain what masterclock is, aside from being an > > implementation detail. I've read the code and I still don't know. >=20 > Yeah, rewriting the code would be a good deed. Please do so.