Re: [Ntp] CLOCK_TAI (was NTPv5: big picture)

Watson Ladd <watsonbladd@gmail.com> Wed, 06 January 2021 22:50 UTC

Return-Path: <watsonbladd@gmail.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 774503A1353 for <ntp@ietfa.amsl.com>; Wed, 6 Jan 2021 14:50:30 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.097
X-Spam-Level:
X-Spam-Status: No, score=-2.097 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-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=gmail.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 aq7F0isF7JPt for <ntp@ietfa.amsl.com>; Wed, 6 Jan 2021 14:50:28 -0800 (PST)
Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) (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 812D83A1352 for <ntp@ietf.org>; Wed, 6 Jan 2021 14:50:28 -0800 (PST)
Received: by mail-lf1-x12d.google.com with SMTP id o17so10308119lfg.4 for <ntp@ietf.org>; Wed, 06 Jan 2021 14:50:28 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=X0FyTrAHic2pyPv4pmW1ZSIz/NxYkCHWUqBVhvSTpT4=; b=K7sEvSg5BAVwXC+SzvD+tBfpkQX6KnKCJ5Bi5d6bvUHS5Xh2Tf/M+o2eAvSfvepZ+F 3AaLw/Ih1CyTCUuRHiO4Q0b0ec+9APBTUlq8wz/CyenxUvS1eWmfFKAxvq4xFNHbVrux Rlbrfd9EBSNyIHz+UEG6HRF/cTwT71+5wrVe7QhmkDp8U319cgRF8XkIiotPqd5XE+Kd x0+aBaV1OSnzc31k3hn7Y3G3v4FcmcwUWyGFPVxVGV/v5BVwfz3d2hD6cTvcNJUbPQ9n GHN3JzpeTcOJhlp0fFDDGgCHeMOFL8kowK73fuCbktQJH6T23SuUdvksnMORElZRPNdN ephw==
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=X0FyTrAHic2pyPv4pmW1ZSIz/NxYkCHWUqBVhvSTpT4=; b=ARsGOTTx0OWxqJu3CDU+GpSUhdfFraJ/P19orepsBNFaiDZJ6x61QKBJDB5aF+OKOU b/8cQQYMoY12ZM6uJqZwfUdES6ptOr6uKgv8c9ojUqe47DBXNNShPIcnrUAFRykMUjG3 LONiC8bmHfv+fSUAjfH35g2qQdmmddplwgg4CjWCCT/k+/Cv3PaRvkqce3PiI4quvh5Y JGtvhFnUr0aY+WSn8ZElNBGGfc5h8kNGuDv19TWZQTMmibG/trIIjaeAqp5Wqt6PoNzc 9NztvvdlqapHf9YMvmXPgzn3TfqO3Buy6ZWy8HCmlFtv11jAQKHmlGVxonFEI6iNoXWz qjog==
X-Gm-Message-State: AOAM5317soBgaRFjkbnn5zK5RdcG8Ny2YvYXtwDwgVSRIQbyCnKV/4/X Rjc7GGruWYcz9JoXysKfhq+Io504X+u6YydZvXPdQovKOWc=
X-Google-Smtp-Source: ABdhPJwOy4Em6B9wn2mLnXm5tDVq9XSgsi6wxIrF+vNyYxkOha4neKlauvYpnLnAXaY6tC5La+rJBy/5+48ZzeGX+5w=
X-Received: by 2002:ac2:4c32:: with SMTP id u18mr2654792lfq.236.1609973426654; Wed, 06 Jan 2021 14:50:26 -0800 (PST)
MIME-Version: 1.0
References: <20210102081603.1F63C40605C@ip-64-139-1-69.sjc.megapath.net> <cecaf661-92af-8b35-4c53-2f025c928144@rubidium.se> <CANCZdfrURzZp5EoU8A-Q9K1tZN0DvLJ10a3ekQtvfrLJExuriA@mail.gmail.com> <cbfd20ae-7cc1-4ef8-0db4-540a11f64378@rubidium.se> <24EEF821-8ED9-46CF-8790-1DF63B102D76@redfish-solutions.com> <6a3a6032-29fa-d426-df3d-140bde4f0eca@rubidium.se> <FA39602B-038C-4844-9F10-82AAE4F8689A@redfish-solutions.com>
In-Reply-To: <FA39602B-038C-4844-9F10-82AAE4F8689A@redfish-solutions.com>
From: Watson Ladd <watsonbladd@gmail.com>
Date: Wed, 06 Jan 2021 14:50:15 -0800
Message-ID: <CACsn0cm+sf+Tntg4CZfKf4De9-7E0_LM6b9sPsMPFbs2gg60Fg@mail.gmail.com>
To: Philip Prindeville <philipp@redfish-solutions.com>
Cc: Magnus Danielson <magnus@rubidium.se>, NTP WG <ntp@ietf.org>, Warner Losh <imp@bsdimp.com>
Content-Type: multipart/alternative; boundary="00000000000031908705b843262a"
Archived-At: <https://mailarchive.ietf.org/arch/msg/ntp/CKV3XU2N5ub7YG_yu1CKu2-Gvl4>
Subject: Re: [Ntp] CLOCK_TAI (was NTPv5: big picture)
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: Wed, 06 Jan 2021 22:50:30 -0000

On Mon, Jan 4, 2021 at 7:40 PM Philip Prindeville <
philipp@redfish-solutions.com> wrote:
<chop>
> > The details of how various implementations choose to do things is really
> > not what the protocol should go into, but it is good that the protocol
> > and details is done so the implementation becomes feasible. Wither the
> > kernel use TAI only or can handle various time-scales in parallel is in
> > my mind to very much degree an implementation detail.
>
>
> It’s as relevant as it’s ever (always) been: the implementations are in
theory to be written “blind” with only the proposed RFC to guide the
developers.  If the RFC isn’t sufficiently clear for at least 3
implementations to converge on a common interpretation, then it’s not
adequately explained.
>
> I’m not talking about TAI being what the kernel uses; I’ve been talking
about the on-the-wire canonical representation of time.
>
>
> > There Linux and
> > BSD can make different approaches with various benefits, and this is why
> > you want at least two implementations, with assumed different
> > implementation decisions, to bring it up on the standard track so that
> > you learned something. There are many ways to implement things, and not
> > all involve even the kernel to be involved at all. So, I think the
> > discussion about how the kernel handling things in itself is not the NTP
> > WG issue, other than showing it's feasible to do. If we agree that it's
> > feasible, we move on.
>
>
> That’s not what I was saying at all.  It was pointed out that the kernel
uses UTC internally.
>
> I replied pointing out that (1) it doesn’t matter what the kernel uses
internally if applications can get whatever time they need through run-time
support (i.e. libraries like libc) and (2) internally the Linux kernel at
least (and I figure most POSIX compliant kernels) are capable of
maintaining multiple timescales.  As long as whatever the clock runs in
natively can be converted unambiguously into any other format, it doesn’t
matter which is used.

Unfortunately that is not the cas: the usual time functions return Unix
time, which loses information compared to UTC, and therefore cannot be
translated into TAI.  ntp_adjtime seems to be the best candidate from a
portability perspective but may only be callable by privileged processes
even when trying to read the current time. It also can't be used when
software or hardware timestamping of packets is being used since the
structure that is returned from those functions is a timespec, which
doesn't have a leap second indicator.

When discussing hardware the situation is somewhat better as network cards
use PTP which distributes TAI, and some have support for stamping with it.

The other problem is that in kernel steering can introduce stability issues
compared to userspace steering as Miroslav demonstrated for us some time
ago.

Sincerely,
Watson Ladd