From owner-freebsd-current@FreeBSD.ORG Fri Jul 16 21:27:50 2010 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9E361106567A; Fri, 16 Jul 2010 21:27:50 +0000 (UTC) (envelope-from rfarmer@predatorlabs.net) Received: from mail-gx0-f182.google.com (mail-gx0-f182.google.com [209.85.161.182]) by mx1.freebsd.org (Postfix) with ESMTP id D7A848FC22; Fri, 16 Jul 2010 21:27:47 +0000 (UTC) Received: by gxk24 with SMTP id 24so1895905gxk.13 for ; Fri, 16 Jul 2010 14:27:46 -0700 (PDT) MIME-Version: 1.0 Received: by 10.151.76.9 with SMTP id d9mr1951996ybl.231.1279315664851; Fri, 16 Jul 2010 14:27:44 -0700 (PDT) Received: by 10.151.109.4 with HTTP; Fri, 16 Jul 2010 14:27:44 -0700 (PDT) X-Originating-IP: [71.1.135.50] In-Reply-To: <20100716210500.GA13257@muon.cran.org.uk> References: <4C3FFD3F.7060909@FreeBSD.org> <4C40C55B.8040508@FreeBSD.org> <20100716210500.GA13257@muon.cran.org.uk> Date: Fri, 16 Jul 2010 14:27:44 -0700 Message-ID: From: Rob Farmer To: Bruce Cran Content-Type: text/plain; charset=ISO-8859-1 Cc: Alexander Motin , current Subject: Re: Clock not moving in virtual machine X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2010 21:27:50 -0000 On Fri, Jul 16, 2010 at 2:05 PM, Bruce Cran wrote: > On Fri, Jul 16, 2010 at 11:47:23PM +0300, Alexander Motin wrote: >> >> It is probably hard to see pattern due to to very high clock frequency. >> But TSC timecounter is unreliable even on real SMP systems. What it >> counts on virtual SMP - even bigger question. As system seems never uses >> timecounters with negative quality - you've left with >> kern.timecounter.hardware=dummy - that's why time is not going. As last >> resort you may try to set sysctl kern.timecounter.hardware=TSC in run time. > > I came across the same problem on rootbsd a few days ago, and set the TSC > as the timecounter in /etc/sysctl.conf - I've since found it should be > possible to also set kern.timecounter.smp_tsc=1 in /boot/loader.conf to let > the TSC be chosen. The system's now been running for a day and I've not had > any warnings about the clock going backward, and since the time has > remained correct I guess Xen synchronises with the host? Should I still > switch back to using the i8254? > > -- > Bruce Cran > Setting kern.timecounter.smp_tsc=1 works for me. I put it in /boot/loader.conf so it would automatically work for single user mode too. I don't think the host automatically synchronizes the clock - their website recommends running ntp and I saw the clock drift a fair amount before I started doing that. Thanks for the tip. -- Rob Farmer