From owner-cvs-all Wed Oct 13 22:48:41 1999 Delivered-To: cvs-all@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id CF5C514C59; Wed, 13 Oct 1999 22:48:34 -0700 (PDT) (envelope-from bde@zeta.org.au) Received: from d154.syd2.zeta.org.au (beefcake.zeta.org.au [203.26.10.12]) by mailman.zeta.org.au (8.8.7/8.8.7) with ESMTP id PAA07701; Thu, 14 Oct 1999 15:51:06 +1000 Date: Thu, 14 Oct 1999 15:48:20 +1000 (EST) From: Bruce Evans X-Sender: bde@alphplex.bde.org To: Andrew Gallatin Cc: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/alpha/alpha clock.c interrupt.c In-Reply-To: <14341.21686.357856.650246@grasshopper.cs.duke.edu> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk On Thu, 14 Oct 1999, Andrew Gallatin wrote: > Bruce Evans writes: > > > > This mainly weakens the statclock to hide bugs. The most obvious bug is > > Yes. > > > that _BSD_CLOCKS_PER_SEC_ was broken on alphas (is 100 but needed to be > > 1024 if hz was 1024). It seems to be still broken (is 100 but needs to > > be 128 if stathz is 128). However, _BSD_CLOCKS_PER_SEC_ only affects > > little-used userland interfaces (e.g, clock(3) and times(3)), so the main > > So little used that I really wasn't aware of them. Both _BSD_CLK_TCK_ > and _BSD_CLOCKS_PER_SEC_ should be changed to 128 if stathz == 128, correct? Oops, I forgot that these numbers are nominal. The actual stathz frequency is given by the kern.clockrate sysctl. The only reason to make these numbers the same as statz is to hide bugs in naive programs that assume that these numbers have anything to do with a physical clock or even a kernel virtual clock. The numbers are only used to scale the values returned by times() and clock(), respectively. Making the numbers the same as stathz also reduces loss of precision in times() and clock(), but not scaling would be a better way to do this. (The kernel converts from statclock ticks to microseconds, losing a little information if not precision; times() and clock() convert from microseconds to another sort of clock ticks, losing a lot of precision.) times() and clock() are rarely used because they are not the BSD way and they lose precision. > > bug must be elsewhere. I think there are scaling bugs in schedcpu(), and > > NetBSD has fixed them. These bugs may affect all systems with realstathz > > != 100. > > There's a nice commit message detailing what was done at > http://cvsweb.netbsd.org/cgi-bin/cvsweb.cgi/syssrc/sys/kern/kern_synch.c > > Maybe somebody who's familiar enough with schedcpu to make sense of it > could take a look at what they've done.. I will do this if no one else does it first. I don't think I will have time until after freebsdcon. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message