# FreeBSD 7, runaway clock as guest OS on Microsoft Virtual Server



## sailorfej (Jan 21, 2009)

Hi Folks,

I am trying to run FreeBSD 7 on Microsoft Virtual Server 2005 R2, Windows Server 2003, on a Dell 2950.

I am having a problem with the system clock running excessively fast, I initially tried installing 7.1 release but received a nearly continuous stream of the "calcru: runtime went backward errors", I tried rolling back to 7.0, and it improved somewhat, but I still received regular "calcru" errors, and it the system clock was running to fast for ntpd to keep up with it, I set sysctl kern.timecounter.hardware to i8254 (it tries to default to ACPI-safe), which helped more, ntpd is now able to keep pace with it, but only barely, and I haven't seen any "calcru" errors yet.

From the boot time dmesg, on the CPU line, the frequency reported with in the parenthesizes varies on almost every reboot.

Are there any other adjustments I can make to get this under control?

Following are samples of sysctl values, dmesg, and a short log sample to show the time and time reset rates.

******** sysctl grep clockrate:

kern.clockrate: { hz = 1000, tick = 1000, profhz = 1024, stathz = 128 }
hw.clockrate: 1061

******** sysctl grep timecounter:

kern.timecounter.tick: 1
kern.timecounter.choice: TSC(800) ACPI-safe(850) i8254(0) dummy(-1000000)
kern.timecounter.hardware: i8254
kern.timecounter.nsetclock: 12
kern.timecounter.ngetmicrotime: 8071302
kern.timecounter.ngetnanotime: 9
kern.timecounter.ngetbintime: 0
kern.timecounter.ngetmicrouptime: 2310540
kern.timecounter.ngetnanouptime: 3870
kern.timecounter.ngetbinuptime: 237939
kern.timecounter.nmicrotime: 48722
kern.timecounter.nnanotime: 2143
kern.timecounter.nbintime: 50865
kern.timecounter.nmicrouptime: 4498
kern.timecounter.nnanouptime: 1
kern.timecounter.nbinuptime: 477504
kern.timecounter.stepwarnings: 0
kern.timecounter.tc.i8254.mask: 4294967295
kern.timecounter.tc.i8254.counter: 3077011530
kern.timecounter.tc.i8254.frequency: 1193182
kern.timecounter.tc.i8254.quality: 0
kern.timecounter.tc.ACPI-safe.mask: 16777215
kern.timecounter.tc.ACPI-safe.counter: 14993826
kern.timecounter.tc.ACPI-safe.frequency: 3579545
kern.timecounter.tc.ACPI-safe.quality: 850
kern.timecounter.tc.TSC.mask: 4294967295
kern.timecounter.tc.TSC.counter: 3664196446
kern.timecounter.tc.TSC.frequency: 1061252458
kern.timecounter.tc.TSC.quality: 800
kern.timecounter.smp_tsc: 0

********** sample log:

Jan 20 19:25:08 host ntpd[1829]: time reset -12.179675 s
Jan 20 19:25:08 host ntpd[1829]: kernel time sync disabled 6041
Jan 20 21:25:34 host ntpd[1829]: time reset -17.665523 s
Jan 20 21:25:34 host ntpd[1829]: kernel time sync enabled 2001
Jan 20 23:43:24 host ntpd[1829]: kernel time sync enabled 6001
Jan 20 23:59:15 host ntpd[1829]: time reset -67.677336 s
Jan 20 23:59:15 host ntpd[1829]: kernel time sync enabled 2001
Jan 21 00:51:31 host ntpd[1829]: kernel time sync enabled 6001
Jan 21 00:51:27 host ntpd[1829]: time reset -11.695334 s
Jan 21 00:51:27 host ntpd[1829]: kernel time sync enabled 2001

********** dmesg.boot:

Copyright (c) 1992-2008 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
   The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 7.0-RELEASE-p9 #0: Tue Jan 13 19:45:51 PST 2009
   root@host:/usr/obj/usr/src/sys/GENERIC
Timecounter "i8254" frequency 1193182 Hz quality 0
CPU: Intel(R) Xeon(R) CPU           E5320  @ 1.86GHz (1364.45-MHz 686-class CPU)
 Origin = "GenuineIntel"  Id = 0x6fb  Stepping = 11

Features=0x7c0a97b<FPU,VME,PSE,TSC,MSR,PAE,CX8,SEP,PGE,CMOV,ACPI,MMX,FXSR,SSE,SSE2>
 AMD Features2=0x1<LAHF>
 Cores per package: 4
real memory  = 536805376 (511 MB)
avail memory = 511385600 (487 MB)
kbd1 at kbdmux0
ath_hal: 0.9.20.3 (AR5210, AR5211, AR5212, RF5111, RF5112, RF2413, RF5413)
hptrr: HPT RocketRAID controller driver v1.1 (Jan 13 2009 19:45:26)
acpi0: <A M I OEMRSDT> on motherboard
acpi0: [ITHREAD]
acpi0: Power Button (fixed)
acpi0: reservation of 0, a0000 (3) failed
acpi0: reservation of 100000, 1ff00000 (3) failed
Timecounter "ACPI-safe" frequency 3579545 Hz quality 850
acpi_timer0: <24-bit timer at 3.579545MHz> port 0x408-0x40b on acpi0
pcib0: <ACPI Host-PCI bridge> port 0xcf8-0xcff on acpi0
pci0: <ACPI PCI bus> on pcib0
isab0: <PCI-ISA bridge> at device 7.0 on pci0
isa0: <ISA bus> on isab0
atapci0: <Intel PIIX4 UDMA33 controller> port 0x1f0-0x1f7,0x3f6,0x170-0x177,0x376,0xffa0-0xffaf at device 7.1 on pci0
ata0: <ATA channel 0> on atapci0
ata0: [ITHREAD]
ata1: <ATA channel 1> on atapci0
ata1: [ITHREAD]
pci0: <bridge> at device 7.3 (no driver attached)
vgapci0: <VGA-compatible display> mem 0xf8000000-0xfbffffff at device 8.0 on pci0
de0: <Digital 21140A Fast Ethernet> port 0xec00-0xec7f mem 0xfebff000-0xfebfffff irq 11 at device 10.0 on pci0
de0: 21140A [10-100Mb/s] pass 2.0
de0: using obsoleted if_watchdog interface
de0: Ethernet address: 00:03:ff:48:a7:20
de0: [ITHREAD]
atkbdc0: <Keyboard controller (i8042)> port 0x60,0x64 irq 1 on acpi0
atkbd0: <AT Keyboard> irq 1 on atkbdc0
kbd0 at atkbd0
atkbd0: [GIANT-LOCKED]
atkbd0: [ITHREAD]
psm0: <PS/2 Mouse> irq 12 on atkbdc0
psm0: [GIANT-LOCKED]
psm0: [ITHREAD]
psm0: model IntelliMouse, device ID 3
sio0: <16550A-compatible COM port> port 0x3f8-0x3ff irq 4 flags 0x10 on acpi0
sio0: type 16550A
sio0: [FILTER]
sio1: <16550A-compatible COM port> port 0x2f8-0x2ff irq 3 on acpi0
sio1: type 16550A
sio1: [FILTER]
fdc0: <floppy drive controller (FDE)> port 0x3f0-0x3f5,0x3f7 irq 6 drq 2 on acpi0
fdc0: does not respond
device_attach: fdc0 attach returned 6
fdc0: <floppy drive controller (FDE)> port 0x3f0-0x3f5,0x3f7 irq 6 drq 2 on acpi0
fdc0: does not respond
device_attach: fdc0 attach returned 6
pmtimer0 on isa0
orm0: <ISA Option ROMs> at iomem 0xc0000-0xcbfff,0xcc000-0xcc7ff pnpid ORM0000 on isa0
ppc0: <Parallel port> at port 0x378-0x37f irq 7 on isa0
ppc0: Generic chipset (EPP/NIBBLE) in COMPATIBLE mode
ppbus0: <Parallel port bus> on ppc0
ppbus0: [ITHREAD]
plip0: <PLIP network interface> on ppbus0
lpt0: <Printer> on ppbus0
lpt0: Interrupt-driven port
ppi0: <Parallel I/O> on ppbus0
ppc0: [GIANT-LOCKED]
ppc0: [ITHREAD]
sc0: <System console> at flags 0x100 on isa0
sc0: VGA <16 virtual consoles, flags=0x300>
vga0: <Generic ISA VGA> at port 0x3c0-0x3df iomem 0xa0000-0xbffff on isa0
Timecounter "TSC" frequency 1364446545 Hz quality 800
Timecounters tick every 1.000 msec
hptrr: no controller detected.
ad0: 81918MB <Virtual HD 1. 1> at ata0-master WDMA2
acd0: DVDROM <Virtual CD/> at ata1-master PIO4
Trying to mount root from ufs:/dev/ad0s1a


----------



## Lowell (Jan 21, 2009)

Try cutting down kern.hz, as recommended in the FreeBSD Handbook section on Virtual PC.


----------



## sailorfej (Jan 21, 2009)

Thanks Lowell,

I just set it, it seems to be helping, although they are still running 30 to 40 seconds fast, at least it seems like ntpd is able to keep up, just by slewing the time, instead of stepping.

I will followup after it runs for a couple of hours.


----------



## sailorfej (Jan 22, 2009)

*better and worse*

Well this helped sort of, the clocks are running only a little fast at this point (roughly seven minutes gained over 12 hours), but now for some reason, ntpd is not resetting the clocks at all, despite multiple good time sources, it was working fine before the kern.hz change.  Any reason why that would break ntpd?


----------



## anomie (Jan 22, 2009)

I've seen similar behavior running a FBSD 6.x guest on vmware server. See if the suggestion in this post helps.


----------



## sailorfej (Jan 22, 2009)

Hi Anomie,

Thanks for suggestion, unfortunately apic is already disabled.

Thanks,
Jeff


----------



## X-Istence (Jan 22, 2009)

I have the same issue with running FreeBSD within VirtualBox on an OpenSolaris host machine. I have not yet found a solution.


----------

