perf/x86: Add 'index' param to get_event_constraint() callback
This patch adds an index parameter to the get_event_constraint() x86_pmu callback. It is expected to represent the index of the event in the cpuc->event_list[] array. When the callback is used for fake_cpuc (evnet validation), then the index must be -1. The motivation for passing the index is to use it to index into another cpuc array. Signed-off-by: Stephane Eranian <eranian@google.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: bp@alien8.de Cc: jolsa@redhat.com Cc: kan.liang@intel.com Cc: maria.n.dimakopoulou@gmail.com Link: http://lkml.kernel.org/r/1416251225-17721-5-git-send-email-eranian@google.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:

committed by
Ingo Molnar

parent
c5362c0c37
commit
79cba82244
@@ -789,7 +789,7 @@ int x86_schedule_events(struct cpu_hw_events *cpuc, int n, int *assign)
|
||||
|
||||
for (i = 0, wmin = X86_PMC_IDX_MAX, wmax = 0; i < n; i++) {
|
||||
hwc = &cpuc->event_list[i]->hw;
|
||||
c = x86_pmu.get_event_constraints(cpuc, cpuc->event_list[i]);
|
||||
c = x86_pmu.get_event_constraints(cpuc, i, cpuc->event_list[i]);
|
||||
hwc->constraint = c;
|
||||
|
||||
wmin = min(wmin, c->weight);
|
||||
@@ -1777,7 +1777,7 @@ static int validate_event(struct perf_event *event)
|
||||
if (IS_ERR(fake_cpuc))
|
||||
return PTR_ERR(fake_cpuc);
|
||||
|
||||
c = x86_pmu.get_event_constraints(fake_cpuc, event);
|
||||
c = x86_pmu.get_event_constraints(fake_cpuc, -1, event);
|
||||
|
||||
if (!c || !c->weight)
|
||||
ret = -EINVAL;
|
||||
|
Reference in New Issue
Block a user