2003-07-16 16:53:05

by Pallipadi, Venkatesh

[permalink] [raw]
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.5.72-monitor/arch/i386/kernel/nmi.c.org 2003-06-16
21:20:02.000000000 -0700
+++ linux-2.5.72-monitor/arch/i386/kernel/nmi.c 2003-06-20
15:47:29.000000000 -0700
@@ -157,9 +157,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;
@@ -324,9 +338,15 @@
case X86_VENDOR_INTEL:
switch (boot_cpu_data.x86) {
case 6:
+ if (boot_cpu_data.x86_model > 0xd)
+ return;
+
setup_p6_watchdog();
break;
case 15:
+ if (boot_cpu_data.x86_model > 0x3)
+ return;
+
if (!setup_p4_watchdog())
return;
break;



2003-07-16 17:08:31

by John Levon

[permalink] [raw]
Subject: Re: [PATCH] Use of Performance Monitoring Counters based on Model number

On Wed, Jul 16, 2003 at 10:07:49AM -0700, Pallipadi, Venkatesh wrote:

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

If you're going to do this you should fix up arch/i386/oprofile/ to
error out similarly at least

regards
john

2003-07-16 17:57:40

by Dave Jones

[permalink] [raw]
Subject: Re: [PATCH] Use of Performance Monitoring Counters based on Model number

On Wed, Jul 16, 2003 at 06:19:56PM +0100, John Levon wrote:

> > 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.
> If you're going to do this you should fix up arch/i386/oprofile/ to
> error out similarly at least

It'd also be nice to let the user know why things aren't working
instead of silent failure. A simple

printk (KERN_INFO "Performance counter support for this CPU not yet added.\n");

Should do the trick.

Dave