Skip to contentSkip to conversation

OProfile Pentium IV support

PATCH In review John Levon 2 participants 3 messages Jan 8, 2003 – Jan 9, 2003

lore
Share & tools
lore

John Levon

author
#0 lore raw

PATCH 1/1 OProfile Pentium IV support

This is a compile-tested-only port of Graydon Hoare's driver. Please give it a test and report back.

Note that the #ifdef CONFIG_SMP would go away if we had a #define smp_num_siblings 1 somewhere. linux/smp.h isn't really the right place (it's arch-specific ...) but would do I suppose.

You'll need a recentish oprofile, e.g.
http://www.movement.uklinux.net/oprofile-0.5cvs.tar.gz

thanks,
john

arch/i386/kernel/nmi.c +0 -2
diff -X dontdiff -Naur linux-linus/arch/i386/kernel/nmi.c linux/arch/i386/kernel/nmi.c
@@ -63,8 +63,6 @@
    CRU_ESCR0 (with any non-null event selector) through a complemented
    max threshold. [IA32-Vol3, Section 14.9.9] */
 #define MSR_P4_IQ_COUNTER0	0x30C
-#define MSR_P4_IQ_CCCR0		0x36C
-#define MSR_P4_CRU_ESCR0	0x3B8
 #define P4_NMI_CRU_ESCR0	(P4_ESCR_EVENT_SELECT(0x3F)|P4_ESCR_OS|P4_ESCR_USR)
 #define P4_NMI_IQ_CCCR0	\
 	(P4_CCCR_OVF_PMI|P4_CCCR_THRESHOLD(15)|P4_CCCR_COMPLEMENT|	\
arch/i386/oprofile/Makefile +1 -1
diff -X dontdiff -Naur linux-linus/arch/i386/oprofile/Makefile linux/arch/i386/oprofile/Makefile
@@ -7,4 +7,4 @@
 
 oprofile-y				:= $(DRIVER_OBJS) init.o timer_int.o
 oprofile-$(CONFIG_X86_LOCAL_APIC) 	+= nmi_int.o op_model_athlon.o \
-					   op_model_ppro.o
+					   op_model_ppro.o op_model_p4.o
arch/i386/oprofile/nmi_int.c +66 -14

99 lines not on this page · raw message

arch/i386/oprofile/op_counter.h +1 -1
diff -X dontdiff -Naur linux-linus/arch/i386/oprofile/op_counter.h linux/arch/i386/oprofile/op_counter.h
@@ -10,7 +10,7 @@
 #ifndef OP_COUNTER_H
 #define OP_COUNTER_H
  
-#define OP_MAX_COUNTER 4
+#define OP_MAX_COUNTER 8
  
 /* Per-perfctr configuration as set via
  * oprofilefs.
arch/i386/oprofile/op_model_p4.c +669 -0

669 lines not on this page · raw message

arch/i386/oprofile/op_x86_model.h +4 -2
diff -X dontdiff -Naur linux-linus/arch/i386/oprofile/op_x86_model.h linux/arch/i386/oprofile/op_x86_model.h
@@ -11,8 +11,8 @@
 #ifndef OP_X86_MODEL_H
 #define OP_X86_MODEL_H
 
-/* will need re-working for Pentium IV */
-#define MAX_MSR 4
+/* Pentium IV needs all these */
+#define MAX_MSR 63
  
 struct op_saved_msr {
 	unsigned int high;
@@ -47,6 +47,8 @@
 };
 
 extern struct op_x86_model_spec const op_ppro_spec;
+extern struct op_x86_model_spec const op_p4_spec;
+extern struct op_x86_model_spec const op_p4_ht2_spec;
 extern struct op_x86_model_spec const op_athlon_spec;
 
 #endif /* OP_X86_MODEL_H */
include/asm-i386/msr.h +84 -0

90 lines not on this page · raw message

include/linux/oprofile.h +11 -1
diff -X dontdiff -Naur linux-linus/include/linux/oprofile.h linux/include/linux/oprofile.h
@@ -21,12 +21,22 @@
 struct dentry;
 struct file_operations;
  
+/* This is duplicated from user-space so
+ * must be kept in sync :(
+ */
 enum oprofile_cpu {
 	OPROFILE_CPU_PPRO,
 	OPROFILE_CPU_PII,
 	OPROFILE_CPU_PIII,
 	OPROFILE_CPU_ATHLON,
-	OPROFILE_CPU_TIMER
+	OPROFILE_CPU_TIMER,
+	OPROFILE_UNUSED1, /* 2.4's RTC mode */
+	OPROFILE_CPU_P4,
+	OPROFILE_CPU_IA64,
+	OPROFILE_CPU_IA64_1,
+	OPROFILE_CPU_IA64_2,
+	OPROFILE_CPU_HAMMER,
+	OPROFILE_CPU_P4_HT2
 };
 
 /* Operations structure to be filled in */
#1 lore raw
Quoted 3 lines · John Levon

This is a compile-tested-only port of Graydon Hoare's driver. Please give it a test and report back.

Below is a fix to make the kernel build when it is configured for something other than a p4.

Quoted 1 line

http://www.movement.uklinux.net/oprofile-0.5cvs.tar.gz

$./configure
...
checking for ld... ld
checking for kernel OProfile support... no
checking for kernel version... 2.5.54
configure: error: Unsupported kernel version

 arch/i386/oprofile/Makefile  |    3 ++-
 arch/i386/oprofile/nmi_int.c |    8 ++++----
 2 files changed, 6 insertions(+), 5 deletions(-)
arch/i386/oprofile/Makefile renamed from arch/i386/oprofile/Makefile~op4-fix +2 -1
@@ -7,4 +7,5 @@ DRIVER_OBJS = $(addprefix ../../../drive
 
 oprofile-y				:= $(DRIVER_OBJS) init.o timer_int.o
 oprofile-$(CONFIG_X86_LOCAL_APIC) 	+= nmi_int.o op_model_athlon.o \
-					   op_model_ppro.o op_model_p4.o
+					   op_model_ppro.o
+oprofile-$(CONFIG_MPENTIUM4)		+= op_model_p4.o
arch/i386/oprofile/nmi_int.c renamed from arch/i386/oprofile/nmi_int.c~op4-fix +4 -4
@@ -215,7 +215,7 @@ struct oprofile_operations nmi_ops = {
 };
  
 
-#ifndef CONFIG_X86_64
+#if !defined(CONFIG_X86_64) && defined(CONFIG_MPENTIUM4)
 
 static int __init p4_init(enum oprofile_cpu * cpu)
 {
@@ -263,7 +263,7 @@ static int __init ppro_init(enum oprofil
 	return 1;
 }
 
-#endif /* CONFIG_X86_64 */
+#endif
  
 int __init nmi_init(struct oprofile_operations ** ops, enum oprofile_cpu * cpu)
 {
@@ -282,7 +282,7 @@ int __init nmi_init(struct oprofile_oper
 			*cpu = OPROFILE_CPU_ATHLON;
 			break;
  
-#ifndef CONFIG_X86_64
+#if !defined(CONFIG_X86_64) && defined(CONFIG_MPENTIUM4)
 		case X86_VENDOR_INTEL:
 			switch (family) {
 				/* Pentium IV */
@@ -301,7 +301,7 @@ int __init nmi_init(struct oprofile_oper
 					return 0;
 			}
 			break;
-#endif /* CONFIG_X86_64 */
+#endif
 
 		default:
 			return 0;

_