Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Jul 2010 23:47:23 +0300
From:      Alexander Motin <mav@FreeBSD.org>
To:        Rob Farmer <rfarmer@predatorlabs.net>
Cc:        current <current@freebsd.org>
Subject:   Re: Clock not moving in virtual machine
Message-ID:  <4C40C55B.8040508@FreeBSD.org>
In-Reply-To: <AANLkTilCKUtVEiViEN_EoCMGl7KvryVXEd-sWuxFjzsS@mail.gmail.com>
References:  <mailpost.1279239004.5520450.26216.mailing.freebsd.current@FreeBSD.cs.nctu.edu.tw>	<4C3FFD3F.7060909@FreeBSD.org> <AANLkTilCKUtVEiViEN_EoCMGl7KvryVXEd-sWuxFjzsS@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Rob Farmer wrote:
>>> @@ -81,7 +81,10 @@
>>>  ppc0: Generic chipset (NIBBLE-only) in COMPATIBLE mode
>>>  ppc0: [ITHREAD]
>>>  ppbus0: <Parallel port bus> on ppc0
>>> -atrtc0: <AT Real Time Clock> at port 0x70 irq 8 on isa0
>>> +atrtc0: <AT realtime clock> at port 0x70 irq 8 on isa0
>>> +atrtc0: [FILTER]
>>> +Event timer "RTC" frequency 32768 Hz quality 0
>>> +Starting kernel event timers: LAPIC @ 200Hz, RTC @ 128Hz
>>>  Timecounters tick every 5.000 msec
>> Everything seems reasonable there. Try to collect more information:
>> sysctl kern.timecounter
>> sysctl kern.eventtimer
>> vmstat -ia
>> systat -vm 1 (presence and frequencies of interrupts)
>>
>> It could be a bug in emulation of some timers or bug in respective timer
>> driver, which was not triggered before last changes. You may try switch
>> to different timecounter by setting kern.timecounter.hardware, or
>> different eventtimers by setting kern.eventtimer.timer1 and
>> kern.eventtimer.timer2 sysctls.
> 
> This is all on the new (not-working) kernel in single user mode:
> 
> # sysctl kern.timecounter
> kern.timecounter.tick: 1
> kern.timecounter.choice: TSC(-100) dummy(-1000000)
> kern.timecounter.hardware: dummy
> kern.timecounter.stepwarnings: 0
> kern.timecounter.tc.TSC.mask: 4294967295
> kern.timecounter.tc.TSC.counter: 205772785
> kern.timecounter.tc.TSC.frequency: 2261052646
> kern.timecounter.tc.TSC.quality: -100
> kern.timecounter.smp_tsc: 0
> kern.timecounter.invariant_tsc: 1
> 
> kern.timecounter.tc.TSC.counter changes everytime (205772785,
> 3200717147, 1205899870, ...) but I can't see any pattern.

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.

Previously you were using i8254 timecounter, but now you lost it as your
virtual machine PnP BIOS doesn't announce it. QEMU does the same, but
instead it gives HPET which your emulator seems also doesn't. To force
i8254 presence add to the /boot/device.hints lines:
hint.attimer.0.at="isa"
hint.attimer.0.port="0x40"
hint.attimer.0.irq="0"

-- 
Alexander Motin



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