Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Jan 2017 21:26:19 -0500
From:      Dmitri Goutnik <dg@syrec.org>
To:        Bruce Walker <bruce.walker@gmail.com>
Cc:        freebsd-cloud@freebsd.org
Subject:   Re: GCE: significant clock drift - the solution
Message-ID:  <CA%2BoHHn1rb2w601ySxw0iiJqyndaiaiai%2BKJJwKAWBkHLQXZ7Uw@mail.gmail.com>
In-Reply-To: <CAJUU0CcAbxijE--e3iM0bVbAT9D0gbu7kERkX%2BR2dGBjgsoN-w@mail.gmail.com>
References:  <CAJUU0CcAbxijE--e3iM0bVbAT9D0gbu7kERkX%2BR2dGBjgsoN-w@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi Bruce,

Thanks for posting this, setting machdep.disable_tsc_calibration=1 indeed
makes TSC-low available and fixes the clock drift.

The confusing thing is that timecounter choices vary with GCE hardware and
the only common choice seems to be low "quality" i8254.

On Wed, Jan 18, 2017 at 8:10 PM, Bruce Walker <bruce.walker@gmail.com>
wrote:

> 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
> _______________________________________________
> freebsd-cloud@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-cloud
> To unsubscribe, send any mail to "freebsd-cloud-unsubscribe@freebsd.org"
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CA%2BoHHn1rb2w601ySxw0iiJqyndaiaiai%2BKJJwKAWBkHLQXZ7Uw>