Date: Sun, 01 Mar 1998 12:44:44 -0800 From: Greg Shenaut <greg@bogslab.ucdavis.edu> To: questions@FreeBSD.ORG Subject: calcru: negative time revisited Message-ID: <199803012045.MAA24294@myrtle1.bogs.org>
next in thread | raw e-mail | index | archive | help
I get the infamous "calcru: negative time ..." message on all the machines I have installed fbsd 2.2.5 on so far, as I also did on several other versions. Doing a little investigation, I found quite a few references on the mailing list archives, but never a complete explanation of how to get rid of the messages, or of why they should be so common. I looked into the code, and found that calcru is usually merely reporting an out-of-range value returned by a routine called "microtime()", which is an assembly-language routine. Looking into microtime.s, I see a test early on in the code of the form #if defined(I596_CPU) || defined(I686_CPU) which apparently causes an alternate method to be used to read the raw timer value when the compile-time variables I585_CPU or I686_CPU are set. Now, in the GENERIC kernel configuration file, I found these lines: cpu "I386_CPU" cpu "I486_CPU" cpu "I586_CPU" cpu "I686_CPU" So all of the bases are covered, CPU-typewise. I assume, without actually looking it up, that this means that the compile-time variables matching the "cpu" lines are all defined when the kernel pieces are compiled; therefore, the alternative method of reading the timer will always be chosen, regardless of the actual CPU type. Now, I am running the GENERIC fbsd kernel on a bunch of machines in our lab which are based on 386SX, 386DX, and 486SX and DX CPUs, so it seems to me that it is at least possible that the alternate timer access routine might be causing trouble here; in any case, it seems illogical that there could be a compile-time test in the microtime() routine--either the non-586/868 code should be removed, or the test should be on a runtime CPU-type variable. I propose that if (defined(I386_CPU) || defined(I486_CPU)) && (defined(I586_CPU) || defined(I686_CPU)) then a test on the runtime cputype variable be performed (I am assuming that there actually *is* one accessible to the microtime() function). Perhaps this will fix the "negative time" error message; in any case, it will make the microtime() function more correct. -Greg To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199803012045.MAA24294>