Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Jan 2017 22:04:53 -0600
From:      Leif Pedersen <bilbo@hobbiton.org>
To:        Dmitri Goutnik <dg@syrec.org>
Cc:        freebsd-cloud@freebsd.org, Bruce Walker <bruce.walker@gmail.com>
Subject:   Re: GCE: significant clock drift - the solution
Message-ID:  <CAK-wPOiRMr%2BpbpTLJ63-j=HD9tTq3QiGnj3HQpgMK4y2Xu2sRQ@mail.gmail.com>
In-Reply-To: <CA%2BoHHn1rb2w601ySxw0iiJqyndaiaiai%2BKJJwKAWBkHLQXZ7Uw@mail.gmail.com>
References:  <CAJUU0CcAbxijE--e3iM0bVbAT9D0gbu7kERkX%2BR2dGBjgsoN-w@mail.gmail.com> <CA%2BoHHn1rb2w601ySxw0iiJqyndaiaiai%2BKJJwKAWBkHLQXZ7Uw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
I wanna say it was i8254 that I had the weird trouble with, but I can't
remember for sure.

It's my experience as well that much of this seems to vary over time and
with different VMs.

-Leif


On Jan 18, 2017 8:26 PM, "Dmitri Goutnik" <dg@syrec.org> wrote:

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"
>
_______________________________________________
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?CAK-wPOiRMr%2BpbpTLJ63-j=HD9tTq3QiGnj3HQpgMK4y2Xu2sRQ>