On 20.08.08 18:40:31, Andi Kleen wrote:From: Andi Kleen <ak@xxxxxxxxxxxxxxx>
Newer Intel CPUs (Core1+) have support for architectural
events described in CPUID 0xA. See the IA32 SDM Vol3b.18 for details.
The advantage of this is that it can be done without knowing about
the specific CPU, because the CPU describes by itself what
performance events are supported. This is only a fallback
because only a limited set of 6 events are supported.
This allows to do profiling on Nehalem and on Atom systems
(later not tested)
This patch implements support for that in oprofile's Intel
Family 6 profiling module. It also has the advantage of supporting
an arbitary number of events now as reported by the CPU.
Also allow arbitary counter widths >32bit while we're at it.
Requires a patched oprofile userland to support the new
architecture.
Signed-off-by: Andi Kleen <ak@xxxxxxxxxxxxxxx>
---
Documentation/kernel-parameters.txt | 5 ++
arch/x86/oprofile/nmi_int.c | 32 +++++++++--
arch/x86/oprofile/op_model_ppro.c | 104 +++++++++++++++++++++++++++-------
arch/x86/oprofile/op_x86_model.h | 3 +
4 files changed, 116 insertions(+), 28 deletions(-)
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 056742c..10c8b1b 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -1486,6 +1486,11 @@ and is between 256 and 4096 characters. It is defined in the file
oprofile.timer= [HW]
Use timer interrupt instead of performance counters
+ oprofile.force_arch_perfmon=1 [X86]
+ Force use of architectural perfmon performance counters
+ in oprofile on Intel CPUs. The kernel selects the
+ correct default on its own.
+
Could you create a separate patch that introduces this new kernel
parameter?
This would make it easier to send all other changes
upstream. We already discussed the need of this parameter.
Maybe it
would fit better to have a more generalized paramater for this that
could be reused then by other archs/models as well. Something like
force_pmu_detection that could be used for all new CPUs (also other
models) that do not yet have a specific kernel implementation.
Even better would a sysfs entry instead with that we can specify which
cpu type to use:
echo "i386/arch_perfmon" > /sys/module/oprofile/parameters/cpu_type
That would allow us to switch the pmu at runtime and also from the
userland.