From owner-freebsd-hackers@FreeBSD.ORG Wed Feb 25 10:13:01 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6053816A4CE for ; Wed, 25 Feb 2004 10:13:01 -0800 (PST) Received: from mta6-svc.business.ntl.com (mta6-svc.business.ntl.com [62.253.164.46]) by mx1.FreeBSD.org (Postfix) with ESMTP id 91A7E43D1D for ; Wed, 25 Feb 2004 10:13:00 -0800 (PST) (envelope-from bruce@cran.org.uk) Received: from box1.cran ([82.3.86.155]) by mta6-svc.business.ntl.com (InterMail vM.4.01.03.37 201-229-121-137-20020806) with ESMTP id <20040225181259.EXLD27811.mta6-svc.business.ntl.com@box1.cran> for ; Wed, 25 Feb 2004 18:12:59 +0000 Received: from box1.cran (localhost.cran [127.0.0.1]) by box1.cran (8.12.11/8.12.10) with ESMTP id i1PICPGW000761 for ; Wed, 25 Feb 2004 18:12:25 GMT (envelope-from brucec@box1.cran) Received: (from brucec@localhost) by box1.cran (8.12.11/8.12.11/Submit) id i1PICPGV000760 for freebsd-hackers@freebsd.org; Wed, 25 Feb 2004 18:12:25 GMT (envelope-from brucec) Date: Wed, 25 Feb 2004 18:12:25 +0000 From: Bruce Cran To: freebsd-hackers@freebsd.org Message-ID: <20040225181225.GA597@box1.cran> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="LZvS9be/3tNcYl/X" Content-Disposition: inline User-Agent: Mutt/1.4.2i Subject: machdep.tsc_freq and very fast CPUs X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Feb 2004 18:13:01 -0000 --LZvS9be/3tNcYl/X Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Having heard about how Windows thought a P4 EE CPU was running at 10MHz, I decided to do a bit of poking around the FreeBSD kernel to check that all the frequencies were correctly expressed in 64-bit values. While I quickly saw that they were all u_int64_t, I was a bit worried when I saw a sizeof(u_int) in one place, even though it did seem to have a qualifier saying it was a 64-bit integer. Shouldn't machdep.tsc_freq be read-only, by changing line 147 of sys/i386/i386/tsc.c to read CTLFLAG_RD instead of CTLFLAG_RW? I've attached a log of what happened on my system when I changed the sysctl value. I haven't done a lot of investigation into the kernel here so I'm willing to accept that I may be completely wrong, but something just doesn't seem quite right. -- Bruce Cran --LZvS9be/3tNcYl/X Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="tsc.log" box1# sysctl machdep.tsc_freq machdep.tsc_freq: 1401716358 box1# sysctl machdep.tsc_freq=4294967294 machdep.tsc_freq: 1401716358 -> 4294967294 box1# sysctl machdep.tsc_freq=4294967299 machdep.tsc_freq: 4294967294 -> 3 box1# sysctl machdep.tsc_freq=42949672500 machdep.tsc_freq: 3 -> 204 --LZvS9be/3tNcYl/X--