Subject: Uptime(1) brocken (was: Re: HEADS UP: timecounters (branch simonb-timecounters) merged into -current)
To: Frank Kardel <kardel@netbsd.org>
From: Arnaud Lacombe <lists-netbsd@sigfpe.info>
List: current-users
Date: 06/15/2006 11:17:28
On Thu, Jun 08, 2006 at 01:10:26AM +0200, Frank Kardel wrote:
> The FreeBSD implementation of Poul-Henning Kamp's timecounters
> was ported and committed to NetBSD-current.
> 
> Timecounters will be supported on a per port basis. With
> the commit following ports make use of timecounters:
>    i386
>    amd64
>    sparc
>    sparc64
> 
> [...]
> Please test NetBSD-current so we can smoke out bugs early.
> 

After the correction of the bug which prevented my laptop to boot, I
rebuild a kernel on May 12th and booted it. Now, when I type 'uptime',
it is returning the wrong value:

the kernel was booted on May 12th:
% ls -l /netbsd-raw /var/run/dmesg.boot
-rwxr-xr-x  1 root  wheel  5509160 Jun 12 05:17 /netbsd-raw
-rw-r--r--  1 root  wheel  16368 Jun 12 05:18 /var/run/dmesg.boot

% sysctl -a | grep boot
kern.boottime = Wed Jun 14 05:39:48 2006
machdep.booted_kernel = netbsd-raw

It can't have rebooted since as I need to enter the name of the kernel
manually (default: /netbsd, booted: /netbsd-raw)

here is the value returned by uptime(1) yesterday before I put it into
sleep mode:

% uptime
 4:50AM  up 23:10, 5 users, load averages: 0.18, 0.13, 0.09

and here is the value after I wake it up this morning:

% uptime
12:40PM  up 23:12, 6 users, load averages: 0.17, 0.13, 0.09

In fact, this laptop is into sleep mode almost every night and also
during the day when I don't use it. Latest kernel behave the same way:

% uname -a
NetBSD nog 3.99.21 NetBSD 3.99.21 (NOG) #1: Thu Jun 15 10:53:52 CEST 2006 i386

[Thu 15 Jun 2006 11:05:40 CEST] % uptime
11:02AM  up 1 min, 1 user, load averages: 0.34, 0.15, 0.06

[ ... sleep for 5 minutes ...]

Thu 15 Jun 2006 11:07:08 CEST % uptime
11:07PM  up 2 mins, 1 user, load averages: 0.27, 0.15, 0.06

relevant part of the dmesg are:
% dmesg | grep time
attimer0 at isa0 port 0x40-0x43: AT Timer
pcppi0: attached to attimer0
timecounter: Timecounters tick every 10.000 msec
timecounter: Timecounter "i8254" frequency 1193182 Hz quality 100
timecounter: selected timecounter "i8254" frequency 1193182 Hz quality 100
attimer0 at isa0 port 0x40-0x43: AT Timer
pcppi0: attached to attimer0
timecounter: Timecounter "TSC" frequency 697482260 Hz quality 800
timecounter: selected timecounter "TSC" frequency 697482260 Hz quality 800
timecounter: Timecounter "clockinterrupt" frequency 100 Hz quality 0

% sysctl -a | grep timecounter
kern.timecounter.choice = clockinterrupt(q=0, f=100 Hz) TSC(q=800, f=697491150 Hz) i8254(q=100, f=1193182 Hz) dummy(q=-1000000, f=1000000 Hz)
kern.timecounter.hardware = TSC
kern.timecounter.timestepwarnings = 0

regards,

Arnaud