From owner-freebsd-cloud@freebsd.org Thu Jan 19 04:04:56 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 DBD71CB7BC8 for ; Thu, 19 Jan 2017 04:04:56 +0000 (UTC) (envelope-from bilbo@hobbiton.org) Received: from mail-wm0-x22b.google.com (mail-wm0-x22b.google.com [IPv6:2a00:1450:400c:c09::22b]) (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 9108D1A08 for ; Thu, 19 Jan 2017 04:04:56 +0000 (UTC) (envelope-from bilbo@hobbiton.org) Received: by mail-wm0-x22b.google.com with SMTP id r144so57618441wme.1 for ; Wed, 18 Jan 2017 20:04:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hobbiton-org.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=ChgHc86Yymy8MVTJJpTM4vk1NTg7RGc9iNoTMlC7GIk=; b=PCojr78piW5l+zH202hxeAeF8SqNXA0rxBSCS4ab4fZ0FTqi1Rvt2eBzI1OWeTNPsx 6WHvXaaOP2l1KlZ5AM+aFYNcoN8FYlEliNuNJLtqOUr3uoYb3spvFHTZRVfXMck+N1hW x5ERzVeezblf36FkngNTbIUD5G8fN+jT1VX36ApIyehM1e9XGAytSo21zbun7M9gZDTb Z5Sk9wtj6wKFJZ3GlkP1+9n8rxhp50ozI7dFQFlEC22cuYRzsNFbt7O+1R1OcR3+dBC/ zoSO33VDj4aIfjGjKmtIIV3m7jdD+koZxBx4iEeoUEByFu59tME9O9ETXH9IMwcJIu5S yI2g== 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=ChgHc86Yymy8MVTJJpTM4vk1NTg7RGc9iNoTMlC7GIk=; b=H99f/x/HO2eTapO6wmaJNbT3IgvIXj3xKM7mwGjLizGJ8xAYc1OgWV3qssqUyXOSuE p65Yh8dx9zkTj1sBUb6m4yZROTXzqgNiER13PHGzWIElhwTsd5VEMvfwolUEDSYAKubO omBOXqYPQ+PqgJkmFmb+BXX3HZ4JB7BaEYQ9XYSt7MwNaM7imZ3bue+PrD+NErbJKTkn l+wreQeSAqhMJbFAJKLvVROV2mdoCaAemmZFo6gzlzuUgC1cDSOE8DZVouz8DaxyyMIB kbBINXDDz3QCPH9JyeUMvCUxkB20wFyFIdSMc3rDvhObq+deiD8lzoa6yT4mEjtscHBo HHSw== X-Gm-Message-State: AIkVDXKQAy+iPPc0KBpIdLDSRgHTXEZ6hUi+kUZj4F5GyAPMw1BfMWXdEjq4oNOeWao/3dVO1i9ju+5Uzokbyw== X-Received: by 10.28.56.133 with SMTP id f127mr134003wma.126.1484798694301; Wed, 18 Jan 2017 20:04:54 -0800 (PST) MIME-Version: 1.0 Received: by 10.28.28.68 with HTTP; Wed, 18 Jan 2017 20:04:53 -0800 (PST) X-Originating-IP: [208.72.151.19] Received: by 10.28.28.68 with HTTP; Wed, 18 Jan 2017 20:04:53 -0800 (PST) In-Reply-To: References: From: Leif Pedersen Date: Wed, 18 Jan 2017 22:04:53 -0600 Message-ID: Subject: Re: GCE: significant clock drift - the solution To: Dmitri Goutnik Cc: freebsd-cloud@freebsd.org, Bruce Walker 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 04:04:57 -0000 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" 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 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"