From owner-freebsd-current@FreeBSD.ORG Fri Jul 16 21:21:55 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 38D691065687 for ; Fri, 16 Jul 2010 21:21:55 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-fx0-f54.google.com (mail-fx0-f54.google.com [209.85.161.54]) by mx1.freebsd.org (Postfix) with ESMTP id B64C58FC13 for ; Fri, 16 Jul 2010 21:21:54 +0000 (UTC) Received: by fxm13 with SMTP id 13so1494699fxm.13 for ; Fri, 16 Jul 2010 14:21:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :x-enigmail-version:content-type:content-transfer-encoding; bh=zjsyjUukhVWIe17C6m+Ymqt6dTYHOL9FeNCu3X7CJxQ=; b=Mg2p+6jfDnLiOKPzILetx4F85RIalq6KqVdJmLVXSswxNxaJKeIssHCfIfyfUJHqTh 01t7uuybb0/dbg6gU5kl3aAfkPJIzV2LicRJm3zSvXi0bMlja1A0qboEjrmTe8xR3lXK ylcUg+Nis2i2VuqPM5WRXms6L8/WpOvfonAHg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; b=XB6dyF71BcErBv21gySiEfzLyrlgamkRGNTF1UN6fr9GQMbHVcjoQpAGUtHqWxJu/u YqXKVsKEAqCfA7i9rp+uD9U3jXqU0NUaFLoCX06hNzcG723k+NlUmB6p84iY7svVqjIi 7RYGW4u39xPZ+PFNXqjLKJ0EUkAafM+gOmL6A= Received: by 10.223.113.12 with SMTP id y12mr1145575fap.36.1279315313502; Fri, 16 Jul 2010 14:21:53 -0700 (PDT) Received: from mavbook2.mavhome.dp.ua (pc.mavhome.dp.ua [212.86.226.226]) by mx.google.com with ESMTPS id e20sm332616fak.23.2010.07.16.14.21.51 (version=SSLv3 cipher=RC4-MD5); Fri, 16 Jul 2010 14:21:52 -0700 (PDT) Sender: Alexander Motin Message-ID: <4C40CD2F.6050604@FreeBSD.org> Date: Sat, 17 Jul 2010 00:20:47 +0300 From: Alexander Motin User-Agent: Thunderbird 2.0.0.23 (X11/20091212) MIME-Version: 1.0 To: Bruce Cran References: <4C3FFD3F.7060909@FreeBSD.org> <4C40C55B.8040508@FreeBSD.org> <20100716210500.GA13257@muon.cran.org.uk> In-Reply-To: <20100716210500.GA13257@muon.cran.org.uk> X-Enigmail-Version: 0.96.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Rob Farmer , 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:21:55 -0000 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? I have no idea about TSC in XEN, but QEMU just passes TSC from the physical CPU. So if host' TSCs are not synchronized - value may jump accidentally when QEMU process migrates between CPUs. > Should I still switch back to using the i8254? I would say it depends. i8254 frequency is always known, while TSC depends on calibration. Calibration on virtual machine I think much less precise then on physical. Same time, if i8254 also used as event timer, timestamp calculation algorithm is not very trivial there and I am not sure it is absolutely reliable. So I would probably used i8254 as time counter and LAPIC+RTC as event timers. -- Alexander Motin