From: Jeremy Fitzhardinge Subject: Re: [PATCH 05/12] xen/pvclock: add monotonicity check Date: Sun, 18 Oct 2009 17:18:08 +0900 Message-ID: <4ADACF40.20700@goop.org> References: <4AD6B1F0.6030904@goop.org> <1f1b08da0910151832m59d14ac2i4add6555d6a1208a@mail.gmail.com> <4AD7E440.2030503@goop.org> <1255715898.5135.9.camel@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1255715898.5135.9.camel@localhost.localdomain> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: john stultz Cc: Dan Magenheimer , Xen-devel , kurt.hackel@oracle.com, arch/x86 maintainers , Linux Kernel Mailing List , Glauber de Oliveira Costa , Avi Kivity , chris.mason@oracle.com List-Id: xen-devel@lists.xenproject.org On 10/17/09 02:58, john stultz wrote: >> (I can think of plenty of ways of doing it incorrectly, where you'd get >> apparent non-monotonicity regardless of the quality of the time source.) >> > There's been some interesting talk of creating a more offset-robust TSC > clocksource using a per-cpu TSC offsets synced periodically against a > global counter like the HPET. It seems like it could work, but there > are a lot of edge cases and it really has to be right all of the time, > so I don't think its quite as trivial as some folks have thought. But it > would be interesting to see! > Xen and KVM do this already. The host system provides the tsc rate and offset information for each cpu so that the guest kernel can compute a global system time (ns since boot) from the tsc. I suspect its quite difficult to guarantee that you get completely monotonic results if the tscs are at different rates, but if they're the same rate but merely offset it should give completely OK results. J