Daemon News Ezine BSD News BSD Mall BSD Support Forum BSD Advocacy BSD Updates

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

[Patch] ports/rtc Timing will be inaccurate, please increase kern.hz



This is a long standing problem that has confused many users and
I could find at least 1 post in 2004 that stated the fix but didnt
provide a patch.

Users are confused by this diagnostic message more than they are
helped because it is printing the -current- value of HZ, not the
value requested.  This is caused by the order of things in the code,
we clober the sc->var.freq value because it is too large before
we print the diagnostic saying what value was too large....

Very simple fix, move the clober to be after the printf.

sysctl -a | grep hz
kern.clockrate: { hz = 200, tick = 5000, profhz = 1024, stathz = 128 }

Before PATCH:
rtc: 200 > kern.hz: Timing will be inaccurate, please increase kern.hz.
After PATCH:
rtc: 256 > kern.hz: Timing will be inaccurate, please increase kern.hz.

The request made by vmware was infact 256 in both cases.

--- files/rtc.c.orig	Tue Nov 29 07:43:43 2005
+++ files/rtc.c	Thu Jan 26 04:45:32 2006
@@ -269,8 +269,8 @@
 		}
 		sc->var.freq = freq;
 		if ((sc->var.freq > hz) && (hz < 1000)) {
-			sc->var.freq = hz;
 			printf("rtc: %d > kern.hz: Timing will be inaccurate, please increase kern.hz.\n", sc->var.freq);
+			sc->var.freq = hz;
 		}
 		sleep = hz / sc->var.freq;
 		DLog(Linfo, "Set RTC freq %d", sc->var.freq);


-- 
Rod Grimes                                                 freebsd@xxxxxxxxxxx