Re: [Ntp] Antwort: Re: The bump, or why NTP v5 must specify impulse response

Warner Losh <imp@bsdimp.com> Fri, 17 April 2020 16:22 UTC

Return-Path: <wlosh@bsdimp.com>
X-Original-To: ntp@ietfa.amsl.com
Delivered-To: ntp@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id D95343A1131 for <ntp@ietfa.amsl.com>; Fri, 17 Apr 2020 09:22:24 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.896
X-Spam-Level:
X-Spam-Status: No, score=-1.896 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=bsdimp-com.20150623.gappssmtp.com
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id rMw1D2thfCQS for <ntp@ietfa.amsl.com>; Fri, 17 Apr 2020 09:22:23 -0700 (PDT)
Received: from mail-qt1-x82f.google.com (mail-qt1-x82f.google.com [IPv6:2607:f8b0:4864:20::82f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 581FA3A1130 for <ntp@ietf.org>; Fri, 17 Apr 2020 09:22:23 -0700 (PDT)
Received: by mail-qt1-x82f.google.com with SMTP id z90so2381888qtd.10 for <ntp@ietf.org>; Fri, 17 Apr 2020 09:22:23 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=U+11EKEZEs7y8PxJWeygmWPSEWY+jjWRxGewTAOyG+s=; b=Utzl9zMWovj7/skmofTqHNbrRoboipaL+RoPiB3GD594TwqDbIChH+ZR1uZQkBdirE 2pukZnDJLOIkNKjYV/wzmcQp6mWhj2Ujo8+102H1qzt81Pad/eNWc4MTvqrA4YOz+oBH mcZbhS6fkmMpos6VXWnDpgWTGvy3gcKfnw/h9JRInce1mohU8edKObqQYUlTheri+Hjf WDkCuwiKARHHUJu2DPjboYApqDKm/Lsqxrgq5NYo+8ICYxgd9x5JaVbCJN5JyMDrBHnk WsJKjmYieC7bGEVLSA/bLxyj4cafXHgRaES01enTjo8KYHOFE0l0gOSpuU6RNm3JzzdU +qGg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=U+11EKEZEs7y8PxJWeygmWPSEWY+jjWRxGewTAOyG+s=; b=hKaKovHy3yrxIjhCXeJasZMmaFpvFW9lYmpix4tT6OilwWEd9vr19CPVHTbgy5oygB YzUjiuXoiZNSAnYHGPvW6LqqimuswgyC+m+10O6g0nmsjlOdrAMpiQrtY2/ne717f5AQ hf/19Hg8WEHVNzDKkLKjOG3nyPaxb1+YIaqDccl/1J1Oq/jjMZ/AvP14g7vp26uMcII6 XobhFbfHgan+QrHFtL1MzOr2NiStPplYpi8Cha+WswjQ3HS8ua1AhhFeZEnotOze9NbS FgKZiJ3uS0HnN+mmsxfeZ7JEWbc37gKS9bm5TMc3g7KSjF78a/Xn/sABk/2qULK9ySVV ZRUQ==
X-Gm-Message-State: AGi0PuaAOnpzKwh4WA8GxGi3KQVXHzBcumS7Ob7YG2pvdwPShI77sqbd dlIfI3gdj6pxawDc92eXGrFiGMrUIlCmYLNQUVT89Q==
X-Google-Smtp-Source: APiQypIJcwZVxYRnFpdAgsuHMfB5peQS8q+WMtV4C/e1+bjoQb9m+y/HDdhJpwWrInFEBiRMGMbk6pNUQt0Z3KeKAM8=
X-Received: by 2002:ac8:66d8:: with SMTP id m24mr3714628qtp.175.1587140542023; Fri, 17 Apr 2020 09:22:22 -0700 (PDT)
MIME-Version: 1.0
References: <CACsn0c=zzDKP6iBjPJWGF0rkqSaY3AY738ynGwDZO14sdBJ-Bg@mail.gmail.com> <CAJm83bB2A3VUxXX47Y0ubmS9Xne7PRSyV_xHY_D9YvHjqE-vFA@mail.gmail.com> <CACsn0cm3jpKZTUQ=novTgVaFhc1xCJgmUF3oOgdrzQa-HgOCUQ@mail.gmail.com> <CAJm83bAqbMMs2W3SyH+3c17wcC85paY4-_jk2SxczgsxBLyYyA@mail.gmail.com> <CAJm83bAQeR_6U3jgmbWzdus3pu+OO2_KP+M9RtbCFYOfDQy4dw@mail.gmail.com> <DB8PR02MB56111CCA23CDCF97A3C9F3E8CFDD0@DB8PR02MB5611.eurprd02.prod.outlook.com> <F7E5836A-4C7A-4A1A-B769-65EADE2C8F5C@gmail.com> <7d909ae3-a830-1270-6920-fa088a56525e@nwtime.org> <6C9832A9-E18B-4DE2-934F-9E471FC22F7B@akamai.com> <bc7920e2-dc81-ba7f-ec24-7926cda8589d@nwtime.org> <E591F38A-A303-4077-BC4C-A61AB7867F83@gmail.com> <OFF6FE7A91.279129DD-ONC125854D.00379455-C125854D.0038D979@ptb.de> <CAJm83bAUqCyy6iKVkGNyHN9hoaEbchuR4bx+kmc=Z-iOrZ3Bgg@mail.gmail.com> <CANCZdfr1Ku6c-LMD5pTaY1yohEO229ppAqbwxQX2Qz3r+tG0bQ@mail.gmail.com> <CAJm83bDS92mPGaZ9xTOwfZWB10t+Br08Y-ZH5EqKvGs1MDC_4w@mail.gmail.com>
In-Reply-To: <CAJm83bDS92mPGaZ9xTOwfZWB10t+Br08Y-ZH5EqKvGs1MDC_4w@mail.gmail.com>
From: Warner Losh <imp@bsdimp.com>
Date: Fri, 17 Apr 2020 10:22:10 -0600
Message-ID: <CANCZdfp9jupJB2oLeNQa9ZetyCcj0TPUjaR7_B3puO_MB-OAvQ@mail.gmail.com>
To: Daniel Franke <dfoxfranke@gmail.com>
Cc: kristof.teichel@ptb.de, NTP WG <ntp@ietf.org>
Content-Type: multipart/alternative; boundary="0000000000003762fe05a37ef4da"
Archived-At: <https://mailarchive.ietf.org/arch/msg/ntp/WUk1UAnRYNNp0tDlTa0AI7mQ5xA>
Subject: Re: [Ntp] Antwort: Re: The bump, or why NTP v5 must specify impulse response
X-BeenThere: ntp@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: <ntp.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/ntp>, <mailto:ntp-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/ntp/>
List-Post: <mailto:ntp@ietf.org>
List-Help: <mailto:ntp-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/ntp>, <mailto:ntp-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 17 Apr 2020 16:22:25 -0000

On Fri, Apr 17, 2020 at 10:08 AM Daniel Franke <dfoxfranke@gmail.com> wrote:

> On Fri, Apr 17, 2020 at 11:35 AM Warner Losh <imp@bsdimp.com> wrote:
> > Counters of sufficient resolution wrap. There's often a software counter
> too. And getting either the raw software or raw hardware counters and/or
> their notion of a relationship to the local system time can be tricky as
> well. Some OSes allow access to the raw counters (since CPUs allow turning
> that access on/off), and some even publish what's basically a 'phase at
> count' testimate and a frequency estimate that the applications can then
> use to compute time w/o a round trip into the kernel (this is often hidden
> inside of libc's clock_gettime or similar).
> >
> > Also, how does NTPd get access to this pure counter when it timestamps
> the packets? It would need to know that in order to measure the evolution
> of that counter over time to make estimates about it.
> >
> > And I'd maintain that the NTP daemon needs to provide both the phase
> estimate of the counter vs the TAI and a shorter-term frequency estimate
> for the counter's evolution. Since the counter is likely to be lousy over
> time and the frequency will wander all over the place (relative to a high
> precision time keeping xtal or clock), the most useful information is that
> counter X is TAI time Y and the short-term frequency is Z (maybe with a Z'
> estimate as well). The OS will need to read the counter and produce a
> TAI/UTC time quite often, and doing more than a simple computation will
> show up in benchmarks. But that thinking may be a legacy of NTP steering
> the OS's notion of time that it gets from a pure counter under the covers.
> This is why we have ntp_adjtime providing a time delta and frequency error
> and a bunch of other stuff that talk about ntpd's notion of how good those
> are which are on a spectrum from generally useful, to totally NTPd
> specific. I have a hard time seeing a way to not push the error in time /
> frequency measurements down.
> >
> > Second, the OS needs to keep a smooth time to its clients w/o time jumps
> (but small changes in frequency are OK). So there will likely need to be
> some coordination between the OS and the ntp daemon to communicate how much
> of the 'steers' or 'tyler series' information it could ingest and what it's
> notion of a future counter's time will be so NTP can help steer the OS's
> use of the counter so it will be on time in the future and not overshoot as
> the frequency wanders around.
>
> I don't think we're disagreeing about anything here. Where I say
> "first few Taylor series coefficients" and you say "time delta and
> frequency error", we're talking about the same thing — time delta and
> frequency error are the first and second coefficients respectively.
> I'm considering the kernel and libc all part of the OS, so questions
> about how to deal with hardware counters that wrap and what should
> happen in kernel versus user space all lives on the "OS" side of
> abstraction barrier.
>

Well, the OS provides an 'abstract' counter, but only kinda. Usually it
integrates the past to some point in time after the last counter wrap and
then uses the delta from that point to the current counter to compute the
time. The OS may have a hard time providing a pure counter to NTP, and it
should be designed such that it may only get the low order bits from the
counter and an OS timestamp...

Warner