From mboxrd@z Thu Jan 1 00:00:00 1970 From: Radim =?utf-8?B?S3LEjW3DocWZ?= Subject: Re: What time is it kvm-clock? Date: Wed, 24 Feb 2016 21:53:23 +0100 Message-ID: <20160224205323.GB6355@potion.redhat.com> References: <20160224035753.GA6681@amt.cnet> <20160224201757.GA6355@potion.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Peter Hornyack , Marcelo Tosatti , Owen Hofmann , KVM General , Paolo Bonzini To: Andy Lutomirski Return-path: Received: from mx1.redhat.com ([209.132.183.28]:56721 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750719AbcBXUx1 (ORCPT ); Wed, 24 Feb 2016 15:53:27 -0500 Content-Disposition: inline In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: 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 d= esign >>>>> goals for kvm-clock (and kvm's implementation of the reference TS= C >>>>> 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-cloc= k >>> 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. >> ? >=20 > 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 tur= n > 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 ... >=20 > 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 ever= y >> 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. Yeah, rewriting the code would be a good deed.