From owner-freebsd-cloud@freebsd.org Thu Jan 19 01:10:23 2017 Return-Path: Delivered-To: freebsd-cloud@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 E38D0CB62B9 for ; Thu, 19 Jan 2017 01:10:23 +0000 (UTC) (envelope-from bruce.walker@gmail.com) Received: from mail-oi0-x231.google.com (mail-oi0-x231.google.com [IPv6:2607:f8b0:4003:c06::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A7F66189C for ; Thu, 19 Jan 2017 01:10:23 +0000 (UTC) (envelope-from bruce.walker@gmail.com) Received: by mail-oi0-x231.google.com with SMTP id w204so16867683oiw.0 for ; Wed, 18 Jan 2017 17:10:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=NtG4grGv9zPvo0T8CeoNrGCBP0pOEmG/MjQjiqShmG0=; b=MKOzd7t7673AfQUkhGXpv8OTxKpuTMoT8Vk21wOr9BeTUcIpR7NAhjVTnw7C6GyrHx h5dT6P81Xk5L9BwL1k4HfyfL7gVzrx7YkynpJ/IuRMvwJxDgxuwNcDPyNfBzMXzvNMqZ ri32nmHFFN7gz5Z8+RuXRciWvhjedbbXV4h+S2hnNrYJv9emjNT/czZCQomYuyXqJKM8 Dbwipz8jzXAwQuEFr+BnZiLCAM0mMf2vlNZN6kOixvcjPOzTj4Ym64LfoE2YzRRqxILr VHhHvfZ730bJxZNHNtsL1mes2bb7FphuUGDME1KP1vb/lx0XYgS64bT0ybrCJcoBk9c4 aNKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=NtG4grGv9zPvo0T8CeoNrGCBP0pOEmG/MjQjiqShmG0=; b=dsoNXBP+qiVll7OJu9DBYp0eaIRuD3hsmwy74NvFRv1i4+I6j1cxNsIWwrkuJxD0B9 kE/Mvx4rk5F5za4HYbPZzhEGeiJ7Qj4zmiNtyhxaUOr+9JOaj3yXsPWuxnVKwTU5M4eV ktu+k2IsxDsM1CmX0ywo4qPzZEuu3r/uExpqKN9ANWNrUM0+DsypiLf6ZSo0aTMD6kX0 cvpO79fnVWKXTMVSHWabKDwb1xwz6ALi0rbDpsqegZ/il2lbhj710sRZ92Gw2T7dEXmV ZY1oICMKgoxjAZVNipBZ+7IQuZuUyTH7j2jb6J0uWHB2Sdibn94o2GPAM2mLjIlpHIaf pRrQ== X-Gm-Message-State: AIkVDXLur0DwEGvr7C1/WqP8Ya1WAz6phSTcGYVlffgBPuoqNlbuoRjSbXWB6UiPXG/WzBuYCKo38DtGMrqB2w== X-Received: by 10.202.73.78 with SMTP id w75mr2811923oia.19.1484788222708; Wed, 18 Jan 2017 17:10:22 -0800 (PST) MIME-Version: 1.0 Received: by 10.182.129.136 with HTTP; Wed, 18 Jan 2017 17:10:21 -0800 (PST) From: Bruce Walker Date: Wed, 18 Jan 2017 20:10:21 -0500 Message-ID: Subject: GCE: significant clock drift - the solution To: freebsd-cloud@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: freebsd-cloud@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "FreeBSD on cloud platforms \(EC2, GCE, Azure, etc.\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Jan 2017 01:10:24 -0000 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