From owner-freebsd-hackers Sun Mar 14 22: 3:43 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from cs.rice.edu (cs.rice.edu [128.42.1.30]) by hub.freebsd.org (Postfix) with ESMTP id 4336114EA8 for ; Sun, 14 Mar 1999 22:03:40 -0800 (PST) (envelope-from aron@cs.rice.edu) Received: (from aron@localhost) by cs.rice.edu (8.9.0/8.9.0) id AAA01202 for freebsd-hackers@freebsd.org; Mon, 15 Mar 1999 00:03:21 -0600 (CST) From: Mohit Aron Message-Id: <199903150603.AAA01202@cs.rice.edu> Subject: bug in performance monitoring code To: freebsd-hackers@freebsd.org Date: Mon, 15 Mar 1999 00:03:21 -0600 (CST) X-Mailer: ELM [version 2.4 PL25] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Hi, there's a bug in the performance monitoring code in the file /sys/i386/i386/perfmon.c that implements ioctl calls to the device /dev/perfmon. I'm using FreeBSD-3.1 running on a Pentium-Pro processor. The problem is that the Intel performance counters are 40 bits wide and reading them using the rdmsr instruction results in the higher 24 bits of the 64 bit value to be undefined (as stated in Intel's manuals). However, the code in perfmon.c doesn't clear the higher 24 bits after calling rdmsr(). Here's a sample output of the /usr/share/examples/perfmon program (this particular example montiors the floating point operations in 1 second): % perfmon -u -e -s 1 -l 1 193 1: 61572651155456 total: 61572651155456.000000 mean: 61572651155456.000000 clocks (at 166-MHz): 166827310 Here's the sample output after applying a fix to /sys/i386/i386/perfmon.c: % perfmon -u -e -s 1 -l 1 193 1: 0 total: 0.000000 mean: 0.000000 clocks (at 166-MHz): 166632751 - Mohit Aron aron@cs.rice.edu To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message