[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: statistical time calibration


  • To: Jan Beulich <jbeulich@xxxxxxxx>, Colin Percival <cperciva@xxxxxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Fri, 11 Mar 2022 16:29:01 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=VBo92vs/J2whbFMGg3aG7kvVyctYctEerkmEdGhcIH8=; b=RX2ht63DNJQk77E4pGyJ9/l/oX1/04C3H6b4VvljhDzSkEx/gaFoYKXmdzxFtUX6z7aElLrrR9HucdJr97bxE7A9n73+sAc1fjlzWp53pAKh8u1OEiyIXo49Tb3n8ttKa8R3ZERQlmSYs0setpQNenAOWSpfTQVbHdOy5QqJIdGpja3FYtL99wHAKGZMwCvHwgKZL6gjqJCZw0EiIfJwWFML1KL5Vm7yNZa+m45Epdi8K/PFOQwPJ+n4emAKRp2+WKfXJ4tkMCsPD/5BLM3D33/7g23mSXvlk1R0Lq6vhl2j2RhkoWFkvKy7ULMv/bIU6ggEAzMRE5uSsFswspAnag==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i5uOO7ylvF85zRmAtE0wJI+uq+OOsOMMdZ/II7twbBguLeXVWD93v9rCrPXGG5pDND9J1+tmxLPUiLajpQtOOe324WwGmwDFWz2pXbaCiSfAu3yjo33bfIXcrPtwfBP31CD+kLP9hK45xbRqHFuQEhYH/6AjXFo7LLWGZ7d/6IwxdHwLzQZhDBWusYIs+b8Wv0Djpu7eoxpqSVDdGPpCX8F/rJrxyK3XMXhZfRJMag30ii+RiFfpeK+UG8pKkDHmgTly14Kl5rIaCSz4n/T+Kc/goBUD6ZvMM/G8nLCoKEQ7fEeEt0eJznRC6Vf+/4SqDt9R1InkmEqmuFQlmkxvPg==
  • Authentication-results: esa6.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Fri, 11 Mar 2022 15:29:28 +0000
  • Ironport-data: A9a23:qLhtTaN2iDp1JITvrR2Jl8FynXyQoLVcMsEvi/4bfWQNrUoigmEPn GFMX2CCOq6LZzOmfdB0PN/g8U4OvcKDy9ZqSgto+SlhQUwRpJueD7x1DKtR0wB+jCHnZBg6h ynLQoCYdKjYdleF+lH1dOKJQUBUjclkfJKlYAL/En03FFcMpBsJ00o5wbZi29cw27BVPivW0 T/Mi5yHULOa82Yc3lI8s8pvfzs24ZweEBtB1rAPTagjUG32zhH5P7pGTU2FFFPqQ5E8IwKPb 72rIIdVXI/u10xF5tuNyt4Xe6CRK1LYFVDmZnF+A8BOjvXez8CbP2lS2Pc0MC9qZzu1c99Zl 4kOu4Crb1YVGu7Bx8YXDxBdTgI5BPgTkFPHCSDXXc27ykTHdz3nwul0DVFwNoodkgp1KTgQr 7pCcmlLN03dwbLtqF64YrAEasALNs7kMZlZonh95TrYEewnUdbIRKCiCdpwgmph25kRR6y2i 8wxdiFCNBTtXgxzN04wFIg+wvnytyD6fGgNwL6SjfVuuDWCpOBr65D9PdyQdtGUSMF9mkeDu nmA72n/GgsdNtGU1XyC6H3ErvDLtTP2XsQVDrLQ3vxgjUCXx2cTIAYLTlb9qv684ma1Q99FI E0K8wIgt6U//lenCN7nUHWFTGWs50BGHYAKSqtjtV/LmvG8Dxul6nYsEWICZsA9k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qJ/lp T525RT5cBzp/AtHNFA7cc6MLyK4z/2MGTx2Fz7GyWUKEhAAQOJl6LK
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Tue, Jan 18, 2022 at 04:03:56PM +0100, Jan Beulich wrote:
> Hello,
> 
> Roger pointer me to a FreeBSD commit [1] introducing such there. While
> we don't start at 2000ms (but rather at 50), this still looked interesting
> enough to take a closer look. I think I've mostly understood the idea and
> implementation now, with the exception of three things:

I have to admit I didn't really look at the commit in detail, just saw
it go by at the same time you where working on improving our time
calibration, and assumed it could be interesting.

> 1) When deciding whether to increment "passes", both variance values have
> an arbitrary value of 4 added to them. There's a sentence about this in
> the earlier (big) comment, but it lacks any justification as to the chosen
> value. What's worse, variance is not a plain number, but a quantity in the
> same units as the base values. Since typically both clocks will run at
> very difference frequencies, using the same (constant) value here has much
> more of an effect on the lower frequency clock's value than on the higher
> frequency one's.
> 
> 2) The second of the "important formulas" is nothing I could recall or was
> able to look up. All I could find are somewhat similar, but still
> sufficiently different ones. Perhaps my "introductory statistics" have
> meanwhile been too long ago ... (In this context I'd like to also mention
> that it took me quite a while to prove to myself that the degenerate case
> of, in particular, the first iteration wouldn't lead to an early exit
> from the function.)
> 
> 3) At the bottom of the loop there is some delaying logic, leading to
> later data points coming in closer succession than earlier ones. I'm
> afraid I don't understand the "theoretical risk of aliasing", and hence
> I'm seeing more risks than benefits from this construct.

Might be easier to just add Colin, he did the original commit and can
likely answer those questions much better than me. He has also done a
bunch of work for FreeBSD/Xen.

> Beyond that there are implementation aspects that I'm not happy with,
> like aforementioned delay loop not dealing with a TSC which did start
> from a large "negative" value, and which hence would eventually wrap. Nor
> is the SMI (or other long latency events) aspect being taken care of. But
> any such concern could of course be dealt with as we port over this
> logic, if we decided we want to go that route.
> 
> My main concern is with the goal of reaching accuracy of 1PPM, and the
> loop ending only after a full second (if I got that right) if that
> accuracy cannot be reached. Afaict there's no guarantee that 1PPM is
> reachable. My recent observations suggest that with HPET that's
> feasible (but only barely), but with PMTMR it might be more like 3 or
> more.
> 
> The other slight concern I have, as previously voiced on IRC, is the use
> of floating point here.
> 
> Jan
> 
> [1] 
> https://cgit.freebsd.org/src/commit/?id=c2705ceaeb09d8579661097fd358ffb5defb5624
> 



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.