Re: [chrony-dev] [PATCH] macOS - support for ntp_adjtime()

[ Thread Index | Date Index | More chrony.tuxfamily.org/chrony-dev Archives ]


Hi Miroslov
There is a new release of macOS 10.13 out today but as yet no fix for the adjtime() issue.

> On 11/07/2017, at 2:49 AM, Miroslav Lichvar <mlichvar@xxxxxxxxxx> wrote:
> 
> Is it really 5000 ppm on macOS 10.13? There is a testing program
> test/kernel/adjtime, which should print the maximum slew rate. You
> may need to modify it to try a larger offset than 1 second. On an
> older macOS it was 42000 ppm.
> 
> I like that you reused the FreeBSD/NetBSD driver, but if adjtime()
> behaves differently, then maybe it would be better to duplicate the
> fast-slewing functionality in the macOS driver instead.

I ran the adjtime test on macOS 10.13. The skew results were surprising and appear to me to be the same as what you have on FreeBSD/NetBSD. Quite different from macOS 10.12 and earlier. It looks as though Apple have moved the FreeBSD implementation directly into their kernel (and made a signed/unsigned error at the same time).

I think we should stick with calling the netbsd driver from the macOS driver.

sierra-beta:chronycontrol bryan$ sysctl -a|grep kern.clock
kern.clockrate: { hz = 100, tick = 10000, tickadj = 2, profhz = 100, stathz = 100 }


From <sys/timex.h>
/*
 * The following defines establish the performance envelope of the
 * kernel discipline loop. Phase or frequency errors greater than
 * NAXPHASE or MAXFREQ are clamped to these maxima. For update intervals
 * less than MINSEC, the loop always operates in PLL mode; while, for
 * update intervals greater than MAXSEC, the loop always operates in FLL
 * mode. Between these two limits the operating mode is selected by the
 * STA_FLL bit in the status word.
 */

#define MAXPHASE        500000000L      /* max phase error (ns) */
#define MAXFREQ         500000L         /* max freq error (ns/s) */
#define MINSEC          256             /* min FLL update interval (s) */
#define MAXSEC          2048            /* max PLL update interval (s) */
#define NANOSECOND      1000000000L     /* nanoseconds in one second */
#define SCALE_PPM       (65536 / 1000)  /* crude ns/s to scaled PPM */
#define MAXTC           10              /* max time constant */


test/kernel/adjtime

range:
                   0 s : ok
                  -1 s : ok
                   1 s : ok
                  -2 s : ok
                   3 s : ok
                  -4 s : ok
                   7 s : ok
                  -8 s : ok
                  15 s : ok
                 -16 s : ok
                  31 s : ok
                 -32 s : ok
                  63 s : ok
                 -64 s : ok
                 127 s : ok
                -128 s : ok
                 255 s : ok
                -256 s : ok
                 511 s : ok
                -512 s : ok
                1023 s : ok
               -1024 s : ok
                2047 s : ok
               -2048 s : ok
                4095 s : ok
               -4096 s : ok
                8191 s : ok
               -8192 s : ok
               16383 s : ok
              -16384 s : ok
               32767 s : ok
              -32768 s : ok
               65535 s : ok
              -65536 s : ok
              131071 s : ok
             -131072 s : ok
              262143 s : ok
             -262144 s : ok
              524287 s : ok
             -524288 s : ok
             1048575 s : ok
            -1048576 s : ok
             2097151 s : ok
            -2097152 s : ok
             4194303 s : ok
            -4194304 s : ok
             8388607 s : ok
            -8388608 s : ok
            16777215 s : ok
           -16777216 s : ok
            33554431 s : ok
           -33554432 s : ok
            67108863 s : ok
           -67108864 s : ok
           134217727 s : ok
          -134217728 s : ok
           268435455 s : ok
          -268435456 s : ok
           536870911 s : ok
          -536870912 s : ok
          1073741823 s : ok
         -1073741824 s : ok
          2147483647 s : ok
         -2147483648 s : ok
          4294967295 s : ok
         -4294967296 s : ok
          8589934591 s : ok
         -8589934592 s : ok
         17179869183 s : ok
        -17179869184 s : ok
         34359738367 s : ok
        -34359738368 s : ok
         68719476735 s : ok
        -68719476736 s : ok
        137438953471 s : ok
       -137438953472 s : ok
        274877906943 s : ok
       -274877906944 s : ok
        549755813887 s : ok
       -549755813888 s : ok
       1099511627775 s : ok
      -1099511627776 s : ok
       2199023255551 s : ok
      -2199023255552 s : ok
       4398046511103 s : ok
      -4398046511104 s : ok
       8796093022207 s : ok
      -8796093022208 s : ok
      17592186044415 s : ok
     -17592186044416 s : ok
      35184372088831 s : ok
     -35184372088832 s : ok
      70368744177663 s : ok
     -70368744177664 s : ok
     140737488355327 s : ok
    -140737488355328 s : ok
     281474976710655 s : ok
    -281474976710656 s : ok
     562949953421311 s : ok
    -562949953421312 s : ok
    1125899906842623 s : ok
   -1125899906842624 s : ok
    2251799813685247 s : ok
   -2251799813685248 s : ok
    4503599627370495 s : ok
   -4503599627370496 s : ok
    9007199254740991 s : ok
   -9007199254740992 s : ok
   18014398509481983 s : ok
  -18014398509481984 s : ok
   36028797018963967 s : ok
  -36028797018963968 s : ok
   72057594037927935 s : ok
  -72057594037927936 s : ok
  144115188075855871 s : ok
 -144115188075855872 s : ok
  288230376151711743 s : ok
 -288230376151711744 s : ok
  576460752303423487 s : ok
 -576460752303423488 s : ok
 1152921504606846975 s : ok
-1152921504606846976 s : ok
 2305843009213693951 s : ok
-2305843009213693952 s : ok
 4611686018427387903 s : ok
-4611686018427387904 s : ok
 9223372036854775807 s : ok
-9223372036854775808 s : ok
readonly:
        1 us : adjtime() failed : Bad address fail
        2 us : adjtime() failed : Bad address fail
        4 us : adjtime() failed : Bad address fail
        8 us : adjtime() failed : Bad address fail
       16 us : adjtime() failed : Bad address fail
       32 us : adjtime() failed : Bad address fail
       64 us : adjtime() failed : Bad address fail
      128 us : adjtime() failed : Bad address fail
      256 us : adjtime() failed : Bad address fail
      512 us : adjtime() failed : Bad address fail
     1024 us : adjtime() failed : Bad address fail
     2048 us : adjtime() failed : Bad address fail
     4096 us : adjtime() failed : Bad address fail
     8192 us : adjtime() failed : Bad address fail
    16384 us : adjtime() failed : Bad address fail
    32768 us : adjtime() failed : Bad address fail
    65536 us : adjtime() failed : Bad address fail
   131072 us : adjtime() failed : Bad address fail
   262144 us : adjtime() failed : Bad address fail
   524288 us : adjtime() failed : Bad address fail
  1048576 us : adjtime() failed : Bad address fail
readwrite:
        1 us : ok
        2 us : ok
        4 us : ok
        8 us : ok
       16 us : ok
       32 us : ok
       64 us : ok
      128 us : ok
      256 us : ok
      512 us : ok
     1024 us : ok
     2048 us : ok
     4096 us : ok
     8192 us : ok
    16384 us : ok
    32768 us : ok
    65536 us : ok
   131072 us : ok
   262144 us : ok
   524288 us : ok
  1048576 us : ok
slew:
      512 us :      0 (16)     0 (256)     0 (4096)     0 (65536)     0 (1048576)
     1024 us :      0 (16)     0 (256)     0 (4096)     0 (65536)     0 (1048576)
     2048 us :      0 (16)     0 (256)     0 (4096)     0 (65536)     0 (1048576)
     4096 us :      0 (16)     0 (256)     0 (4096)     0 (65536)     0 (1048576)
     8192 us :      0 (16)     0 (256)     0 (4096)     0 (65536)     0 (1048576)
    16384 us :      0 (16)     0 (256)     0 (4096)     0 (65536)     0 (1048576)
    32768 us :      0 (16)     0 (256)     0 (4096)     0 (65536)     0 (1048576)
    65536 us :      0 (16)     0 (256)     0 (4096)     0 (65536)     0 (1048576)
   131072 us :      0 (16)     0 (256)     0 (4096)     0 (65536)     0 (1048576)
   262144 us :      0 (16)     0 (256)     0 (4096)     0 (65536)     0 (1048576)
   524288 us :      0 (16)     0 (256)     0 (4096)     0 (65536)     0 (1048576)
  1048576 us :     16 (16)   256 (256)   500 (4096)   500 (65536)  5000 (1048576)


Bryan Christianson
bryan@xxxxxxxxxxxxx




--
To unsubscribe email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "unsubscribe" in the subject.
For help email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "help" in the subject.
Trouble?  Email listmaster@xxxxxxxxxxxxxxxxxxxx.


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/