Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 25 Nov 2017 22:09:06 +1100 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        Ian Lepore <ian@freebsd.org>
Cc:        Bruce Evans <brde@optusnet.com.au>, Devin Teske <devin@shxd.cx>,  rgrimes@freebsd.org, cem@freebsd.org,  Emmanuel Vadot <manu@bidouilliste.com>,  src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org,  svn-src-head@freebsd.org
Subject:   Re: svn commit: r326095 - head/usr.sbin/bsdinstall/scripts
Message-ID:  <20171125201623.J1236@besplex.bde.org>
In-Reply-To: <1511539000.94268.17.camel@freebsd.org>
References:  <201711231729.vANHTVmo092083@pdx.rh.CN85.dnsmgr.net>  <F94B65A7-D2AA-47FB-90C4-439DDFDD1AC7@shxd.cx> <20171124201621.K980@besplex.bde.org> <1511539000.94268.17.camel@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 24 Nov 2017, Ian Lepore wrote:

> On Fri, 2017-11-24 at 22:25 +1100, Bruce Evans wrote:
>> On Thu, 23 Nov 2017, Devin Teske wrote:
>> [...]
>>
>> ntpdate's man page claims this, but is wrong AFAIK.=A0 It says that the
>> functionality of ntpdate is now available in ntpd(8) using -q.=A0 Howeve=
r
>> ntpdate -q is far from having equivalent functionality.=A0 According to =
both
>> testing of the old version and its current man page, it does the same sl=
ow
>> syncing as normal ntpd startup, and just exits after this and doesn't
>> daemonize while doing this.=A0 With the old version, this step takes 35-=
40
>> seconds starting with the time already synced to withing a few microseco=
nds
>> (by a previous invocation of ntpd), while ntpdate syncs (perhaps not so
>> well) with a server half the world away in about 1 second.
>
> Ahh, the good ol' days, when ntpdate was fast by default. =A0Not
> anymore...
>
> unicorn# time ntpdate ntp.hippie.lan
> 24 Nov 15:21:31 ntpdate[734]: adjust time server [...] offset -0.000123 s=
ec
> 0.013u 0.006s 0:06.13 0.1%=A0=A0=A0=A0=A0=A0192+420k 0+0io 0pf+0w
>
> If you want the fast old sub-second behavior these days, you have to
> add -p1. =A0Or, better yet, use sntp -r <server>.

The default of -p4 hasn't changed, but its speed has.  I get the following
times for ntpdate -q -pN:
- old ntpdate -p1 0.31 seconds      (my system -> US server ping latency 18=
0ms)
-             -p2 0.52
-             -p3 0.83
-             -p4 0.95 (default for -p)
- new ntpdate -p1 0.37 seconds      (freefall -> same US server)
-             -p2 2.39
-             -p3 4.36
-             -p4 6.36 (default)
- old ntpdate -p8 0.10 (max for -p) (my system -> localhost ping lat 0.014 =
ms)
- new ntpdate -p8 fail              (freefall -> localhost ping lat 0.060 m=
s)
- old ntpdate -p8 0.10              (my LAN -> my system ping lat 0.120 ms)
- new ntpdate -pN same as US server (freefall -> freebsd server ping lat 80=
 ms)
- old ntpdate -p8 0.24              (my system -> ISP server ping lat 12 ms=
)

This shows that old ntpdate -pN takes approximately the ping latency times =
N.
New ntpdate takes that for N =3D 1; otherwise it takes almost 2 seconds for
each increment of N.  ktrace shows many sleeps of 100 msec between
sendto/recvfrom pairs.

> I'm not sure where you're coming up with numbers like "35 seconds" for
> ntpd to initially step the clock. =A0The version we're currently
> distributing in base takes the same 6-7 seconds as ntpdate (assuming
> you've used 'iburst' in ntp.conf). =A0That's true in the normal startup
> case, or when doing ntpd -qG to mimic ntpdate.

This is for old ntpd [-q] with iburst maxpoll 6, to the ISP server.  To
the LAN server, ntpd -q takes the same 35 seconds.  Normal startup with
ntpd -N high takes about the same time.

The examples in /etc/defaults/rc.conf don't give a hint about the -p flag
for ntpdate or the -N flag for ntpd.  Low -p values are probably good
enough for ntpdate before ntpd.

> If there is an ntpd.drift file, ntpd is essentially sync'd as soon as
> it steps.

If the drift file is correct.

I do have a correct drift file, and the above times are with it.  With
a correct driftfile and ntpdate before ntpd, ntpd is essentially synced
as soon as it starts :-).  When calibrating it manually, I verify this
by killing it soon after it starts and observing drift using ntpdate -q.

> If there is not, it does a clock step, then does 300 seconds
> of frequency training during which the clock can drift pretty far off-
> time. =A0It used to be possible to shorten the frequency training
> interval with the 'tinker stepout' command, but the ntpd folks
> decoupled that (always inapproriately overloaded) behavior between
> stepout interval and training interval. =A0There is no longer any way to
> control the training interval at all, which IMO is a serious regression
> in ntpd (albeit noticed primarily by those of us who DO have an atomic
> clock and get a microsecond-accurate measurement of frequency drift in
> just 2 seconds).

Is there any use for ntp as a client if you have an atomic clock?  Just to
validate both it and ntpd?

Bruce
From owner-svn-src-head@freebsd.org  Sat Nov 25 15:14:42 2017
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 71A17DE7CA3;
 Sat, 25 Nov 2017 15:14:42 +0000 (UTC)
 (envelope-from kevans@FreeBSD.org)
Received: from repo.freebsd.org (repo.freebsd.org
 [IPv6:2610:1c1:1:6068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 48B3663361;
 Sat, 25 Nov 2017 15:14:42 +0000 (UTC)
 (envelope-from kevans@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vAPFEfbN080391;
 Sat, 25 Nov 2017 15:14:41 GMT (envelope-from kevans@FreeBSD.org)
Received: (from kevans@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id vAPFEfPI080387;
 Sat, 25 Nov 2017 15:14:41 GMT (envelope-from kevans@FreeBSD.org)
Message-Id: <201711251514.vAPFEfPI080387@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: kevans set sender to
 kevans@FreeBSD.org using -f
From: Kyle Evans <kevans@FreeBSD.org>
Date: Sat, 25 Nov 2017 15:14:41 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r326190 - in head/sys/arm/allwinner: a83t clkng
X-SVN-Group: head
X-SVN-Commit-Author: kevans
X-SVN-Commit-Paths: in head/sys/arm/allwinner: a83t clkng
X-SVN-Commit-Revision: 326190
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>;
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 25 Nov 2017 15:14:42 -0000

Author: kevans
Date: Sat Nov 25 15:14:40 2017
New Revision: 326190
URL: https://svnweb.freebsd.org/changeset/base/326190

Log:
  Add r-ccu support for the Allwinner a83t
  
  The r-ccu on the a83t differs from the others only by what it names the
  ar100 parents. Export the _CCU macros (now converted to an enu) so that
  ccu_sun8i_r can differentiate between a83t r-ccu and the others, then add
  the compat string for the a83t r-ccu.
  
  Reviewed by:	manu
  Approved by:	emaste (mentor, implicit)
  Differential Revision:	https://reviews.freebsd.org/D13206

Modified:
  head/sys/arm/allwinner/a83t/files.a83t
  head/sys/arm/allwinner/clkng/aw_ccung.c
  head/sys/arm/allwinner/clkng/aw_ccung.h
  head/sys/arm/allwinner/clkng/ccu_sun8i_r.c

Modified: head/sys/arm/allwinner/a83t/files.a83t
==============================================================================
--- head/sys/arm/allwinner/a83t/files.a83t	Sat Nov 25 14:51:40 2017	(r326189)
+++ head/sys/arm/allwinner/a83t/files.a83t	Sat Nov 25 15:14:40 2017	(r326190)
@@ -1,5 +1,6 @@
 # $FreeBSD$
 
 arm/allwinner/clkng/ccu_a83t.c		standard
+arm/allwinner/clkng/ccu_sun8i_r.c	standard
 arm/allwinner/a83t/a83t_padconf.c	standard
 arm/allwinner/a83t/a83t_r_padconf.c	standard

Modified: head/sys/arm/allwinner/clkng/aw_ccung.c
==============================================================================
--- head/sys/arm/allwinner/clkng/aw_ccung.c	Sat Nov 25 14:51:40 2017	(r326189)
+++ head/sys/arm/allwinner/clkng/aw_ccung.c	Sat Nov 25 15:14:40 2017	(r326190)
@@ -78,6 +78,7 @@ __FBSDID("$FreeBSD$");
 
 #if defined(SOC_ALLWINNER_A83T)
 #include <arm/allwinner/clkng/ccu_a83t.h>
+#include <arm/allwinner/clkng/ccu_sun8i_r.h>
 #endif
 
 #include "clkdev_if.h"
@@ -88,28 +89,6 @@ static struct resource_spec aw_ccung_spec[] = {
 	{ -1, 0 }
 };
 
-#if defined(SOC_ALLWINNER_H3) || defined(SOC_ALLWINNER_H5)
-#define	H3_CCU		1
-#define	H3_R_CCU	2
-#endif
-
-#if defined(SOC_ALLWINNER_A31)
-#define	A31_CCU		3
-#endif
-
-#if defined(SOC_ALLWINNER_A64)
-#define	A64_CCU		4
-#define	A64_R_CCU	5
-#endif
-
-#if defined(SOC_ALLWINNER_A13)
-#define	A13_CCU		6
-#endif
-
-#if defined(SOC_ALLWINNER_A83T)
-#define	A83T_CCU	7
-#endif
-
 static struct ofw_compat_data compat_data[] = {
 #if defined(SOC_ALLWINNER_A31)
 	{ "allwinner,sun5i-a13-ccu", A13_CCU},
@@ -127,6 +106,7 @@ static struct ofw_compat_data compat_data[] = {
 #endif
 #if defined(SOC_ALLWINNER_A83T)
 	{ "allwinner,sun8i-a83t-ccu", A83T_CCU },
+	{ "allwinner,sun8i-a83t-r-ccu", A83T_R_CCU },
 #endif
 	{NULL, 0 }
 };
@@ -373,6 +353,9 @@ aw_ccung_attach(device_t dev)
 #if defined(SOC_ALLWINNER_A83T)
 	case A83T_CCU:
 		ccu_a83t_register_clocks(sc);
+		break;
+	case A83T_R_CCU:
+		ccu_sun8i_r_register_clocks(sc);
 		break;
 #endif
 	}

Modified: head/sys/arm/allwinner/clkng/aw_ccung.h
==============================================================================
--- head/sys/arm/allwinner/clkng/aw_ccung.h	Sat Nov 25 14:51:40 2017	(r326189)
+++ head/sys/arm/allwinner/clkng/aw_ccung.h	Sat Nov 25 15:14:40 2017	(r326190)
@@ -29,6 +29,17 @@
 #ifndef __CCU_NG_H__
 #define __CCU_NG_H__
 
+enum aw_ccung_type {
+	H3_CCU = 1,
+	H3_R_CCU,
+	A31_CCU,
+	A64_CCU,
+	A64_R_CCU,
+	A13_CCU,
+	A83T_CCU,
+	A83T_R_CCU,
+};
+
 struct aw_ccung_softc {
 	device_t		dev;
 	struct resource		*res;

Modified: head/sys/arm/allwinner/clkng/ccu_sun8i_r.c
==============================================================================
--- head/sys/arm/allwinner/clkng/ccu_sun8i_r.c	Sat Nov 25 14:51:40 2017	(r326189)
+++ head/sys/arm/allwinner/clkng/ccu_sun8i_r.c	Sat Nov 25 15:14:40 2017	(r326190)
@@ -70,6 +70,7 @@ static struct aw_ccung_gate ccu_sun8i_r_gates[] = {
 };
 
 static const char *ar100_parents[] = {"osc32k", "osc24M", "pll_periph0", "iosc"};
+static const char *a83t_ar100_parents[] = {"osc16M-d512", "osc24M", "pll_periph", "osc16M"};
 PREDIV_CLK(ar100_clk, CLK_AR100,				/* id */
     "ar100", ar100_parents,					/* name, parents */
     0x00,							/* offset */
@@ -77,6 +78,13 @@ PREDIV_CLK(ar100_clk, CLK_AR100,				/* id */
     4, 2, 0, AW_CLK_FACTOR_POWER_OF_TWO,			/* div */
     8, 5, 0, AW_CLK_FACTOR_HAS_COND,				/* prediv */
     16, 2, 2);							/* prediv condition */
+PREDIV_CLK(a83t_ar100_clk, CLK_AR100,				/* id */
+    "ar100", a83t_ar100_parents,				/* name, parents */
+    0x00,							/* offset */
+    16, 2,							/* mux */
+    4, 2, 0, AW_CLK_FACTOR_POWER_OF_TWO,			/* div */
+    8, 5, 0, AW_CLK_FACTOR_HAS_COND,				/* prediv */
+    16, 2, 2);							/* prediv condition */
 
 static const char *ahb0_parents[] = {"ar100"};
 FIXED_CLK(ahb0_clk,
@@ -96,10 +104,14 @@ DIV_CLK(apb0_clk,
     0, 2,			/* shift, width */
     0, NULL);			/* flags, div table */
 
-static struct aw_clk_prediv_mux_def *prediv_mux_clks[] = {
+static struct aw_clk_prediv_mux_def *r_ccu_prediv_mux_clks[] = {
 	&ar100_clk,
 };
 
+static struct aw_clk_prediv_mux_def *a83t_r_ccu_prediv_mux_clks[] = {
+	&a83t_ar100_clk,
+};
+
 static struct clk_div_def *div_clks[] = {
 	&apb0_clk,
 };
@@ -112,11 +124,18 @@ void
 ccu_sun8i_r_register_clocks(struct aw_ccung_softc *sc)
 {
 	int i;
+	struct aw_clk_prediv_mux_def **prediv_mux_clks;
 
 	sc->resets = ccu_sun8i_r_resets;
 	sc->nresets = nitems(ccu_sun8i_r_resets);
 	sc->gates = ccu_sun8i_r_gates;
 	sc->ngates = nitems(ccu_sun8i_r_gates);
+
+	/* a83t names the parents differently than the others */
+	if (sc->type == A83T_R_CCU)
+		prediv_mux_clks = a83t_r_ccu_prediv_mux_clks;
+	else
+		prediv_mux_clks = r_ccu_prediv_mux_clks;
 
 	for (i = 0; i < nitems(prediv_mux_clks); i++)
 		aw_clk_prediv_mux_register(sc->clkdom, prediv_mux_clks[i]);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20171125201623.J1236>