Subject: Re: time runs at 1/5th speed
To: Frank Kardel <kardel@netbsd.org>
From: Martti Kuparinen <martti.kuparinen@iki.fi>
List: current-users
Date: 09/02/2006 12:41:29
 > > For i386, amd64, sparc, sparc64 and prep the time keeping code has been
 > > changed to
 > > FreeBSD's timecounters. Could you send me the /var/run/dmesg.boot file
 > > and the output
 > > of "sysctl kern.timecounter" ? There might be something different
 > > depending on which
 > > counter is picked and what counter frequency is assumed.

VMware 3.2 on Linux, NetBSD 4beta. Full dmesg.boot is below.

     # sysctl kern.timecounter
     kern.timecounter.choice = clockinterrupt(q=0, f=100 Hz) TSC(q=-100, 
f=1813623160 Hz) piixpm0(q=1000, f=3579545 Hz) i8254(q=100, f=1193182 Hz) 
dummy(q=-1000000, f=1000000 Hz)
     # sysctl -w kern.timecounter.hardware=i8254
     kern.timecounter.hardware: piixpm0 -> i8254

This makes "sleep 1" consistent with system time.

     # while :
     > do
     > date
     > sleep 1
     > done
     Fri Sep  1 16:23:53 EDT 2006
     Fri Sep  1 16:23:54 EDT 2006
     Fri Sep  1 16:23:55 EDT 2006
     ^C
     #

With piixpm0, "sleep 1" is correct but system time is 30+ times
too slow.

     # while :
     > do
     > date
     > sleep 1
     > done
     Fri Sep  1 16:27:38 EDT 2006
     Fri Sep  1 16:27:38 EDT 2006
     Fri Sep  1 16:27:38 EDT 2006
     Fri Sep  1 16:27:38 EDT 2006
     Fri Sep  1 16:27:38 EDT 2006
     Fri Sep  1 16:27:38 EDT 2006
     Fri Sep  1 16:27:38 EDT 2006
     Fri Sep  1 16:27:38 EDT 2006
     Fri Sep  1 16:27:38 EDT 2006
     Fri Sep  1 16:27:38 EDT 2006
     Fri Sep  1 16:27:38 EDT 2006
     Fri Sep  1 16:27:38 EDT 2006
     Fri Sep  1 16:27:38 EDT 2006
     Fri Sep  1 16:27:38 EDT 2006
     Fri Sep  1 16:27:38 EDT 2006
     Fri Sep  1 16:27:38 EDT 2006
     Fri Sep  1 16:27:38 EDT 2006
     Fri Sep  1 16:27:38 EDT 2006
     Fri Sep  1 16:27:38 EDT 2006
     Fri Sep  1 16:27:38 EDT 2006
     Fri Sep  1 16:27:38 EDT 2006
     Fri Sep  1 16:27:38 EDT 2006
     Fri Sep  1 16:27:38 EDT 2006
     Fri Sep  1 16:27:38 EDT 2006
     Fri Sep  1 16:27:38 EDT 2006
     Fri Sep  1 16:27:38 EDT 2006
     Fri Sep  1 16:27:38 EDT 2006
     Fri Sep  1 16:27:38 EDT 2006
     Fri Sep  1 16:27:39 EDT 2006
     Fri Sep  1 16:27:39 EDT 2006
     ^C
     #

dmesg.boot is attached below.

	Wietse

Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
     The NetBSD Foundation, Inc.  All rights reserved.
Copyright (c) 1982, 1986, 1989, 1991, 1993
     The Regents of the University of California.  All rights reserved.

NetBSD 4.0_BETA (GENERIC) #0: Thu Aug 24 06:00:32 UTC 2006
	builds@b0.netbsd.org:/home/builds/ab/netbsd-4/i386/200608230000Z-obj/home/builds/ab/netbsd-4/src/sys/arch/i386/compile/GENERIC
total memory = 255 MB
avail memory = 242 MB
timecounter: Timecounters tick every 10.000 msec
timecounter: Timecounter "i8254" frequency 1193182 Hz quality 100
timecounter: selected timecounter "i8254" frequency 1193182 Hz quality 100
BIOS32 rev. 0 found at 0xfd860
mainbus0 (root)
cpu0 at mainbus0: (uniprocessor)
cpu0: Intel Pentium 4 (686-class), 1801.42 MHz, id 0xf27
cpu0: features bfebf9ff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,SEP,MTRR>
cpu0: features bfebf9ff<PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX>
cpu0: features bfebf9ff<FXSR,SSE,SSE2,SS,HTT,TM,SBF>
cpu0: features2 4400<CID,xTPR>
cpu0: "Intel(R) Pentium(R) 4 CPU 1.80GHz"
cpu0: I-cache 12K uOp cache 8-way, D-cache 8 KB 64B/line 4-way
cpu0: L2 cache 512 KB 64B/line 8-way
cpu0: ITLB 4K/4M: 128 entries
cpu0: DTLB 4K/4M: 64 entries
cpu0: enabling thermal monitor 1 ... failed!
cpu0: failed to enable thermal monitoring!
cpu0: 16 page colors
pci0 at mainbus0 bus 0: configuration mode 1
pci0: i/o space, memory space enabled, rd/line, rd/mult, wr/inv ok
pchb0 at pci0 dev 0 function 0
pchb0: Intel 82443BX Host Bridge/Controller (AGP disabled) (rev. 0x01)
pchb0: fixing Idle/Pipeline DRAM Leadoff Timing
piixpcib0 at pci0 dev 7 function 0
piixpcib0: Intel 82371AB (PIIX4) PCI-ISA Bridge (rev. 0x08)
piixpcib0: SpeedStep SMI enabled
piixide0 at pci0 dev 7 function 1
piixide0: Intel 82371AB IDE controller (PIIX4) (rev. 0x01)
piixide0: bus-master DMA support present
piixide0: primary channel configured to compatibility mode
piixide0: primary channel interrupting at irq 14
atabus0 at piixide0 channel 0
piixide0: secondary channel configured to compatibility mode
piixide0: secondary channel interrupting at irq 15
atabus1 at piixide0 channel 1
uhci0 at pci0 dev 7 function 2: Intel 82371AB (PIIX4) USB Host Controller (rev. 
0x00)
uhci0: interrupting at irq 9
usb0 at uhci0: USB revision 1.0
uhub0 at usb0
uhub0: Intel UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub0: 2 ports with 2 removable, self powered
piixpm0 at pci0 dev 7 function 3: Power Management Controller
timecounter: Timecounter "piixpm0" frequency 3579545 Hz quality 1000
timecounter: selected timecounter "piixpm0" frequency 3579545 Hz quality 1000
piixpm0 24-bit timer
piixpm0: SMBus disabled
vga1 at pci0 dev 15 function 0: VMware Virtual SVGA II (rev. 0x00)
wsdisplay0 at vga1 kbdmux 1: console (80x25, vt100 emulation)
wsmux1: connecting to wsdisplay0
pcn0 at pci0 dev 16 function 0: AMD PCnet-PCI Ethernet
pcn0: Am79c970A PCnet-PCI II rev 0, Ethernet address 00:50:56:40:00:56
pcn0: interrupting at irq 9
pcn0: 10base5, 10base5-FDX, 10baseT, 10baseT-FDX, auto, auto-FDX
isa0 at piixpcib0
com0 at isa0 port 0x3f8-0x3ff irq 4: ns16550a, working fifo
com1 at isa0 port 0x2f8-0x2ff irq 3: ns16550a, working fifo
com2 at isa0 port 0x3e8-0x3ef irq 5: ns16550a, working fifo
pckbc0 at isa0 port 0x60-0x64
pckbd0 at pckbc0 (kbd slot)
pckbc0: using irq 1 for kbd slot
wskbd0 at pckbd0: console keyboard, using wsdisplay0
pms0 at pckbc0 (aux slot)
pckbc0: using irq 12 for aux slot
wsmouse0 at pms0 mux 0
attimer0 at isa0 port 0x40-0x43: AT Timer
pcppi0 at isa0 port 0x61
midi0 at pcppi0: PC speaker (CPU-intensive output)
sysbeep0 at pcppi0
isapnp0 at isa0 port 0x279: ISA Plug 'n Play device support
npx0 at isa0 port 0xf0-0xff
npx0: using exception 16
fdc0 at isa0 port 0x3f0-0x3f7 irq 6 drq 2
pcppi0: attached to attimer0
isapnp0: no ISA Plug 'n Play devices found
timecounter: Timecounter "clockinterrupt" frequency 100 Hz quality 0
fd0 at fdc0 drive 0: 1.44MB, 80 cyl, 2 head, 18 sec
Kernelized RAIDframe activated
wd0 at atabus0 drive 0: <VMware Virtual IDE Hard Drive>
wd0: drive supports 64-sector PIO transfers, LBA addressing
wd0: 4000 MB, 8669 cyl, 15 head, 63 sec, 512 bytes/sect x 8192205 sectors
wd0: 32-bit data port
wd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 2 (Ultra/33)
wd0(piixide0:0:0): using PIO mode 4, Ultra-DMA mode 2 (Ultra/33) (using DMA)
atapibus0 at atabus1: 2 targets
cd0 at atapibus0 drive 0: <VMware Virtual IDE CDROM Drive, 1000000000000000000, 
0000000> cdrom removable
cd0: 32-bit data port
cd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 2 (Ultra/33)
cd0(piixide0:1:0): using PIO mode 4, Ultra-DMA mode 2 (Ultra/33) (using DMA)
boot device: wd0
root on wd0a dumps on wd0b
root file system type: ffs
wsdisplay0: screen 1 added (80x25, vt100 emulation)
wsdisplay0: screen 2 added (80x25, vt100 emulation)
wsdisplay0: screen 3 added (80x25, vt100 emulation)
wsdisplay0: screen 4 added (80x25, vt100 emulation)