[PATCH] oprofile: make perfmon nethalem only
From: Pekka Enberg
Date: Tue Nov 04 2008 - 14:17:47 EST
Commit b99170288421c79f0c2efa8b33e26e65f4bb7fb8 ("oprofile: Implement Intel
architectural perfmon support") added perfmon support to newer Intel CPUs
(Core1+). The problem there is that it requires a patched oprofile userland to
work properly.
Fix that up by making oprofile perfmon support nethalem only.
Signed-off-by: Pekka Enberg <penberg@xxxxxxxxxxxxxx>
---
arch/x86/oprofile/nmi_int.c | 7 +++++++
arch/x86/oprofile/op_model_ppro.c | 4 +++-
2 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/arch/x86/oprofile/nmi_int.c b/arch/x86/oprofile/nmi_int.c
index 022cd41..1f4448e 100644
--- a/arch/x86/oprofile/nmi_int.c
+++ b/arch/x86/oprofile/nmi_int.c
@@ -426,8 +426,15 @@ static int __init ppro_init(char **cpu_type)
static int __init arch_perfmon_init(char **cpu_type)
{
+ __u8 cpu_model = boot_cpu_data.x86_model;
+
if (!cpu_has_arch_perfmon)
return 0;
+
+ /* Nethalem only */
+ if (cpu_model != 26)
+ return 0;
+
*cpu_type = "i386/arch_perfmon";
model = &op_arch_perfmon_spec;
arch_perfmon_setup_counters();
diff --git a/arch/x86/oprofile/op_model_ppro.c b/arch/x86/oprofile/op_model_ppro.c
index 0620d6d..1c91ba2 100644
--- a/arch/x86/oprofile/op_model_ppro.c
+++ b/arch/x86/oprofile/op_model_ppro.c
@@ -66,6 +66,7 @@ static void ppro_fill_in_addresses(struct op_msrs * const msrs)
static void ppro_setup_ctrs(struct op_msrs const * const msrs)
{
+ __u8 cpu_model = boot_cpu_data.x86_model;
unsigned int low, high;
int i;
@@ -76,7 +77,8 @@ static void ppro_setup_ctrs(struct op_msrs const * const msrs)
return;
}
- if (cpu_has_arch_perfmon) {
+ /* Nethalem only */
+ if (cpu_has_arch_perfmon && cpu_model == 26) {
union cpuid10_eax eax;
eax.full = cpuid_eax(0xa);
if (counter_width < eax.split.bit_width)
--
1.5.3.7
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/