mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Pallipadi, Venkatesh" <venkatesh.pallipadi@intel.com>
To: <marcelo@conectiva.com.br>
Cc: <linux-kernel@vger.kernel.org>,
	"Nakajima, Jun" <jun.nakajima@intel.com>,
	"Mallick, Asit K" <asit.k.mallick@intel.com>
Subject: [2.4][PATCH] Use of Performance Monitoring Counters based on Model number
Date: Wed, 20 Aug 2003 14:26:07 -0700	[thread overview]
Message-ID: <C8C38546F90ABF408A5961FC01FDBF1902C7D1DB@fmsmsx405.fm.intel.com> (raw)

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

                 reply	other threads:[~2003-08-20 21:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=C8C38546F90ABF408A5961FC01FDBF1902C7D1DB@fmsmsx405.fm.intel.com \
    --to=venkatesh.pallipadi@intel.com \
    --cc=asit.k.mallick@intel.com \
    --cc=jun.nakajima@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo@conectiva.com.br \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®