mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [2.4][PATCH] Use of Performance Monitoring Counters based on Model number
@ 2003-08-20 21:26 Pallipadi, Venkatesh
  0 siblings, 0 replies; only message in thread
From: Pallipadi, Venkatesh @ 2003-08-20 21:26 UTC (permalink / raw)
  To: marcelo; +Cc: linux-kernel, Nakajima, Jun, Mallick, Asit K

[-- Attachment #1: Type: text/plain, Size: 2144 bytes --]


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>> 

[-- Attachment #2: nmi-2.4.22-rc2.patch --]
[-- Type: application/octet-stream, Size: 1594 bytes --]

--- 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;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-08-20 21:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-20 21:26 [2.4][PATCH] Use of Performance Monitoring Counters based on Model number Pallipadi, Venkatesh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®