From owner-freebsd-cloud@freebsd.org Thu Jan 19 02:26:21 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 0C13ECB7425 for ; Thu, 19 Jan 2017 02:26:21 +0000 (UTC) (envelope-from dg@syrec.org) Received: from mail-vk0-x22c.google.com (mail-vk0-x22c.google.com [IPv6:2607:f8b0:400c:c05::22c]) (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 C7B4714E2 for ; Thu, 19 Jan 2017 02:26:20 +0000 (UTC) (envelope-from dg@syrec.org) Received: by mail-vk0-x22c.google.com with SMTP id x75so20862335vke.2 for ; Wed, 18 Jan 2017 18:26:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=syrec.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=ybWpb6TjmPCBTis+3ly2fjOX4X6Kl/8aS1CwkFi11ew=; b=hugSrnTjBHY8/Sz2U7mjeRxyib7NMw/cPidhL2uF4dZnF/LRe2+OYbBxd0Uhi6UZIe UMtiiUClz7DFmll04jDyx7u52A5k4sHkf8lel6oQWwL0qZ9R5wPIDnuuKMgMdb96ICNJ 3NZkNV0lVKhWudpwNNhwwLS5LjX/o7khJPbS2I6WLWU/0t1/fDWxyDUBGK1715XrePjq ehtQp/nZjy1H3bjhg/yOWV5KuCJzDjTeCBdxz/VDhleMyupWAeeXOQkO/WmBEpt+uQy6 GuF7s6UHYa/Ey1NSaYYOWFGu6sYDSz1lU8stVWQnATr7jGV0jrovif+91OZ0GxxMTgty Yqhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=ybWpb6TjmPCBTis+3ly2fjOX4X6Kl/8aS1CwkFi11ew=; b=dFDUxklOdN1K2/zX7GxBxlW9yzruC2P/XJ6oCzbG601gJNN4IHjDImzpiOT6J/BAAQ dW/dZwmIAD19rcZ6964PPmJdsy5HG87G6PwzeYYtFlP9HHC4ZeZeM0gOuza6XsMxvpd0 BFPlS0JttNS8oZ+WdJj7ihX7flghLuPSyIG7LlhRk2vGNMr4JiTCyMJmjVW37y3SlJIE QQ26OiDYpmZoYsvj7Sr1mzsJwqu73w0YaY9mu4mI7UdIDSgsHidpXU5Au1esgnbrXPo9 ketxPQMipVneDN60k4fj4JmTPeSuAvT6lfxYEFmKITVDI4T4YTrKD7FN7GNW/V4VCJPJ Uz4w== X-Gm-Message-State: AIkVDXL+GE37nbxiskcaa9SPICm8D5mtUkCAqH7oQVpeLMJHH3wDIXpbpQRC4y/0JIrUfCqedrurih59hRpSHt1p X-Received: by 10.31.186.131 with SMTP id k125mr3268151vkf.147.1484792779855; Wed, 18 Jan 2017 18:26:19 -0800 (PST) MIME-Version: 1.0 Received: by 10.176.69.133 with HTTP; Wed, 18 Jan 2017 18:26:19 -0800 (PST) X-Originating-IP: [186.43.234.8] In-Reply-To: References: From: Dmitri Goutnik Date: Wed, 18 Jan 2017 21:26:19 -0500 Message-ID: Subject: Re: GCE: significant clock drift - the solution To: Bruce Walker Cc: 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 02:26:21 -0000 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 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" >