diff options
author | Maria Dimakopoulou <maria.n.dimakopoulou@gmail.com> | 2014-11-17 14:06:55 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2015-04-02 11:33:09 -0400 |
commit | c5362c0c376486afcf3c91d3c2691d348ac1e2fd (patch) | |
tree | 5d2163d2e4007cd0199ab89052be1073a78bce10 | |
parent | 90413464313e00fe4975f4a0ebf25fe31d01f793 (diff) |
perf/x86: Add 3 new scheduling callbacks
This patch adds 3 new PMU model specific callbacks
during the event scheduling done by x86_schedule_events().
->start_scheduling(): invoked when entering the schedule routine.
->stop_scheduling(): invoked at the end of the schedule routine
->commit_scheduling(): invoked for each committed event
To be used optionally by model-specific code.
Signed-off-by: Maria Dimakopoulou <maria.n.dimakopoulou@gmail.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Stephane Eranian <eranian@google.com>
Cc: bp@alien8.de
Cc: jolsa@redhat.com
Cc: kan.liang@intel.com
Link: http://lkml.kernel.org/r/1416251225-17721-4-git-send-email-eranian@google.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | arch/x86/kernel/cpu/perf_event.c | 9 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/perf_event.h | 9 |
2 files changed, 18 insertions, 0 deletions
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c index 682ef00727e7..cd6115867fb8 100644 --- a/arch/x86/kernel/cpu/perf_event.c +++ b/arch/x86/kernel/cpu/perf_event.c | |||
@@ -784,6 +784,9 @@ int x86_schedule_events(struct cpu_hw_events *cpuc, int n, int *assign) | |||
784 | 784 | ||
785 | bitmap_zero(used_mask, X86_PMC_IDX_MAX); | 785 | bitmap_zero(used_mask, X86_PMC_IDX_MAX); |
786 | 786 | ||
787 | if (x86_pmu.start_scheduling) | ||
788 | x86_pmu.start_scheduling(cpuc); | ||
789 | |||
787 | for (i = 0, wmin = X86_PMC_IDX_MAX, wmax = 0; i < n; i++) { | 790 | for (i = 0, wmin = X86_PMC_IDX_MAX, wmax = 0; i < n; i++) { |
788 | hwc = &cpuc->event_list[i]->hw; | 791 | hwc = &cpuc->event_list[i]->hw; |
789 | c = x86_pmu.get_event_constraints(cpuc, cpuc->event_list[i]); | 792 | c = x86_pmu.get_event_constraints(cpuc, cpuc->event_list[i]); |
@@ -830,6 +833,8 @@ int x86_schedule_events(struct cpu_hw_events *cpuc, int n, int *assign) | |||
830 | for (i = 0; i < n; i++) { | 833 | for (i = 0; i < n; i++) { |
831 | e = cpuc->event_list[i]; | 834 | e = cpuc->event_list[i]; |
832 | e->hw.flags |= PERF_X86_EVENT_COMMITTED; | 835 | e->hw.flags |= PERF_X86_EVENT_COMMITTED; |
836 | if (x86_pmu.commit_scheduling) | ||
837 | x86_pmu.commit_scheduling(cpuc, e, assign[i]); | ||
833 | } | 838 | } |
834 | } | 839 | } |
835 | /* | 840 | /* |
@@ -850,6 +855,10 @@ int x86_schedule_events(struct cpu_hw_events *cpuc, int n, int *assign) | |||
850 | x86_pmu.put_event_constraints(cpuc, e); | 855 | x86_pmu.put_event_constraints(cpuc, e); |
851 | } | 856 | } |
852 | } | 857 | } |
858 | |||
859 | if (x86_pmu.stop_scheduling) | ||
860 | x86_pmu.stop_scheduling(cpuc); | ||
861 | |||
853 | return num ? -EINVAL : 0; | 862 | return num ? -EINVAL : 0; |
854 | } | 863 | } |
855 | 864 | ||
diff --git a/arch/x86/kernel/cpu/perf_event.h b/arch/x86/kernel/cpu/perf_event.h index 55b915511e53..ea27e63fc945 100644 --- a/arch/x86/kernel/cpu/perf_event.h +++ b/arch/x86/kernel/cpu/perf_event.h | |||
@@ -460,6 +460,15 @@ struct x86_pmu { | |||
460 | 460 | ||
461 | void (*put_event_constraints)(struct cpu_hw_events *cpuc, | 461 | void (*put_event_constraints)(struct cpu_hw_events *cpuc, |
462 | struct perf_event *event); | 462 | struct perf_event *event); |
463 | |||
464 | void (*commit_scheduling)(struct cpu_hw_events *cpuc, | ||
465 | struct perf_event *event, | ||
466 | int cntr); | ||
467 | |||
468 | void (*start_scheduling)(struct cpu_hw_events *cpuc); | ||
469 | |||
470 | void (*stop_scheduling)(struct cpu_hw_events *cpuc); | ||
471 | |||
463 | struct event_constraint *event_constraints; | 472 | struct event_constraint *event_constraints; |
464 | struct x86_pmu_quirk *quirks; | 473 | struct x86_pmu_quirk *quirks; |
465 | int perfctr_second_write; | 474 | int perfctr_second_write; |