NetBSD Problem Report #47982
From www@NetBSD.org Mon Jul 1 18:07:25 2013
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
(Client CN "mail.NetBSD.org", Issuer "Postmaster NetBSD.org" (verified OK))
by mollari.NetBSD.org (Postfix) with ESMTPS id BA0FF712BD
for <gnats-bugs@gnats.NetBSD.org>; Mon, 1 Jul 2013 18:07:25 +0000 (UTC)
Message-Id: <20130701180724.19396716C6@mollari.NetBSD.org>
Date: Mon, 1 Jul 2013 18:07:24 +0000 (UTC)
From: m.ramakers@gmail.com
Reply-To: m.ramakers@gmail.com
To: gnats-bugs@NetBSD.org
Subject: system time deviation after disabling CPU core(s) when using TSC timecounter
X-Send-Pr-Version: www-1.0
>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.
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.