Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Jan 2017 20:10:21 -0500
From:      Bruce Walker <bruce.walker@gmail.com>
To:        freebsd-cloud@freebsd.org
Subject:   GCE: significant clock drift - the solution
Message-ID:  <CAJUU0CcAbxijE--e3iM0bVbAT9D0gbu7kERkX%2BR2dGBjgsoN-w@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
Hi gang, first message. I am developing on Google Cloud Engine, I'm using
the FreeBSD community image, and so far it's been pretty painless. Thank
you!

But I noticed that the system clock on one of my two instances was drifting
fast over time, and I mean really fast. I estimate about 1 second ahead for
every 20-30 seconds of elapsed time.

So I would stop and restart ntpd and that would reset the time. Then the
creep again ...

Long story short: I searched the Google gce-discussion group and found
another FreeBSD user with the same issue, and a solution was provided by
one Andy Carrel. In a nutshell two system boot files need tweaks:

/boot/loader.conf
    machdep.disable_tsc_calibration=1
    kern.timecounter.invariant_tsc=1

/etc/sysctl.conf
    kern.timecounter.hardware=TSC-low

Andy further explains: "The loader.conf changes instruct the kernel to not
try to do calibration of the TSC, since this calibration could give bad
results due to the virtualization, and to ignore the fact that the
"invariant TSC" feature is not advertised by the CPU and just assume the
CPU has this feature.

The sysctl.conf change instructs the kernel to use the TSC-low timecounter
which was made available by the loader.conf changes."

For reference, here's a link to the posting:
https://groups.google.com/forum/#!msg/gce-discussion/NKhl1QOVucQ/EDyLd_FxCAAJ


Maybe these can make it back into the community cloud image.

-- 
-bmw



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJUU0CcAbxijE--e3iM0bVbAT9D0gbu7kERkX%2BR2dGBjgsoN-w>