lkml.org 
[lkml]   [2003]   [Aug]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[2.4][PATCH] Use of Performance Monitoring Counters based on Model number
Date
From

Marcelo,

Attached is a small patch to make Linux kernel use of performance
monitoring MSRs based on known processor models. Future processor
implementation models may not support the same MSR layout.

The patch is already in 2.6, and this is a backport from there.
Note that the patch also adds support for extended family and
model numbers. This part also is a backport from 2.6.

Please consider applying.

Thanks,
-Venkatesh





--- linux-2.4.22-rc2/arch/i386/kernel/nmi.c.org 2003-08-20
15:55:55.000000000 -0700
+++ linux-2.4.22-rc2/arch/i386/kernel/nmi.c 2003-08-20
15:59:22.000000000 -0700
@@ -150,9 +150,15 @@ static void disable_apic_nmi_watchdog(vo
case X86_VENDOR_INTEL:
switch (boot_cpu_data.x86) {
case 6:
+ if (boot_cpu_data.x86_model > 0xd)
+ break;
+
wrmsr(MSR_P6_EVNTSEL0, 0, 0);
break;
case 15:
+ if (boot_cpu_data.x86_model > 0x3)
+ break;
+
wrmsr(MSR_P4_IQ_CCCR0, 0, 0);
wrmsr(MSR_P4_CRU_ESCR0, 0, 0);
break;
@@ -288,9 +294,19 @@ void __pminit setup_apic_nmi_watchdog (v
case X86_VENDOR_INTEL:
switch (boot_cpu_data.x86) {
case 6:
+ if (boot_cpu_data.x86_model > 0xd) {
+ printk (KERN_INFO "Performance Counter
support for this CPU model not yet added.\n");
+ return;
+ }
+
setup_p6_watchdog();
break;
case 15:
+ if (boot_cpu_data.x86_model > 0x3) {
+ printk (KERN_INFO "Performance Counter
support for this CPU model not yet added.\n");
+ return;
+ }
+
if (!setup_p4_watchdog())
return;
break;
--- linux-2.4.22-rc2/arch/i386/kernel/setup.c.org 2003-08-20
15:56:14.000000000 -0700
+++ linux-2.4.22-rc2/arch/i386/kernel/setup.c 2003-08-20
15:57:10.000000000 -0700
@@ -2759,6 +2759,10 @@ void __init identify_cpu(struct cpuinfo_
c->x86 = (tfms >> 8) & 15;
c->x86_model = (tfms >> 4) & 15;
c->x86_mask = tfms & 15;
+ if (c->x86 == 0xf) {
+ c->x86 += (tfms >> 20) & 0xff;
+ c->x86_model += ((tfms >> 16) & 0xf) <<
4;
+ }
} else {
/* Have CPUID level 0 only - unheard of */
c->x86 = 4;

<<nmi-2.4.22-rc2.patch>> [unhandled content-type:application/octet-stream]
\
 
 \ /
  Last update: 2005-03-22 13:47    [W:0.038 / U:1.260 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site