Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 17 Jul 2010 00:20:47 +0300
From:      Alexander Motin <mav@FreeBSD.org>
To:        Bruce Cran <brucec@muon.cran.org.uk>
Cc:        Rob Farmer <rfarmer@predatorlabs.net>, current <current@freebsd.org>
Subject:   Re: Clock not moving in virtual machine
Message-ID:  <4C40CD2F.6050604@FreeBSD.org>
In-Reply-To: <20100716210500.GA13257@muon.cran.org.uk>
References:  <mailpost.1279239004.5520450.26216.mailing.freebsd.current@FreeBSD.cs.nctu.edu.tw> <4C3FFD3F.7060909@FreeBSD.org> <AANLkTilCKUtVEiViEN_EoCMGl7KvryVXEd-sWuxFjzsS@mail.gmail.com> <4C40C55B.8040508@FreeBSD.org> <20100716210500.GA13257@muon.cran.org.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4C40CD2F.6050604>