Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 16 Mar 2003 22:07:07 +1100 (EST)
From:      Tim Robbins <tim@robbins.dropbear.id.au>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   kern/50045: Kernel threads and init have incorrect start time
Message-ID:  <200303161107.h2GB7712084189@dilbert.robbins.dropbear.id.au>

next in thread | raw e-mail | index | archive | help

>Number:         50045
>Category:       kern
>Synopsis:       Kernel threads and init have incorrect start time
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Mar 16 03:10:06 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     Tim Robbins
>Release:        FreeBSD 5.0-RELEASE
>Organization:
The FreeBSD Project
>Environment:
System: FreeBSD 5.0-RELEASE

	
>Description:
The start time, as shown by ps -aux, is incorrect for kernel threads and
init. The times are shown as January 1, 1970, instead of the system boot
time.
>How-To-Repeat:
ps -aux
>Fix:

The problem seems to occur because inittodr() is not called early
enough. I think revision 1.888 of init_main.c is the culprit:

revision 1.188
date: 2002/03/08 10:33:11;  author: phk;  state: Exp;  lines: +2 -0
Move the mount of the root filesystem to happen in the init process before
the exec if /sbin/init.

This allows the scheduler to get started and kthreads a chance to run
before we start filesystem operations.

This patch makes the start times for kernel threads + init as correct as
they are on RELENG_4 by calling inittodr() from inittimecounter().
It has only been tested on i386.

Index: kern_tc.c
===================================================================
RCS file: /x/freebsd/src/sys/kern/kern_tc.c,v
retrieving revision 1.145
diff -u -r1.145 kern_tc.c
--- kern_tc.c	16 Jan 2003 20:06:45 -0000	1.145
+++ kern_tc.c	17 Jan 2003 11:45:07 -0000
@@ -692,6 +692,9 @@
 	/* warm up new timecounter (again) and get rolling. */
 	(void)timecounter->tc_get_timecount(timecounter);
 	(void)timecounter->tc_get_timecount(timecounter);
+
+	/* Initialise the time of day register. */
+	inittodr(0);
 }
 
 SYSINIT(timecounter, SI_SUB_CLOCKS, SI_ORDER_SECOND, inittimecounter, NULL)
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200303161107.h2GB7712084189>