perf, x86: Implement arch event mask as quirk
Subsystems (2)
Commit-ID: c1d6f42f1a42c721513e2f388c208e5348004f64 Gitweb: http://git.kernel.org/tip/c1d6f42f1a42c721513e2f388c208e5348004f64 Author: Peter Zijlstra <[email protected]> AuthorDate: Tue, 6 Dec 2011 14:07:15 +0100 Committer: Ingo Molnar <[email protected]> CommitDate: Tue, 6 Dec 2011 20:41:06 +0100
perf, x86: Implement arch event mask as quirk
Implement the disabling of arch events as a quirk so that we can print a message along with it. This creates some visibility into the problem space and could allow us to work on adding more work-around like the AAJ80 one.
Requested-by Ingo Molnar <[email protected]>
Cc Gleb Natapov <[email protected]>
Signed-off-by Peter Zijlstra <[email protected]>
Signed-off-by Ingo Molnar <[email protected]>
--- arch/x86/kernel/cpu/perf_event.c | 5 +- arch/x86/kernel/cpu/perf_event.h | 16 ++++++- arch/x86/kernel/cpu/perf_event_intel.c | 80 ++++++++++++++++++++------------ 3 files changed, 68 insertions(+), 33 deletions(-)
arch/x86/kernel/cpu/perf_event.c +3 -2
@@ -1248,6 +1248,7 @@ static void __init pmu_check_apic(void)static int __init init_hw_perf_events (void ) { +struct x86_pmu_quirk *quirk;struct event_constraint *c;int err;
@@ -1276,8 +1277,8 @@ static int __init init_hw_perf_events(void)pr_cont ("%s PMU driver.\n" , x86_pmu.name); -if (x86_pmu.quirks) - x86_pmu.quirks (); +for (quirk = x86_pmu.quirks; quirk; quirk = quirk->next) + quirk->func ();if (x86_pmu.num_counters >X86_PMC_MAX_GENERIC ) { WARN(1, KERN_ERR "hw perf events %d > max(%d), clipping!",
arch/x86/kernel/cpu/perf_event.h +15 -1
@@ -261,6 +261,11 @@ union perf_capabilities {u64 capabilities; }; +struct x86_pmu_quirk { +struct x86_pmu_quirk *next; +void (*func)(void ); +}; +/* * struct x86_pmu - generic x86 pmu */
@@ -299,7 +304,7 @@ struct x86_pmu {void (*put_event_constraints)(struct cpu_hw_events *cpuc,struct perf_event *event);struct event_constraint *event_constraints; -void (*quirks)(void ); +struct x86_pmu_quirk *quirks;int perfctr_second_write;int (*cpu_prepare)(int cpu);
@@ -340,6 +345,15 @@ struct x86_pmu {struct perf_guest_switch_msr *(*guest_get_msrs)(int *nr); }; +#define x86_add_quirk (func_) \ +do { \ + static struct x86_pmu_quirk __quirk __initdata = { \ + .func = func_, \ + }; \ + __quirk.next = x86_pmu.quirks; \ + x86_pmu.quirks = &__quirk; \ +} while (0) +#define ERF_NO_HT_SHARING 1#define ERF_HAS_RSP_1 2
arch/x86/kernel/cpu/perf_event_intel.c +50 -30
143 lines not on this page · raw message