mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Pallipadi, Venkatesh" <venkatesh.pallipadi@intel.com>
To: <torvalds@osdl.org>
Cc: <linux-kernel@vger.kernel.org>,
	"Pallipadi, Venkatesh" <venkatesh.pallipadi@intel.com>,
	"Nakajima, Jun" <jun.nakajima@intel.com>
Subject: RE: [PATCH] [RESEND] Use of Performance Monitoring Counters based on Model number
Date: Tue, 29 Jul 2003 13:28:14 -0700	[thread overview]
Message-ID: <C8C38546F90ABF408A5961FC01FDBF1902C7D159@fmsmsx405.fm.intel.com> (raw)

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



Oops. Sorry about the wrapped lines in my last mail. Sending the patch
as an attachment this time.

Thanks,
-Venkatesh


> -----Original Message-----
> From: Pallipadi, Venkatesh 
> Sent: Tuesday, July 29, 2003 11:15 AM
> To: torvalds@osdl.org
> Cc: linux-kernel@vger.kernel.org; Mallick, Asit K; Nakajima, Jun
> Subject: [PATCH] [RESEND] Use of Performance Monitoring 
> Counters based on Model number
> 
> 
> 
> 
> 
> Attaching a modified version of this patch, based on the 
> feedback that I
> got for my previous post.
> 
> Feedback and Resolution:
> 1) If you're going to do this you should fix up arch/i386/oprofile/ to
> error out similarly at least
> -  Done. Made a similar change in oprofile code. Infact it 
> already had a
> check for 0xf, 0x3. Added one for 0x6, 0xd.
> 
> 2) How about some macros for those magic numbers?  
> #define INTEL_MODEL_THINGABABOBBERPERON 0xd
> -  Not sure whether I need to add macros for family and 
> models. We don't
> seem to have macros for them anywhere else in kernel code.
> 
> 3) It'd also be nice to let the user know why things aren't working
> instead of silent failure.
> -  Done. Added a message while in nmi_init. 
> 
> Let me know if you have any questions. Please Apply.
> 
> Thanks,
> -Venkatesh
> 
> > -----Original Message-----
> > From: Pallipadi, Venkatesh 
> > Sent: Wednesday, July 16, 2003 10:08 AM
> > To: 'torvalds@osdl.org'
> > Cc: 'linux-kernel@vger.kernel.org'; Mallick, Asit K
> > Subject: [PATCH] Use of Performance Monitoring Counters based 
> > on Model number
> > 
> > 
> > 
> > 
> > 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.
> > 
> > Please apply.
> > 
> > Thanks,
> > -Venkatesh
> 
> 
> 
> 
> --- linux-2.6.0-test1/arch/i386/kernel/nmi.c.orig	2003-07-13
> 20:34:40.000000000 -0700
> +++ linux-2.6.0-test1/arch/i386/kernel/nmi.c	2003-07-17
> 17:26:45.000000000 -0700
> @@ -162,9 +162,15 @@
>  	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;
> @@ -348,9 +354,19 @@
>  	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.6.0-test1/arch/i386/oprofile/nmi_int.c.orig	
> 2003-07-17
> 17:20:30.000000000 -0700
> +++ linux-2.6.0-test1/arch/i386/oprofile/nmi_int.c	2003-07-17
> 17:21:06.000000000 -0700
> @@ -285,6 +285,9 @@
>  {
>  	__u8 cpu_model = current_cpu_data.x86_model;
>  
> +	if (cpu_model > 0xd)
> +		return 0;
> +
>  	if (cpu_model > 5) {
>  		nmi_ops.cpu_type = "i386/piii";
>  	} else if (cpu_model > 2) {
> 
> 
> -
> To unsubscribe from this list: send the line "unsubscribe 
> linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 

[-- Attachment #2: 2.5_nmi_ver1.patch --]
[-- Type: application/octet-stream, Size: 1373 bytes --]

--- linux-2.6.0-test1/arch/i386/kernel/nmi.c.orig	2003-07-13 20:34:40.000000000 -0700
+++ linux-2.6.0-test1/arch/i386/kernel/nmi.c	2003-07-17 17:26:45.000000000 -0700
@@ -162,9 +162,15 @@
 	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;
@@ -348,9 +354,19 @@
 	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.6.0-test1/arch/i386/oprofile/nmi_int.c.orig	2003-07-17 17:20:30.000000000 -0700
+++ linux-2.6.0-test1/arch/i386/oprofile/nmi_int.c	2003-07-17 17:21:06.000000000 -0700
@@ -285,6 +285,9 @@
 {
 	__u8 cpu_model = current_cpu_data.x86_model;
 
+	if (cpu_model > 0xd)
+		return 0;
+
 	if (cpu_model > 5) {
 		nmi_ops.cpu_type = "i386/piii";
 	} else if (cpu_model > 2) {

             reply	other threads:[~2003-07-29 20:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-29 20:28 Pallipadi, Venkatesh [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-07-29 18:15 Pallipadi, Venkatesh

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=C8C38546F90ABF408A5961FC01FDBF1902C7D159@fmsmsx405.fm.intel.com \
    --to=venkatesh.pallipadi@intel.com \
    --cc=jun.nakajima@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /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®