PDA

View Full Version : Time runs at double rate - HW-clock is OK


Erratus
December 11th, 2008, 01:24
When system starts FreeBSD gets the right time from hardware-clock (BIOS).

When 10 minutes passed the FreeBSD date shows 20 minutes passed
after 1 hour passed FreeBSD shows 2 hours passed.
Next reboot shows same again.

Am I right, that ntpd is NOT the problem? Have no cue how to fix that.

-Erratus


FreeBSD 6.4-RELEASE #0: Wed Nov 26 11:43:51 UTC 2008
root@dessler.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC
Timecounter "i8254" frequency 1193182 Hz quality 0
CPU: AMD-K6(tm) 3D processor (551.25-MHz 586-class CPU)
Origin = "AuthenticAMD" Id = 0x58c Stepping = 12
Features=0x8021bf<FPU,VME,DE,PSE,TSC,MSR,MCE,CX8,PGE,MMX>
AMD Features=0x80000800<SYSCALL,3DNow!>
real memory = 402636800 (383 MB)
avail memory = 380309504 (362 MB)
kbd1 at kbdmux0
K6-family MTRR support enabled (2 registers)
ath_hal: 0.9.20.3 (AR5210, AR5211, AR5212, RF5111, RF5112, RF2413, RF5413)
hptrr: HPT RocketRAID controller driver v1.1 (Nov 26 2008 11:41:19)
acpi0: <ASUS P5A-B> on motherboard
acpi0: Power Button (fixed)
Timecounter "ACPI-safe" frequency 3579545 Hz quality 850
acpi_timer0: <24-bit timer at 3.579545MHz> port 0xec08-0xec0b on acpi0
...
snip

Maledictus
December 11th, 2008, 08:14
Please post dmesg | grep -i time and sysctl kern.timecounter.
From the above it seems like your Motherboard is kindof bogus, as the kernel chose ACPI-safe, which already is a fallback.

Erratus
December 11th, 2008, 15:54
# dmesg | grep -i time
Timecounter "i8254" frequency 1193182 Hz quality 0
Timecounter "ACPI-safe" frequency 3579545 Hz quality 850
acpi_timer0: <24-bit timer at 3.579545MHz> port 0xec08-0xec0b on acpi0
pmtimer0 on isa0
Timecounter "TSC" frequency 551250867 Hz quality 800
Timecounters tick every 1.000 msec

# sysctl kern.timecounter
kern.timecounter.stepwarnings: 0
kern.timecounter.nbinuptime: 475772
kern.timecounter.nnanouptime: 0
kern.timecounter.nmicrouptime: 874
kern.timecounter.nbintime: 1637
kern.timecounter.nnanotime: 33
kern.timecounter.nmicrotime: 1604
kern.timecounter.ngetbinuptime: 504
kern.timecounter.ngetnanouptime: 113
kern.timecounter.ngetmicrouptime: 36818
kern.timecounter.ngetbintime: 0
kern.timecounter.ngetnanotime: 0
kern.timecounter.ngetmicrotime: 143460
kern.timecounter.nsetclock: 3
kern.timecounter.hardware: ACPI-safe
kern.timecounter.choice: TSC(800) ACPI-safe(850) i8254(0) dummy(-1000000)
kern.timecounter.tick: 1

Maledictus
December 11th, 2008, 16:01
Try using another timecounter like this:
kern.timecounter.hardware=TSC
in /boot/loader.conf
I think you can use TSC as your CPU does not support changing it's frequency. If you notice something odd try to set it to i8254. This is the slowest method but maybe your only choice.

Ole
December 11th, 2008, 16:02
Do you try other OS on this machine? For example try booting to Linux from some LiveCD and look for clock behaviour

Erratus
December 11th, 2008, 16:33
kern.timecounter.hardware=TSC

appended to /boot/loader.conf shows no difference. Was TSC not used before, as dmesg showed Timecounter "TSC" frequency 551250867 Hz quality 800?

Have to mention that a minimal install option was opted during installation. Maybe ACPI support was not added?

@Ole: no clock problems on former XP installation (erased).

Maledictus
December 11th, 2008, 16:36
ACPI is always there. Please show the sysctl again with the stuff in loader.conf

Maledictus
December 11th, 2008, 16:39
sysctl kern.timecounter.hardware=TSC

You can even change it at runtime like this.

Erratus
December 11th, 2008, 16:48
# vi /boot/loader.conf
autoboot_delay="3"
kern.timecounter.hardware=TSC

# sysctl kern.timecounter
kern.timecounter.stepwarnings: 0
kern.timecounter.nbinuptime: 998663
kern.timecounter.nnanouptime: 0
kern.timecounter.nmicrouptime: 906
kern.timecounter.nbintime: 1980
kern.timecounter.nnanotime: 33
kern.timecounter.nmicrotime: 1947
kern.timecounter.ngetbinuptime: 503
kern.timecounter.ngetnanouptime: 161
kern.timecounter.ngetmicrouptime: 51240
kern.timecounter.ngetbintime: 0
kern.timecounter.ngetnanotime: 0
kern.timecounter.ngetmicrotime: 197407
kern.timecounter.nsetclock: 3
kern.timecounter.hardware: ACPI-safe
kern.timecounter.choice: TSC(800) ACPI-safe(850) i8254(0) dummy(-1000000)
kern.timecounter.tick: 1

richardpl
December 11th, 2008, 17:04
You did not changed anything, reboot if you do not know how to use sysctl

Erratus
December 11th, 2008, 17:08
You did not changed anything, reboot if you do not know how to use sysctl

Be sure, that system was rebooted before writing the reply :)

Erratus
December 11th, 2008, 17:46
You did not changed anything, reboot if you do not know how to use sysctl

# sysctl kern.timecounter.hardware=TSC
kern.timecounter.hardware: ACPI-safe -> TSC

This solves clock problem!

But after reboot kern.timecounter.hardware is again ACPI-safe.

The entry in /boot/loader.conf does not help to make the change permanent.

anomie
December 11th, 2008, 18:07
@Erratus: You need to set this sysctl MIB in /etc/sysctl.conf to make it permanent.

Erratus
December 11th, 2008, 18:09
/boot/loader.conf is not the place to edit.

append

kern.timecounter.hardware=TSC

to /etc/sysctl.conf does the job.


Thanks to Maledictus and richardpl for fast helping!

Maledictus
December 11th, 2008, 18:17
You are welcome :)