NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/47982: system time deviation after disabling CPU core(s) when using TSC timecounter



>Number:         47982
>Category:       kern
>Synopsis:       system time deviation after disabling CPU core(s) when using 
>TSC timecounter
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jul 01 18:10:00 +0000 2013
>Originator:     Michai Ramakers
>Release:        6.0.1
>Organization:
none
>Environment:
NetBSD lime.LAN 6.0.1 NetBSD 6.0.1 (GENERIC) amd64
>Description:
When using TSC timecounter (which was default in my case) as per 
kern.timecounter.hardware, system clock seems to deviate after running with a 
CPU core disabled for some time.

(Noticed this after clock deviated tens of seconds, even with hourly NTP sync 
as per ntodate(8).)

CPU-related dmesg output: 

--
cpu0 at mainbus0 apid 0: Intel(R) Core(TM)2 Duo CPU     E4400  @ 2.00GHz, id 
0x6fd
cpu1 at mainbus0 apid 1: Intel(R) Core(TM)2 Duo CPU     E4400  @ 2.00GHz, id 
0x6fd
--

Related sysctl values in error-situation:

--
michai@lime:~$ sysctl kern.timecounter
kern.timecounter.choice = TSC(q=3000, f=2400155200 Hz) clockinterrupt(q=0, 
f=100 Hz) hpet0(q=2000, f=14318180 Hz) ACPI-Fast(q=1000, f=3579545 Hz) 
lapic(q=-100, f=200120309 Hz) i8254(q=100, f=1193182 Hz) dummy(q=-1000000, 
f=1000000 Hz)
kern.timecounter.hardware = hpet0
kern.timecounter.timestepwarnings = 0
--


>How-To-Repeat:
# cpuctl offline 1

(I ran in this situation for days, to perform a test.)

# sysctl -w kern.timecounter.hardware=TSC
kern.timecounter.hardware: hpet0 -> TSC
# time sleep 10

real    0m8.351s
user    0m0.001s
sys     0m0.001s

(repeated attempts always show 'real' time of around 8.3 seconds in my 
situation)

# sysctl kern.timecounter.choice
kern.timecounter.choice = TSC(q=3000, f=2400155200 Hz) clockinterrupt(q=0, 
f=100 Hz) hpet0(q=2000, f=14318180 Hz) ACPI-Fast(q=1000, f=3579545 Hz) 
lapic(q=-100, f=200120309 Hz) i8254(q=100, f=1193182 Hz) dummy(q=-1000000, 
f=1000000 Hz)

# sysctl -w kern.timecounter.hardware=hpet0
kern.timecounter.hardware: hpet0 -> hpet0
# time sleep 10

real    0m10.023s
user    0m0.001s
sys     0m0.001s

(repeated attempts show a 'real' value of around 10.0x seconds; same result of 
around 10.1 seconds when choosing 'clockinterrupt' as timecounter)


>Fix:
# sysctl -w kern.timecounter.hardware=hpet0

(if available, else 'clockinterrupt' perhaps)

Perhaps choosing another default timecounter is possible on systems for which 
this makes sense.



Home | Main Index | Thread Index | Old Index