From owner-freebsd-bugs Fri Mar 6 09:20:04 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id JAA18488 for freebsd-bugs-outgoing; Fri, 6 Mar 1998 09:20:04 -0800 (PST) (envelope-from owner-freebsd-bugs@FreeBSD.ORG) Received: (from gnats@localhost) by hub.freebsd.org (8.8.8/8.8.8) id JAA18453; Fri, 6 Mar 1998 09:20:02 -0800 (PST) (envelope-from gnats) Received: from serv05.slac.stanford.edu (SERV05.SLAC.Stanford.EDU [134.79.16.135]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id JAA18290 for ; Fri, 6 Mar 1998 09:17:44 -0800 (PST) (envelope-from pavel@SLAC.Stanford.EDU) Received: from mailbox.SLAC.Stanford.EDU (root@[134.79.18.29]) by SERV05.SLAC.STANFORD.EDU (PMDF V5.1-10 #23033) with ESMTP id <01IUCAAHQVDO002WA5@SERV05.SLAC.STANFORD.EDU> for FreeBSD-gnats-submit@freebsd.org; Fri, 6 Mar 1998 09:17:43 PST Received: from mach1.slac.stanford.edu (MACH1.SLAC.Stanford.EDU [134.79.128.63]) by mailbox.SLAC.Stanford.EDU (8.8.5/8.6.11) with ESMTP id JAA03669 for ; Fri, 06 Mar 1998 09:17:41 -0800 (PST) Message-Id: <199803061717.JAA03669@mailbox.SLAC.Stanford.EDU> Date: Fri, 06 Mar 1998 09:17:41 -0800 From: Tom Pavel Reply-To: pavel@SLAC.Stanford.EDU To: FreeBSD-gnats-submit@FreeBSD.ORG X-Send-Pr-Version: 3.2 Subject: i386/5932: perfmon kernel code should check for non-Intel CPUs Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 5932 >Category: i386 >Synopsis: perfmon kernel code should check for non-Intel CPUs >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Mar 6 09:20:01 PST 1998 >Last-Modified: >Originator: Tom Pavel >Organization: Stanford Linear Accelerator Center >Release: FreeBSD 2.2.5-STABLE i386 >Environment: >Description: Before I researched the fact that AMD does not actually implement any of the msr 0x11 performance counters in the K6 that Intel does in the Pentium and PPro, I thought I would try out the perfmon program in /usr/share/examples/perfmon on my K6 machine. This brought my machine to an immediate halt. I figured it out soon enough, but this case should probably be caught in the perfmon code... >How-To-Repeat: Do any of the PMIO ioctl() calls on /dev/perfmon on an AMD K6 machine. >Fix: I think you just need to check that the CPU is actually an Intel one, rather than checking for the generic 586/686 cpu_class. Here is a possible fix: bozon[111]% diff -c /usr/src/sys/i386/i386/perfmon.c-ORIG perfmon.c *** /usr/src/sys/i386/i386/perfmon.c-ORIG Thu Oct 10 03:18:48 1996 --- perfmon.c Thu Mar 5 23:34:38 1998 *************** *** 38,43 **** --- 38,44 ---- #include #include + #include #include #include *************** *** 57,62 **** --- 58,71 ---- void perfmon_init(void) { + /* Unfortunately, all of the perfmon registers only exist on + * "GenuineIntel" Pentiums and P6's. Trying to use msr 0x11 on my K6 + * cause a seize-up... (pavel 5-Mar-1998) */ + if (strcmp(cpu_vendor, "GenuineIntel") != 0) { + perfmon_cpuok = 0; + return; + } + switch(cpu_class) { case CPUCLASS_586: perfmon_cpuok = 1; Tom Pavel Stanford Linear Accelerator Center pavel@slac.stanford.edu http://www.slac.stanford.edu/~pavel/ >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message