oprofile fixes and updates for v2.6.34
Subsystems (2)
cover oprofile fixes and updates for v2.6.34
This patch series contains oprofile fixes and updates for v2.6.34. It includes:
* Kconfig updates and fixes (patches 1, 2, 3)
* bug fixes (patches 4, 10, 12)
* IBS cpuid detection (patch 5)
* IBS software randomization (patches 6, 7)
* print warnings if counters are reserved or in use (patches 8, 9)
* code improvements (patch 11)
* x86 updates to perf_event.h to share code between subsystems (patches 13, 14, 15)
See also enclosed changelog.
Ingo, please pull from:
git://git.kernel.org/pub/scm/linux/kernel/git/rric/oprofile.git core
Thanks,
-Robert
The following changes since commit 724e6d3fe8003c3f60bf404bf22e4e331327c596:
Linus Torvalds (1):
Linux 2.6.33-rc8
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/rric/oprofile.git core
Naga Chumbalkar (1):
oprofile/x86: add comment to counter-in-use warning
Robert Richter (13):
oprofile: remove tracing build dependency
oprofile: remove EXPERIMENTAL from the config option description oprofile/x86: remove OPROFILE_IBS config option oprofile/x86: remove node check in AMD IBS initialization oprofile/x86: implement IBS cpuid feature detection oprofile/x86: implement randomization for IBS periodic op counter oprofile/x86: warn user if a counter is already active oprofile/x86: fix perfctr nmi reservation for mulitplexing oprofile/x86: use kzalloc() instead of kmalloc() oprofile/x86: fix msr access to reserved counters perf, x86: make IBS macros available in perf_event.h perf, x86: add some IBS macros to perf_event.h
perf, x86: rename macro in ARCH_PERFMON_EVENTSEL_ENABLE
Suravee Suthikulpanit (1):
oprofile/x86: implement lsfr pseudo-random number generator for IBS
arch/Kconfig | 18 +-- arch/x86/include/asm/perf_event.h | 14 ++- arch/x86/kernel/cpu/perf_event.c | 16 +- arch/x86/kernel/cpu/perfctr-watchdog.c | 2 +- arch/x86/oprofile/nmi_int.c | 17 +- arch/x86/oprofile/op_model_amd.c | 261 ++++++++++++++++++++------------ arch/x86/oprofile/op_model_p4.c | 6 - arch/x86/oprofile/op_model_ppro.c | 21 ++- arch/x86/oprofile/op_x86_model.h | 20 +++ init/Kconfig | 2 +- 10 files changed, 227 insertions(+), 150 deletions(-)
PATCH 1/15 oprofile: remove tracing build dependency
The commit
1155de4 ring-buffer: Make it generally available
already made ring-buffer available without the TRACING option enabled. This patch removes the TRACING dependency from oprofile.
Fixes also oprofile configuration on ia64.
The patch also applies to the 2.6.32-stable kernel.
--- arch/Kconfig | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)
arch/Kconfig +0 -2
@@ -6,8 +6,6 @@ config OPROFILE tristate "OProfile system profiling (EXPERIMENTAL)" depends on PROFILING depends on HAVE_OPROFILE - depends on TRACING_SUPPORT - select TRACING select RING_BUFFER select RING_BUFFER_ALLOW_SWAP help
Signature · 1 line
1.6.6
PATCH 2/15 oprofile: remove EXPERIMENTAL from the config option description
In reply to Robert RichterOProfile is already used for a long time and no longer experimental.
--- arch/Kconfig | 2 +- init/Kconfig | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/Kconfig +1 -1
@@ -3,7 +3,7 @@ # config OPROFILE - tristate "OProfile system profiling (EXPERIMENTAL)" + tristate "OProfile system profiling" depends on PROFILING depends on HAVE_OPROFILE select RING_BUFFER
init/Kconfig +1 -1
@@ -1112,7 +1112,7 @@ config MMAP_ALLOW_UNINITIALIZED See Documentation/nommu-mmap.txt for more information. config PROFILING - bool "Profiling support (EXPERIMENTAL)" + bool "Profiling support" help Say Y here to enable the extended profiling support mechanisms used by profilers such as OProfile.
Signature · 1 line
1.6.6
PATCH 3/15 oprofile/x86: remove OPROFILE_IBS config option
In reply to Robert RichterOProfile support for IBS is now for several versions in the kernel. The feature is stable now and the code can be activated permanently.
As a side effect IBS now works also on nosmp configs.
--- arch/Kconfig | 14 -------------- arch/x86/oprofile/op_model_amd.c | 31 +------------------------------ 2 files changed, 1 insertions(+), 44 deletions(-)
arch/Kconfig +0 -14
@@ -15,20 +15,6 @@ config OPROFILE If unsure, say N. -config OPROFILE_IBS - bool "OProfile AMD IBS support (EXPERIMENTAL)" - default n - depends on OPROFILE && SMP && X86 - help - Instruction-Based Sampling (IBS) is a new profiling - technique that provides rich, precise program performance - information. IBS is introduced by AMD Family10h processors - (AMD Opteron Quad-Core processor "Barcelona") to overcome - the limitations of conventional performance counter - sampling. - - If unsure, say N. - config OPROFILE_EVENT_MULTIPLEX bool "OProfile multiplexing support (EXPERIMENTAL)" default n
arch/x86/oprofile/op_model_amd.c +1 -30
@@ -22,6 +22,7 @@#include <asm/ptrace.h> #include <asm/msr.h> #include <asm/nmi.h> +#include <asm/apic.h> #include "op_x86_model.h" #include "op_counter.h"
@@ -43,8 +44,6 @@static unsigned long reset_value[NUM_VIRT_COUNTERS ]; -#ifdef CONFIG_OPROFILE_IBS -/* IbsFetchCtl bits/masks */ #define IBS_FETCH_RAND_EN (1ULL<<57)#define IBS_FETCH_VAL (1ULL<<49)
@@ -72,8 +71,6 @@ struct op_ibs_config {static struct op_ibs_config ibs_config; -#endif -#ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX static void op_mux_fill_in_addresses (struct op_msrs *const msrs)
@@ -185,8 +182,6 @@ static void op_amd_setup_ctrs(struct op_x86_model_spec const *model, } } -#ifdef CONFIG_OPROFILE_IBS -static inline void op_amd_handle_ibs (struct pt_regs *const regs,struct op_msrs const *const msrs)
@@ -272,15 +267,6 @@ static void op_amd_stop_ibs(void)wrmsrl (MSR_AMD64_IBSOPCTL ,0 ); } -#else - -static inline void op_amd_handle_ibs (struct pt_regs *const regs, -struct op_msrs const *const msrs) { } -static inline void op_amd_start_ibs (void ) { } -static inline void op_amd_stop_ibs (void ) { } - -#endif -static int op_amd_check_ctrs (struct pt_regs *const regs,struct op_msrs const *const msrs) {
@@ -355,8 +341,6 @@ static void op_amd_shutdown(struct op_msrs const * const msrs) } } -#ifdef CONFIG_OPROFILE_IBS -static u8 ibs_eilvt_off;static inline void apic_init_ibs_nmi_per_cpu (void *arg)
@@ -507,19 +491,6 @@ static void op_amd_exit(void)ibs_exit (); } -#else - -/* no IBS support */ - -static int op_amd_init (struct oprofile_operations *ops) -{ -return 0 ; -} - -static void op_amd_exit (void ) {} - -#endif /* CONFIG_OPROFILE_IBS */ -struct op_x86_model_spec op_amd_spec = { .num_counters =NUM_COUNTERS , .num_controls =NUM_CONTROLS ,
Signature · 1 line
1.6.6
PATCH 4/15 oprofile/x86: remove node check in AMD IBS initialization
In reply to Robert RichterStandard AMD systems have the same number of nodes as there are northbridge devices. However, there may kernel configurations (especially for 32 bit) or system setups exist, where the node number is different or it can not be detected properly. Thus the check is not reliable and may fail though IBS setup was fine. For this reason it is better to remove the check.
--- arch/x86/oprofile/op_model_amd.c | 10 ---------- 1 files changed, 0 insertions(+), 10 deletions(-)
arch/x86/oprofile/op_model_amd.c +0 -10
@@ -389,16 +389,6 @@ static int init_ibs_nmi(void)return 1 ; } -#ifdef CONFIG_NUMA -/* Sanity check */ -/* Works only for 64bit with proper numa implementation. */ -if (nodes !=num_possible_nodes ()) { -printk (KERN_DEBUG "Failed to setup CPU node(s) for IBS, " -"found: %d, expected %d" , - nodes,num_possible_nodes ()); -return 1 ; - } -#endif return 0 ; }
Signature · 1 line
1.6.6
PATCH 5/15 oprofile/x86: implement IBS cpuid feature detection
In reply to Robert RichterThis patch adds IBS feature detection using cpuid flags. An IBS capability mask is introduced to test for certain IBS features. The bit mask is the same as for IBS cpuid feature flags (Fn8000_001B_EAX), but bit 0 is used to indicate the existence of IBS.
The patch also changes the handling of the IbsOpCntCtl bit (periodic op counter count control). The oprofilefs file for this feature (ibs_op/dispatched_ops) will be only exposed if the feature is available, also the default for the bit is set to count clock cycles.
In general, the userland can detect the availability of a feature by checking for the corresponding file in oprofilefs. If it exists, the feature also exists. This may lead to a dynamic file layout depending on the cpu type with that the userland has to deal with. Current opcontrol is compatible.
--- arch/x86/oprofile/op_model_amd.c | 80 ++++++++++++++++++++++++++++++-------- 1 files changed, 63 insertions(+), 17 deletions(-)
arch/x86/oprofile/op_model_amd.c +63 -17
@@ -23,6 +23,8 @@#include <asm/msr.h> #include <asm/nmi.h> #include <asm/apic.h> +#include <asm/processor.h> +#include <asm/cpufeature.h> #include "op_x86_model.h" #include "op_counter.h"
@@ -58,7 +60,7 @@ static unsigned long reset_value[NUM_VIRT_COUNTERS];#define IBS_FETCH_SIZE 6#define IBS_OP_SIZE 12 -static int has_ibs;/* AMD Family10h and later */ +static u32 ibs_caps;struct op_ibs_config {unsigned long op_enabled;
@@ -71,6 +73,40 @@ struct op_ibs_config {static struct op_ibs_config ibs_config; +/* +* IBS cpuid feature detection +*/ + +#define IBS_CPUID_FEATURES 0x8000001b + +/* +* Same bit mask as for IBS cpuid feature flags (Fn8000_001B_EAX), but +* bit 0 is used to indicate the existence of IBS. +*/ +#define IBS_CAPS_AVAIL (1LL<<0) +#define IBS_CAPS_OPCNT (1LL<<4) + +static u32 get_ibs_caps (void ) +{ +u32 ibs_caps; +unsigned int max_level; + +if (!boot_cpu_has (X86_FEATURE_IBS )) +return 0 ; + +/* check IBS cpuid feature flags */ + max_level =cpuid_eax (0x80000000 ); +if (max_level <IBS_CPUID_FEATURES ) +return IBS_CAPS_AVAIL ; + + ibs_caps =cpuid_eax (IBS_CPUID_FEATURES ); +if (!(ibs_caps &IBS_CAPS_AVAIL )) +/* cpuid flags not valid */ +return IBS_CAPS_AVAIL ; + +return ibs_caps; +} +#ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX static void op_mux_fill_in_addresses (struct op_msrs *const msrs)
@@ -189,7 +225,7 @@ op_amd_handle_ibs(struct pt_regs * const regs,u64 val, ctl;struct op_entry entry; -if (!has_ibs) +if (!ibs_caps)return ;if (ibs_config.fetch_enabled) {
@@ -241,16 +277,21 @@ op_amd_handle_ibs(struct pt_regs * const regs,static inline void op_amd_start_ibs (void ) {u64 val; -if (has_ibs && ibs_config.fetch_enabled) { + +if (!ibs_caps) +return ; + +if (ibs_config.fetch_enabled) { val = (ibs_config.max_cnt_fetch >>4 ) &0xFFFF ; val |= ibs_config.rand_en ?IBS_FETCH_RAND_EN :0 ; val |=IBS_FETCH_ENABLE ;wrmsrl (MSR_AMD64_IBSFETCHCTL , val); } -if (has_ibs && ibs_config.op_enabled) { +if (ibs_config.op_enabled) { val = (ibs_config.max_cnt_op >>4 ) &0xFFFF ; - val |= ibs_config.dispatched_ops ?IBS_OP_CNT_CTL :0 ; +if (ibs_caps &IBS_CAPS_OPCNT && ibs_config.dispatched_ops) + val |=IBS_OP_CNT_CTL ; val |=IBS_OP_ENABLE ;wrmsrl (MSR_AMD64_IBSOPCTL , val); }
@@ -258,11 +299,14 @@ static inline void op_amd_start_ibs(void)static void op_amd_stop_ibs (void ) { -if (has_ibs && ibs_config.fetch_enabled) +if (!ibs_caps) +return ; + +if (ibs_config.fetch_enabled)/* clear max count and enable */ wrmsrl (MSR_AMD64_IBSFETCHCTL ,0 ); -if (has_ibs && ibs_config.op_enabled) +if (ibs_config.op_enabled)/* clear max count and enable */ wrmsrl (MSR_AMD64_IBSOPCTL ,0 ); }
@@ -395,29 +439,30 @@ static int init_ibs_nmi(void)/* uninitialize the APIC for the IBS interrupts if needed */ static void clear_ibs_nmi (void ) { -if (has_ibs) +if (ibs_caps)on_each_cpu (apic_clear_ibs_nmi_per_cpu,NULL ,1 ); }/* initialize the APIC for the IBS interrupts if available */ static void ibs_init (void ) { - has_ibs =boot_cpu_has (X86_FEATURE_IBS ); + ibs_caps =get_ibs_caps (); -if (!has_ibs) +if (!ibs_caps)return ;if (init_ibs_nmi ()) { - has_ibs =0 ; + ibs_caps =0 ;return ; } -printk (KERN_INFO "oprofile: AMD IBS detected\n" ); +printk (KERN_INFO "oprofile: AMD IBS detected (0x%08x)\n" , + (unsigned )ibs_caps); }static void ibs_exit (void ) { -if (!has_ibs) +if (!ibs_caps)return ;clear_ibs_nmi ();
@@ -437,7 +482,7 @@ static int setup_ibs_files(struct super_block *sb, struct dentry *root)if (ret)return ret; -if (!has_ibs) +if (!ibs_caps)return ret;/* model specific files */
@@ -447,7 +492,7 @@ static int setup_ibs_files(struct super_block *sb, struct dentry *root) ibs_config.fetch_enabled =0 ; ibs_config.max_cnt_op =250000 ; ibs_config.op_enabled =0 ; - ibs_config.dispatched_ops =1 ; + ibs_config.dispatched_ops =0 ; dir =oprofilefs_mkdir (sb, root,"ibs_fetch" ); oprofilefs_create_ulong(sb, dir, "enable",
@@ -462,8 +507,9 @@ static int setup_ibs_files(struct super_block *sb, struct dentry *root) &ibs_config.op_enabled);oprofilefs_create_ulong (sb, dir,"max_count" , &ibs_config.max_cnt_op); -oprofilefs_create_ulong (sb, dir,"dispatched_ops" , - &ibs_config.dispatched_ops); +if (ibs_caps &IBS_CAPS_OPCNT ) +oprofilefs_create_ulong (sb, dir,"dispatched_ops" , + &ibs_config.dispatched_ops);return 0 ; }
Signature · 1 line
1.6.6
PATCH 6/15 oprofile/x86: implement lsfr pseudo-random number generator for IBS
In reply to Robert RichterFrom: Suravee Suthikulpanit <[email protected]>
This patch implements a linear feedback shift register (LFSR) for pseudo-random number generation for IBS.
For IBS measurements it would be good to minimize memory traffic in the interrupt handler since every access pollutes the data caches. Computing a maximal period LFSR just needs shifts and ORs.
The LFSR method is good enough to randomize the ops at low overhead. 16 pseudo-random bits are enough for the implementation and it doesn't matter that the pattern repeats with a fairly short cycle. It only needs to break up (hard) periodic sampling behavior.
The logic was designed by Paul Drongowski.
--- arch/x86/oprofile/op_model_amd.c | 23 +++++++++++++++++++++++ 1 files changed, 23 insertions(+), 0 deletions(-)
arch/x86/oprofile/op_model_amd.c +23 -0
@@ -218,6 +218,29 @@ static void op_amd_setup_ctrs(struct op_x86_model_spec const *model, } } +/* +* 16-bit Linear Feedback Shift Register (LFSR) +* +* 16 14 13 11 +* Feedback polynomial = X + X + X + X + 1 +*/ +static unsigned int lfsr_random (void ) +{ +static unsigned int lfsr_value =0xF00D ; +unsigned int bit; + +/* Compute next bit to shift in */ + bit = ((lfsr_value >>0 ) ^ + (lfsr_value >>2 ) ^ + (lfsr_value >>3 ) ^ + (lfsr_value >>5 )) &0x0001 ; + +/* Advance to next register value */ + lfsr_value = (lfsr_value >>1 ) | (bit <<15 ); + +return lfsr_value; +} +static inline void op_amd_handle_ibs (struct pt_regs *const regs,struct op_msrs const *const msrs)
Signature · 1 line
1.6.6
PATCH 7/15 oprofile/x86: implement randomization for IBS periodic op counter
In reply to Robert RichterIBS selects an op (execution operation) for sampling by counting either cycles or dispatched ops. Better statistical samples can be produced by adding a software generated random offset to the periodic op counter value with each sample.
This patch adds software randomization to the IBS periodic op counter. The lower 12 bits of the 20 bit counter are randomized. IbsOpCurCnt is initialized with a 12 bit random value.
There is a work around if the hw can not write to IbsOpCurCnt. Then the lower 8 bits of the 16 bit IbsOpMaxCnt [15:0] value are randomized in the range of -128 to +127 by adding/subtracting an offset to the maximum count (IbsOpMaxCnt).
The linear feedback shift register (LFSR) algorithm is used for pseudo-random number generation to have low impact to the memory system.
--- arch/x86/oprofile/op_model_amd.c | 69 ++++++++++++++++++++++++++++++++++--- 1 files changed, 63 insertions(+), 6 deletions(-)
arch/x86/oprofile/op_model_amd.c +63 -6
@@ -52,7 +52,7 @@ static unsigned long reset_value[NUM_VIRT_COUNTERS];#define IBS_FETCH_ENABLE (1ULL<<48)#define IBS_FETCH_CNT_MASK 0xFFFF0000ULL -/*IbsOpCtl bits */ +/* IbsOpCtl bits */ #define IBS_OP_CNT_CTL (1ULL<<19)#define IBS_OP_VAL (1ULL<<18)#define IBS_OP_ENABLE (1ULL<<17)
@@ -72,6 +72,7 @@ struct op_ibs_config { };static struct op_ibs_config ibs_config; +static u64 ibs_op_ctl;/* * IBS cpuid feature detection
@@ -84,8 +85,16 @@ static struct op_ibs_config ibs_config;* bit 0 is used to indicate the existence of IBS. */ #define IBS_CAPS_AVAIL (1LL<<0) +#define IBS_CAPS_RDWROPCNT (1LL<<3)#define IBS_CAPS_OPCNT (1LL<<4) +/* +* IBS randomization macros +*/ +#define IBS_RANDOM_BITS 12 +#define IBS_RANDOM_MASK ((1ULL << IBS_RANDOM_BITS) - 1) +#define IBS_RANDOM_MAXCNT_OFFSET (1ULL << (IBS_RANDOM_BITS - 5)) +static u32 get_ibs_caps (void ) {u32 ibs_caps;
@@ -241,6 +250,38 @@ static unsigned int lfsr_random(void)return lfsr_value; } +/* +* IBS software randomization +* +* The IBS periodic op counter is randomized in software. The lower 12 +* bits of the 20 bit counter are randomized. IbsOpCurCnt is +* initialized with a 12 bit random value. +*/ +static inline u64 op_amd_randomize_ibs_op (u64 val) +{ +unsigned int random =lfsr_random (); + +if (!(ibs_caps &IBS_CAPS_RDWROPCNT )) +/* +* Work around if the hw can not write to IbsOpCurCnt +* +* Randomize the lower 8 bits of the 16 bit +* IbsOpMaxCnt [15:0] value in the range of -128 to +* +127 by adding/subtracting an offset to the +* maximum count (IbsOpMaxCnt). +* +* To avoid over or underflows and protect upper bits +* starting at bit 16, the initial value for +* IbsOpMaxCnt must fit in the range from 0x0081 to +* 0xff80. +*/ + val += (s8)(random >>4 ); +else + val |= (u64)(random &IBS_RANDOM_MASK ) <<32 ; + +return val; +} +static inline void op_amd_handle_ibs (struct pt_regs *const regs,struct op_msrs const *const msrs)
@@ -290,8 +331,7 @@ op_amd_handle_ibs(struct pt_regs * const regs,oprofile_write_commit (&entry);/* reenable the IRQ */ - ctl &= ~IBS_OP_VAL &0xFFFFFFFF ; - ctl |=IBS_OP_ENABLE ; + ctl =op_amd_randomize_ibs_op (ibs_op_ctl);wrmsrl (MSR_AMD64_IBSOPCTL , ctl); } }
@@ -312,10 +352,27 @@ static inline void op_amd_start_ibs(void) }if (ibs_config.op_enabled) { - val = (ibs_config.max_cnt_op >>4 ) &0xFFFF ; + ibs_op_ctl = ibs_config.max_cnt_op >>4 ; +if (!(ibs_caps &IBS_CAPS_RDWROPCNT )) { +/* +* IbsOpCurCnt not supported. See +* op_amd_randomize_ibs_op() for details. +*/ + ibs_op_ctl =clamp (ibs_op_ctl,0x0081ULL ,0xFF80ULL ); + }else { +/* +* The start value is randomized with a +* positive offset, we need to compensate it +* with the half of the randomized range. Also +* avoid underflows. +*/ + ibs_op_ctl =min (ibs_op_ctl +IBS_RANDOM_MAXCNT_OFFSET , +0xFFFFULL ); + }if (ibs_caps &IBS_CAPS_OPCNT && ibs_config.dispatched_ops) - val |=IBS_OP_CNT_CTL ; - val |=IBS_OP_ENABLE ; + ibs_op_ctl |=IBS_OP_CNT_CTL ; + ibs_op_ctl |=IBS_OP_ENABLE ; + val =op_amd_randomize_ibs_op (ibs_op_ctl);wrmsrl (MSR_AMD64_IBSOPCTL , val); } }
Signature · 1 line
1.6.6
PATCH 8/15 oprofile/x86: warn user if a counter is already active
In reply to Robert RichterThis patch generates a warning if a counter is already active.
Implemented for AMD and P6 models. P4 is not supported.
--- arch/x86/oprofile/op_model_amd.c | 11 ++++++++++- arch/x86/oprofile/op_model_ppro.c | 11 ++++++++++- arch/x86/oprofile/op_x86_model.h | 11 +++++++++++ 3 files changed, 31 insertions(+), 2 deletions(-)
arch/x86/oprofile/op_model_amd.c +10 -1
@@ -194,9 +194,18 @@ static void op_amd_setup_ctrs(struct op_x86_model_spec const *model,/* clear all counters */ for (i =0 ; i <NUM_CONTROLS ; ++i) { -if (unlikely (!msrs->controls[i].addr)) +if (unlikely (!msrs->controls[i].addr)) { +if (counter_config[i].enabled && !smp_processor_id ()) +/* +* counter is reserved, this is on all +* cpus, so report only for cpu #0 +*/ +op_x86_warn_reserved (i);continue ; + }rdmsrl (msrs->controls[i].addr, val); +if (val &ARCH_PERFMON_EVENTSEL0_ENABLE ) +op_x86_warn_in_use (i); val &= model->reserved;wrmsrl (msrs->controls[i].addr, val); }
arch/x86/oprofile/op_model_ppro.c +10 -1
@@ -82,9 +82,18 @@ static void ppro_setup_ctrs(struct op_x86_model_spec const *model,/* clear all counters */ for (i =0 ; i < num_counters; ++i) { -if (unlikely (!msrs->controls[i].addr)) +if (unlikely (!msrs->controls[i].addr)) { +if (counter_config[i].enabled && !smp_processor_id ()) +/* +* counter is reserved, this is on all +* cpus, so report only for cpu #0 +*/ +op_x86_warn_reserved (i);continue ; + }rdmsrl (msrs->controls[i].addr, val); +if (val &ARCH_PERFMON_EVENTSEL0_ENABLE ) +op_x86_warn_in_use (i); val &= model->reserved;wrmsrl (msrs->controls[i].addr, val); }
arch/x86/oprofile/op_x86_model.h +11 -0
@@ -57,6 +57,17 @@ struct op_x86_model_spec {struct op_counter_config ; +static inline void op_x86_warn_in_use (int counter) +{ +pr_warning ("oprofile: counter #%d on cpu #%d may already be used\n" , + counter,smp_processor_id ()); +} + +static inline void op_x86_warn_reserved (int counter) +{ +pr_warning ("oprofile: counter #%d is already reserved\n" , counter); +} +extern u64 op_x86_get_ctrl (struct op_x86_model_spec const *model,struct op_counter_config *counter_config);extern int op_x86_phys_to_virt (int phys);
Signature · 1 line
1.6.6
PATCH 9/15 oprofile/x86: add comment to counter-in-use warning
In reply to Robert RichterFrom: Naga Chumbalkar <[email protected]>
Currently, oprofile fails silently on platforms where a non-OS entity such as the system firmware "enables" and uses a performance counter. There is a warning in the code for this case.
The warning indicates an already running counter. If oprofile doesn't collect data, then try using a different performance counter on your platform to monitor the desired event. Delete the counter from the desired event by editing the
/usr/share/oprofile/<cpu_type>/<cpu>/events
file. If the event cannot be monitored by any other counter, contact your hardware or BIOS vendor.
--- arch/x86/oprofile/op_x86_model.h | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-)
arch/x86/oprofile/op_x86_model.h +9 -0
@@ -59,6 +59,15 @@ struct op_counter_config;static inline void op_x86_warn_in_use (int counter) { +/* +* The warning indicates an already running counter. If +* oprofile doesn't collect data, then try using a different +* performance counter on your platform to monitor the desired +* event. Delete counter #%d from the desired event by editing +* the /usr/share/oprofile/%s/<cpu>/events file. If the event +* cannot be monitored by any other counter, contact your +* hardware or BIOS vendor. +*/ pr_warning ("oprofile: counter #%d on cpu #%d may already be used\n" , counter,smp_processor_id ()); }
Signature · 1 line
1.6.6
PATCH 10/15 oprofile/x86: fix perfctr nmi reservation for mulitplexing
In reply to Robert RichterMultiple virtual counters share one physical counter. The reservation of virtual counters fails due to duplicate allocation of the same counter. The counters are already reserved. Thus, virtual counter reservation may removed at all. This also makes the code easier.
--- arch/x86/oprofile/nmi_int.c | 11 ++++++----- arch/x86/oprofile/op_model_amd.c | 19 ------------------- 2 files changed, 6 insertions(+), 24 deletions(-)
arch/x86/oprofile/nmi_int.c +6 -5
@@ -179,7 +179,6 @@ static void nmi_cpu_setup_mux(int cpu, struct op_msrs const * const msrs)if (counter_config[i].enabled) { multiplex[i].saved = -(u64 )counter_config[i].count; }else { - multiplex[i].addr =0 ; multiplex[i].saved =0 ; } }
@@ -189,25 +188,27 @@ static void nmi_cpu_setup_mux(int cpu, struct op_msrs const * const msrs)static void nmi_cpu_save_mpx_registers (struct op_msrs *msrs) { +struct op_msr *counters = msrs->counters;struct op_msr *multiplex = msrs->multiplex;int i;for (i =0 ; i < model->num_counters; ++i) {int virt =op_x86_phys_to_virt (i); -if (multiplex[virt].addr) -rdmsrl (multiplex[virt].addr, multiplex[virt].saved); +if (counters[i].addr) +rdmsrl (counters[i].addr, multiplex[virt].saved); } }static void nmi_cpu_restore_mpx_registers (struct op_msrs *msrs) { +struct op_msr *counters = msrs->counters;struct op_msr *multiplex = msrs->multiplex;int i;for (i =0 ; i < model->num_counters; ++i) {int virt =op_x86_phys_to_virt (i); -if (multiplex[virt].addr) -wrmsrl (multiplex[virt].addr, multiplex[virt].saved); +if (counters[i].addr) +wrmsrl (counters[i].addr, multiplex[virt].saved); } }
arch/x86/oprofile/op_model_amd.c +0 -19
@@ -118,19 +118,6 @@ static u32 get_ibs_caps(void)#ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX -static void op_mux_fill_in_addresses (struct op_msrs *const msrs) -{ -int i; - -for (i =0 ; i <NUM_VIRT_COUNTERS ; i++) { -int hw_counter =op_x86_virt_to_phys (i); -if (reserve_perfctr_nmi (MSR_K7_PERFCTR0 + i)) - msrs->multiplex[i].addr =MSR_K7_PERFCTR0 + hw_counter; -else - msrs->multiplex[i].addr =0 ; - } -} -static void op_mux_switch_ctrl (struct op_x86_model_spec const *model,struct op_msrs const *const msrs) {
@@ -149,10 +136,6 @@ static void op_mux_switch_ctrl(struct op_x86_model_spec const *model, } } -#else - -static inline void op_mux_fill_in_addresses (struct op_msrs *const msrs) { } -#endif /* functions for op_amd_spec */
@@ -174,8 +157,6 @@ static void op_amd_fill_in_addresses(struct op_msrs * const msrs)else msrs->controls[i].addr =0 ; } - -op_mux_fill_in_addresses (msrs); } static void op_amd_setup_ctrs(struct op_x86_model_spec const *model,
Signature · 1 line
1.6.6
PATCH 11/15 oprofile/x86: use kzalloc() instead of kmalloc()
In reply to Robert Richter--- arch/x86/oprofile/nmi_int.c | 6 +++--- arch/x86/oprofile/op_model_amd.c | 4 ---- arch/x86/oprofile/op_model_p4.c | 6 ------ arch/x86/oprofile/op_model_ppro.c | 6 +----- 4 files changed, 4 insertions(+), 18 deletions(-)
arch/x86/oprofile/nmi_int.c +3 -3
@@ -159,7 +159,7 @@ static int nmi_setup_mux(void)for_each_possible_cpu (i) {per_cpu (cpu_msrs, i).multiplex = -kmalloc (multiplex_size,GFP_KERNEL ); +kzalloc (multiplex_size,GFP_KERNEL );if (!per_cpu (cpu_msrs, i).multiplex)return 0 ; }
@@ -304,11 +304,11 @@ static int allocate_msrs(void)int i;for_each_possible_cpu (i) { -per_cpu (cpu_msrs, i).counters =kmalloc (counters_size, +per_cpu (cpu_msrs, i).counters =kzalloc (counters_size,GFP_KERNEL );if (!per_cpu (cpu_msrs, i).counters)return 0 ; -per_cpu (cpu_msrs, i).controls =kmalloc (controls_size, +per_cpu (cpu_msrs, i).controls =kzalloc (controls_size,GFP_KERNEL );if (!per_cpu (cpu_msrs, i).controls)return 0 ;
arch/x86/oprofile/op_model_amd.c +0 -4
@@ -147,15 +147,11 @@ static void op_amd_fill_in_addresses(struct op_msrs * const msrs)for (i =0 ; i <NUM_COUNTERS ; i++) {if (reserve_perfctr_nmi (MSR_K7_PERFCTR0 + i)) msrs->counters[i].addr =MSR_K7_PERFCTR0 + i; -else - msrs->counters[i].addr =0 ; }for (i =0 ; i <NUM_CONTROLS ; i++) {if (reserve_evntsel_nmi (MSR_K7_EVNTSEL0 + i)) msrs->controls[i].addr =MSR_K7_EVNTSEL0 + i; -else - msrs->controls[i].addr =0 ; } }
arch/x86/oprofile/op_model_p4.c +0 -6
@@ -394,12 +394,6 @@ static void p4_fill_in_addresses(struct op_msrs * const msrs)setup_num_counters (); stag =get_stagger (); -/* initialize some registers */ -for (i =0 ; i < num_counters; ++i) - msrs->counters[i].addr =0 ; -for (i =0 ; i < num_controls; ++i) - msrs->controls[i].addr =0 ; -/* the counter & cccr registers we pay attention to */ for (i =0 ; i < num_counters; ++i) { addr = p4_counters[VIRT_CTR (stag, i)].counter_address;
arch/x86/oprofile/op_model_ppro.c +1 -5
@@ -37,15 +37,11 @@ static void ppro_fill_in_addresses(struct op_msrs * const msrs)for (i =0 ; i < num_counters; i++) {if (reserve_perfctr_nmi (MSR_P6_PERFCTR0 + i)) msrs->counters[i].addr =MSR_P6_PERFCTR0 + i; -else - msrs->counters[i].addr =0 ; }for (i =0 ; i < num_counters; i++) {if (reserve_evntsel_nmi (MSR_P6_EVNTSEL0 + i)) msrs->controls[i].addr =MSR_P6_EVNTSEL0 + i; -else - msrs->controls[i].addr =0 ; } }
@@ -57,7 +53,7 @@ static void ppro_setup_ctrs(struct op_x86_model_spec const *model,int i;if (!reset_value) { - reset_value =kmalloc (sizeof (reset_value[0 ]) * num_counters, + reset_value =kzalloc (sizeof (reset_value[0 ]) * num_counters,GFP_ATOMIC );if (!reset_value)return ;
Signature · 1 line
1.6.6
PATCH 12/15 oprofile/x86: fix msr access to reserved counters
In reply to Robert RichterDuring switching virtual counters there is access to perfctr msrs. If the counter is not available this fails due to an invalid address. This patch fixes this.
--- arch/x86/oprofile/op_model_amd.c | 9 ++++----- 1 files changed, 4 insertions(+), 5 deletions(-)
arch/x86/oprofile/op_model_amd.c +4 -5
@@ -127,7 +127,7 @@ static void op_mux_switch_ctrl(struct op_x86_model_spec const *model,/* enable active counters */ for (i =0 ; i <NUM_COUNTERS ; ++i) {int virt =op_x86_phys_to_virt (i); -if (!counter_config[virt].enabled) +if (!reset_value[virt])continue ;rdmsrl (msrs->controls[i].addr, val); val &= model->reserved;
@@ -163,7 +163,8 @@ static void op_amd_setup_ctrs(struct op_x86_model_spec const *model,/* setup reset_value */ for (i =0 ; i <NUM_VIRT_COUNTERS ; ++i) { -if (counter_config[i].enabled) +if (counter_config[i].enabled + && msrs->counters[op_x86_virt_to_phys (i)].addr) reset_value[i] = counter_config[i].count;else reset_value[i] =0 ;
@@ -197,9 +198,7 @@ static void op_amd_setup_ctrs(struct op_x86_model_spec const *model,/* enable active counters */ for (i =0 ; i <NUM_COUNTERS ; ++i) {int virt =op_x86_phys_to_virt (i); -if (!counter_config[virt].enabled) -continue ; -if (!msrs->counters[i].addr) +if (!reset_value[virt])continue ;/* setup counter registers */
Signature · 1 line
1.6.6
PATCH 13/15 perf, x86: make IBS macros available in perf_event.h
In reply to Robert RichterThis patch moves code from oprofile to perf_event.h to make it also available for usage by perf.
--- arch/x86/include/asm/perf_event.h | 10 ++++++++++ arch/x86/oprofile/op_model_amd.c | 11 ----------- 2 files changed, 10 insertions(+), 11 deletions(-)
arch/x86/include/asm/perf_event.h +10 -0
@@ -105,6 +105,16 @@ union cpuid10_edx {*/ #define X86_PMC_IDX_FIXED_BTS (X86_PMC_IDX_FIXED + 16) +/* IbsFetchCtl bits/masks */ +#define IBS_FETCH_RAND_EN (1ULL<<57) +#define IBS_FETCH_VAL (1ULL<<49) +#define IBS_FETCH_ENABLE (1ULL<<48) +#define IBS_FETCH_CNT_MASK 0xFFFF0000ULL + +/* IbsOpCtl bits */ +#define IBS_OP_CNT_CTL (1ULL<<19) +#define IBS_OP_VAL (1ULL<<18) +#define IBS_OP_ENABLE (1ULL<<17)#ifdef CONFIG_PERF_EVENTS extern void init_hw_perf_events (void );
arch/x86/oprofile/op_model_amd.c +0 -11
@@ -46,17 +46,6 @@static unsigned long reset_value[NUM_VIRT_COUNTERS ]; -/* IbsFetchCtl bits/masks */ -#define IBS_FETCH_RAND_EN (1ULL<<57) -#define IBS_FETCH_VAL (1ULL<<49) -#define IBS_FETCH_ENABLE (1ULL<<48) -#define IBS_FETCH_CNT_MASK 0xFFFF0000ULL - -/* IbsOpCtl bits */ -#define IBS_OP_CNT_CTL (1ULL<<19) -#define IBS_OP_VAL (1ULL<<18) -#define IBS_OP_ENABLE (1ULL<<17) -#define IBS_FETCH_SIZE 6#define IBS_OP_SIZE 12
Signature · 1 line
1.6.6
PATCH 14/15 perf, x86: add some IBS macros to perf_event.h
In reply to Robert Richter--- arch/x86/include/asm/perf_event.h | 4 +++- arch/x86/oprofile/op_model_amd.c | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-)
arch/x86/include/asm/perf_event.h +3 -1
@@ -109,12 +109,14 @@ union cpuid10_edx {#define IBS_FETCH_RAND_EN (1ULL<<57)#define IBS_FETCH_VAL (1ULL<<49)#define IBS_FETCH_ENABLE (1ULL<<48) -#define IBS_FETCH_CNT_MASK 0xFFFF0000ULL +#define IBS_FETCH_CNT 0xFFFF0000ULL +#define IBS_FETCH_MAX_CNT 0x0000FFFFULL/* IbsOpCtl bits */ #define IBS_OP_CNT_CTL (1ULL<<19)#define IBS_OP_VAL (1ULL<<18)#define IBS_OP_ENABLE (1ULL<<17) +#define IBS_OP_MAX_CNT 0x0000FFFFULL#ifdef CONFIG_PERF_EVENTS extern void init_hw_perf_events (void );
arch/x86/oprofile/op_model_amd.c +3 -3
@@ -279,7 +279,7 @@ op_amd_handle_ibs(struct pt_regs * const regs,oprofile_write_commit (&entry);/* reenable the IRQ */ - ctl &= ~(IBS_FETCH_VAL |IBS_FETCH_CNT_MASK ); + ctl &= ~(IBS_FETCH_VAL |IBS_FETCH_CNT ); ctl |=IBS_FETCH_ENABLE ;wrmsrl (MSR_AMD64_IBSFETCHCTL , ctl); }
@@ -319,7 +319,7 @@ static inline void op_amd_start_ibs(void)return ;if (ibs_config.fetch_enabled) { - val = (ibs_config.max_cnt_fetch >>4 ) &0xFFFF ; + val = (ibs_config.max_cnt_fetch >>4 ) &IBS_FETCH_MAX_CNT ; val |= ibs_config.rand_en ?IBS_FETCH_RAND_EN :0 ; val |=IBS_FETCH_ENABLE ;wrmsrl (MSR_AMD64_IBSFETCHCTL , val);
@@ -341,7 +341,7 @@ static inline void op_amd_start_ibs(void)* avoid underflows. */ ibs_op_ctl =min (ibs_op_ctl +IBS_RANDOM_MAXCNT_OFFSET , -0xFFFFULL ); +IBS_OP_MAX_CNT ); }if (ibs_caps &IBS_CAPS_OPCNT && ibs_config.dispatched_ops) ibs_op_ctl |=IBS_OP_CNT_CTL ;
Signature · 1 line
1.6.6
PATCH 15/15 perf, x86: rename macro in ARCH_PERFMON_EVENTSEL_ENABLE
In reply to Robert RichterFor consistency reasons this patch renames ARCH_PERFMON_EVENTSEL0_ENABLE to ARCH_PERFMON_EVENTSEL_ENABLE.
--- arch/x86/include/asm/perf_event.h | 2 +- arch/x86/kernel/cpu/perf_event.c | 16 ++++++++-------- arch/x86/kernel/cpu/perfctr-watchdog.c | 2 +- arch/x86/oprofile/op_model_amd.c | 6 +++--- arch/x86/oprofile/op_model_ppro.c | 6 +++--- 5 files changed, 16 insertions(+), 16 deletions(-)
arch/x86/include/asm/perf_event.h +1 -1
@@ -18,7 +18,7 @@#define MSR_ARCH_PERFMON_EVENTSEL0 0x186#define MSR_ARCH_PERFMON_EVENTSEL1 0x187 -#define ARCH_PERFMON_EVENTSEL0_ENABLE (1 << 22) +#define ARCH_PERFMON_EVENTSEL_ENABLE (1 << 22)#define ARCH_PERFMON_EVENTSEL_ANY (1 << 21)#define ARCH_PERFMON_EVENTSEL_INT (1 << 20)#define ARCH_PERFMON_EVENTSEL_OS (1 << 17)
arch/x86/kernel/cpu/perf_event.c +8 -8
@@ -1069,7 +1069,7 @@ static void p6_pmu_disable_all(void)/* p6 only has one enable register */ rdmsrl (MSR_P6_EVNTSEL0 , val); - val &= ~ARCH_PERFMON_EVENTSEL0_ENABLE ; + val &= ~ARCH_PERFMON_EVENTSEL_ENABLE ;wrmsrl (MSR_P6_EVNTSEL0 , val); }
@@ -1111,9 +1111,9 @@ static void amd_pmu_disable_all(void)if (!test_bit (idx, cpuc->active_mask))continue ;rdmsrl (MSR_K7_EVNTSEL0 + idx, val); -if (!(val &ARCH_PERFMON_EVENTSEL0_ENABLE )) +if (!(val &ARCH_PERFMON_EVENTSEL_ENABLE ))continue ; - val &= ~ARCH_PERFMON_EVENTSEL0_ENABLE ; + val &= ~ARCH_PERFMON_EVENTSEL_ENABLE ;wrmsrl (MSR_K7_EVNTSEL0 + idx, val); } }
@@ -1138,7 +1138,7 @@ static void p6_pmu_enable_all(void)/* p6 only has one enable register */ rdmsrl (MSR_P6_EVNTSEL0 , val); - val |=ARCH_PERFMON_EVENTSEL0_ENABLE ; + val |=ARCH_PERFMON_EVENTSEL_ENABLE ;wrmsrl (MSR_P6_EVNTSEL0 , val); }
@@ -1184,7 +1184,7 @@ static void amd_pmu_enable_all(void)continue ; val = event->hw.config; - val |=ARCH_PERFMON_EVENTSEL0_ENABLE ; + val |=ARCH_PERFMON_EVENTSEL_ENABLE ;wrmsrl (MSR_K7_EVNTSEL0 + idx, val); } }
@@ -1213,7 +1213,7 @@ static inline void intel_pmu_ack_status(u64 ack)static inline void x86_pmu_enable_event (struct hw_perf_event *hwc,int idx) { (void )checking_wrmsrl (hwc->config_base + idx, - hwc->config |ARCH_PERFMON_EVENTSEL0_ENABLE ); + hwc->config |ARCH_PERFMON_EVENTSEL_ENABLE ); }static inline void x86_pmu_disable_event (struct hw_perf_event *hwc,int idx)
@@ -1241,7 +1241,7 @@ p6_pmu_disable_event(struct hw_perf_event *hwc, int idx)u64 val =P6_NOP_EVENT ;if (cpuc->enabled) - val |=ARCH_PERFMON_EVENTSEL0_ENABLE ; + val |=ARCH_PERFMON_EVENTSEL_ENABLE ; (void )checking_wrmsrl (hwc->config_base + idx, val); }
@@ -1366,7 +1366,7 @@ static void p6_pmu_enable_event(struct hw_perf_event *hwc, int idx) val = hwc->config;if (cpuc->enabled) - val |=ARCH_PERFMON_EVENTSEL0_ENABLE ; + val |=ARCH_PERFMON_EVENTSEL_ENABLE ; (void )checking_wrmsrl (hwc->config_base + idx, val); }
arch/x86/kernel/cpu/perfctr-watchdog.c +1 -1
@@ -691,7 +691,7 @@ static int setup_intel_arch_watchdog(unsigned nmi_hz)cpu_nmi_set_wd_enabled ();apic_write (APIC_LVTPC ,APIC_DM_NMI ); - evntsel |=ARCH_PERFMON_EVENTSEL0_ENABLE ; + evntsel |=ARCH_PERFMON_EVENTSEL_ENABLE ;wrmsr (evntsel_msr, evntsel,0 ); intel_arch_wd_ops.checkbit =1ULL << (eax.split.bit_width -1 );return 1 ;
arch/x86/oprofile/op_model_amd.c +3 -3
@@ -171,7 +171,7 @@ static void op_amd_setup_ctrs(struct op_x86_model_spec const *model,continue ; }rdmsrl (msrs->controls[i].addr, val); -if (val &ARCH_PERFMON_EVENTSEL0_ENABLE ) +if (val &ARCH_PERFMON_EVENTSEL_ENABLE )op_x86_warn_in_use (i); val &= model->reserved;wrmsrl (msrs->controls[i].addr, val);
@@ -398,7 +398,7 @@ static void op_amd_start(struct op_msrs const * const msrs)if (!reset_value[op_x86_phys_to_virt (i)])continue ;rdmsrl (msrs->controls[i].addr, val); - val |=ARCH_PERFMON_EVENTSEL0_ENABLE ; + val |=ARCH_PERFMON_EVENTSEL_ENABLE ;wrmsrl (msrs->controls[i].addr, val); }
@@ -418,7 +418,7 @@ static void op_amd_stop(struct op_msrs const * const msrs)if (!reset_value[op_x86_phys_to_virt (i)])continue ;rdmsrl (msrs->controls[i].addr, val); - val &= ~ARCH_PERFMON_EVENTSEL0_ENABLE ; + val &= ~ARCH_PERFMON_EVENTSEL_ENABLE ;wrmsrl (msrs->controls[i].addr, val); }
arch/x86/oprofile/op_model_ppro.c +3 -3
@@ -88,7 +88,7 @@ static void ppro_setup_ctrs(struct op_x86_model_spec const *model,continue ; }rdmsrl (msrs->controls[i].addr, val); -if (val &ARCH_PERFMON_EVENTSEL0_ENABLE ) +if (val &ARCH_PERFMON_EVENTSEL_ENABLE )op_x86_warn_in_use (i); val &= model->reserved;wrmsrl (msrs->controls[i].addr, val);
@@ -166,7 +166,7 @@ static void ppro_start(struct op_msrs const * const msrs)for (i =0 ; i < num_counters; ++i) {if (reset_value[i]) {rdmsrl (msrs->controls[i].addr, val); - val |=ARCH_PERFMON_EVENTSEL0_ENABLE ; + val |=ARCH_PERFMON_EVENTSEL_ENABLE ;wrmsrl (msrs->controls[i].addr, val); } }
@@ -184,7 +184,7 @@ static void ppro_stop(struct op_msrs const * const msrs)if (!reset_value[i])continue ;rdmsrl (msrs->controls[i].addr, val); - val &= ~ARCH_PERFMON_EVENTSEL0_ENABLE ; + val &= ~ARCH_PERFMON_EVENTSEL_ENABLE ;wrmsrl (msrs->controls[i].addr, val); } }
Signature · 1 line
1.6.6
Quoted 52 lines · Robert Richter
This patch series contains oprofile fixes and updates for v2.6.34. It includes:
*
Kconfigupdates and fixes (patches 1, 2, 3)
* bug fixes (patches 4, 10, 12)
* IBS cpuid detection (patch 5)
* IBS software randomization (patches 6, 7)
* print warnings if counters are reserved or in use (patches 8, 9)
* code improvements (patch 11)
* x86 updates toperf_event.hto share code between subsystems (patches 13, 14, 15)See also enclosed changelog.
Ingo, please pull from:
git://git.kernel.org/pub/scm/linux/kernel/git/rric/oprofile.gitcoreThanks,
-Robert
The following changes since commit
724e6d3fe8003c3f60bf404bf22e4e331327c596:
Linus Torvalds (1):Linux 2.6.33-rc8are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/rric/oprofile.gitcoreNaga Chumbalkar (1):
oprofile/x86: add comment to counter-in-use warningRobert Richter (13):
oprofile: remove tracing build dependency
oprofile: remove EXPERIMENTAL from the config option description oprofile/x86: removeOPROFILE_IBSconfig option oprofile/x86: remove node check in AMD IBS initialization oprofile/x86: implement IBS cpuid feature detection oprofile/x86: implement randomization for IBS periodic op counter oprofile/x86: warn user if a counter is already active oprofile/x86: fix perfctr nmi reservation for mulitplexing oprofile/x86: usekzalloc()instead ofkmalloc()oprofile/x86: fix msr access to reserved counters perf, x86: make IBS macros available inperf_event.hperf, x86: add some IBS macros toperf_event.h
perf, x86: rename macro inARCH_PERFMON_EVENTSEL_ENABLESuravee Suthikulpanit (1):
oprofile/x86: implement lsfr pseudo-random number generator for IBS
Quoted 11 lines
arch/Kconfig | 18 +-- arch/x86/include/asm/perf_event.h | 14 ++- arch/x86/kernel/cpu/perf_event.c | 16 +- arch/x86/kernel/cpu/perfctr-watchdog.c | 2 +- arch/x86/oprofile/nmi_int.c | 17 +- arch/x86/oprofile/op_model_amd.c | 261 ++++++++++++++++++++------------ arch/x86/oprofile/op_model_p4.c | 6 - arch/x86/oprofile/op_model_ppro.c | 21 ++- arch/x86/oprofile/op_x86_model.h | 20 +++ init/Kconfig | 2 +- 10 files changed, 227 insertions(+), 150 deletions(-)
Hm, the perf_event.c bits conflict quite heavily with pending changes in tip:perf/core.
So to not hold up the oprofile changes for v2.6.34 i've pulled the core oprofile changes for v2.6.34 into tip:oprofile (up to cfc9c0b, if that is fine with you), and mind reworking the last 3 patches against perf/core?
On a related note, wrt. your ongoing work for perf IBS support. The following patch by Peter:
f22f54f: perf_events, x86: Split PMU definitions into separate files
Will probably interact with those patches.
As usual you can avoid such interactions and conflicts by pushing any pending bits to Peter and me earlier. It can even be disabled temporarily (if that can be done cleanly), if IBS support is not fully working yet.
Thanks,
Ingo
Quoted 6 lines · Ingo Molnar
Hm, the
perf_event.cbits conflict quite heavily with pending changes in tip:perf/core.So to not hold up the oprofile changes for v2.6.34 i've pulled the core oprofile changes for v2.6.34 into tip:oprofile (up to cfc9c0b, if that is fine with you), and mind reworking the last 3 patches against perf/core?
Ingo & Peter,
I have a rebased version containing also a merge from:
tip/oprofile -> tip/perf/core
Please pull again from:
git://git.kernel.org/pub/scm/linux/kernel/git/rric/oprofile.git core
Quoted 5 lines
On a related note, wrt. your ongoing work for perf IBS support. The following patch by Peter:
f22f54f:
perf_events, x86: Split PMU definitions into separate files
Yes, the patches went also upstream on Friday. Will update my current patch stack now. Maybe it would have been better to first integrate all pending patches before doing that split. Conflict resolution is a pain for moving code. But anyway, it is supposed to go upstream and I will rebase my patches.
Quoted 6 lines
Will probably interact with those patches.
As usual you can avoid such interactions and conflicts by pushing any pending bits to Peter and me earlier. It can even be disabled temporarily (if that can be done cleanly), if IBS support is not fully working yet.
Hmm, I was working with latest tip/perf/core, but I was waiting with my submission for Peter's quilt queue since I know there were conflicts again.
I will start submitting patches now relative to latest tip/perf/core. There shouldn't be more patches flying around.
I decided to send the perf_event.h changes via the oprofile tree since tip/perf/core was not stable enough. The patches contain cross subsystem changes and are not only for perf. Perf-only patches I wont send upstream via oprofile.
-Robert
Signature · 3 lines
Advanced Micro Devices, Inc. Operating System Research Center email: [email protected]
Quoted 10 lines · Robert Richter
Quoted 6 lines · Ingo Molnar
Hm, the
perf_event.cbits conflict quite heavily with pending changes in tip:perf/core.So to not hold up the oprofile changes for v2.6.34 i've pulled the core oprofile changes for v2.6.34 into tip:oprofile (up to cfc9c0b, if that is fine with you), and mind reworking the last 3 patches against perf/core?
Ingo & Peter,
Quoted 7 lines
I have a rebased version containing also a merge from:
tip/oprofile -> tip/perf/core
Please pull again from:
git://git.kernel.org/pub/scm/linux/kernel/git/rric/oprofile.gitcore
Pulled, thanks Robert!
Quoted 10 lines
Quoted 4 lines
On a related note, wrt. your ongoing work for perf IBS support. The following patch by Peter:
f22f54f:
perf_events, x86: Split PMU definitions into separate filesYes, the patches went also upstream on Friday. Will update my current patch stack now. Maybe it would have been better to first integrate all pending patches before doing that split. Conflict resolution is a pain for moving code. But anyway, it is supposed to go upstream and I will rebase my patches.
The way to do it is to not keep that many pending patches in the first place. There are always 'pending patches' - if we waited for them to drain then we could never do cleanups.
Peter, Arnaldo, Frederic and all the other perf developers sync their patches with perf/core very frequently and push these bits to me. This has various advantages:
- breakages are discovered quickly and can be mitigated before more harm is done.
- patch review is a lot more gradual (and a lot less taxing) as well.
- other people can get interested and jump in and help you out.
- design mistakes/disagreements can also be hashed out before too much work is invested into a particular direction.
- as a maintainer i can see progress and can see problem areas. This makes it much easier to judge and plan a new topic's upstream integration schedule. It's not tucked away in some tree, with a large stream of patches showing up at once.
i.e. it's all variations of the 'release early, release often' Linux mantra.
So if you have a significant amount of pending patches then you are doing something wrong. Please consider adapting your workflow and please get any pending pieces to us in small, reviewable pieces.
That's especially true of large, intrusive features: for example the IBS bits could be moved into perf/core gradually, in a series of clean steps, even if they are not functional yet.
Thanks,
Ingo