Date: Fri, 06 Mar 1998 09:17:41 -0800 From: Tom Pavel <pavel@SLAC.Stanford.EDU> To: FreeBSD-gnats-submit@FreeBSD.ORG Subject: i386/5932: perfmon kernel code should check for non-Intel CPUs Message-ID: <199803061717.JAA03669@mailbox.SLAC.Stanford.EDU>
next in thread | raw e-mail | index | archive | help
>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 <machine/cpu.h>
#include <machine/cputypes.h>
+ #include <machine/md_var.h>
#include <machine/clock.h>
#include <machine/perfmon.h>
***************
*** 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199803061717.JAA03669>
