Subject: time warps in 1.6H
To: None <port-i386@netbsd.org>
From: David Laight <david@l8s.co.uk>
List: port-i386
Date: 10/09/2002 23:32:59
I've just updated to a 1.6I kernel, during bootup a diagnostic
I have to detect time warps in mi_switch fired:

Oct  9 23:01:00 snowdrop /netbsd: readclock: 1034200850 (1034200771)
Oct  9 23:01:00 snowdrop /netbsd: root file system type: ffs
Oct  9 23:01:00 snowdrop /netbsd: mi_switch: -ve interval was 1034200850.030000 is 1034200850.022244
Oct  9 23:01:00 snowdrop /netbsd: IP Filter: v3.4.29 initialized.  Default = pass all, Logging = enabled

(the readclock trace is also not standard!)

The test is (at the top of mi_switch):

	/*
	 * Compute the amount of time during which the current
	 * process was running.
	 */
	microtime(&tv);
	us = (tv.tv_usec - spc->spc_runtime.tv_usec)
			+ (tv.tv_sec - spc->spc_runtime.tv_sec) * 1000000ll;
	if (us & (1ull<<63)) {
		/* something is terribly wrong.... */
		printf("mi_switch: -ve interval was %ld.%.6ld is %ld.%.6ld\n",
			spc->spc_runtime.tv_sec, spc->spc_runtime.tv_usec,
			tv.tv_sec, tv.tv_usec );
		us = 0;
	}

This hasn't happened on every boot.
Maybe it happens before all the process execution times are reset?
The 'us = 0' will stop my kernel generating -ve execution times.

I presume this is something to do with the new microtime()
code for i386 pentium (and later) systems.

	David

-- 
David Laight: david@l8s.co.uk