aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephane Eranian <eranian@google.com>2014-02-11 10:20:08 -0500
committerThomas Gleixner <tglx@linutronix.de>2014-02-21 15:49:07 -0500
commitd64b25b6a08d95e973160689320504faed62be4a (patch)
tree613c886e71d4a9bd91a4821861fefef468655fec
parent411cf180fa00521f9bfb1d022e3ebf059a2d299f (diff)
perf/x86/uncore: add ability to customize pmu callbacks
This patch enables custom struct pmu callbacks per uncore PMU types. This feature may be used to simplify counter setup for certain uncore PMUs which have free running counters for instance. It becomes possible to bypass the event scheduling phase of the configuration. Cc: mingo@elte.hu Cc: acme@redhat.com Cc: ak@linux.intel.com Cc: zheng.z.yan@intel.com Cc: peterz@infradead.org Signed-off-by: Stephane Eranian <eranian@google.com> Signed-off-by: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/1392132015-14521-3-git-send-email-eranian@google.com Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel_uncore.c25
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel_uncore.h1
2 files changed, 16 insertions, 10 deletions
diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.c b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
index fe4255b9be55..e6f32b36c9be 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
@@ -3271,16 +3271,21 @@ static int __init uncore_pmu_register(struct intel_uncore_pmu *pmu)
3271{ 3271{
3272 int ret; 3272 int ret;
3273 3273
3274 pmu->pmu = (struct pmu) { 3274 if (!pmu->type->pmu) {
3275 .attr_groups = pmu->type->attr_groups, 3275 pmu->pmu = (struct pmu) {
3276 .task_ctx_nr = perf_invalid_context, 3276 .attr_groups = pmu->type->attr_groups,
3277 .event_init = uncore_pmu_event_init, 3277 .task_ctx_nr = perf_invalid_context,
3278 .add = uncore_pmu_event_add, 3278 .event_init = uncore_pmu_event_init,
3279 .del = uncore_pmu_event_del, 3279 .add = uncore_pmu_event_add,
3280 .start = uncore_pmu_event_start, 3280 .del = uncore_pmu_event_del,
3281 .stop = uncore_pmu_event_stop, 3281 .start = uncore_pmu_event_start,
3282 .read = uncore_pmu_event_read, 3282 .stop = uncore_pmu_event_stop,
3283 }; 3283 .read = uncore_pmu_event_read,
3284 };
3285 } else {
3286 pmu->pmu = *pmu->type->pmu;
3287 pmu->pmu.attr_groups = pmu->type->attr_groups;
3288 }
3284 3289
3285 if (pmu->type->num_boxes == 1) { 3290 if (pmu->type->num_boxes == 1) {
3286 if (strlen(pmu->type->name) > 0) 3291 if (strlen(pmu->type->name) > 0)
diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.h b/arch/x86/kernel/cpu/perf_event_intel_uncore.h
index a80ab71a883d..77dc9a575fd9 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_uncore.h
+++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.h
@@ -440,6 +440,7 @@ struct intel_uncore_type {
440 struct intel_uncore_ops *ops; 440 struct intel_uncore_ops *ops;
441 struct uncore_event_desc *event_descs; 441 struct uncore_event_desc *event_descs;
442 const struct attribute_group *attr_groups[4]; 442 const struct attribute_group *attr_groups[4];
443 struct pmu *pmu; /* for custom pmu ops */
443}; 444};
444 445
445#define pmu_group attr_groups[0] 446#define pmu_group attr_groups[0]