perf_events, x86: Fixup fixed counter constraints
Patch1da53e0230
("perf_events, x86: Improve x86 event scheduling") lost us one of the fixed purpose counters and thened8777fc13
("perf_events, x86: Fix event constraint masks") broke it even further. Widen the fixed event mask to event+umask and specify the full config for each of the 3 fixed purpose counters. Then let the init code fill out the placement for the GP regs based on the cpuid info. Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Stephane Eranian <eranian@google.com> LKML-Reference: <new-submission> Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
committed by
Ingo Molnar
parent
320ebf09cb
commit
b622d644c7
@@ -73,10 +73,10 @@ struct debug_store {
|
||||
struct event_constraint {
|
||||
union {
|
||||
unsigned long idxmsk[BITS_TO_LONGS(X86_PMC_IDX_MAX)];
|
||||
u64 idxmsk64[1];
|
||||
u64 idxmsk64;
|
||||
};
|
||||
int code;
|
||||
int cmask;
|
||||
u64 code;
|
||||
u64 cmask;
|
||||
int weight;
|
||||
};
|
||||
|
||||
@@ -103,7 +103,7 @@ struct cpu_hw_events {
|
||||
};
|
||||
|
||||
#define __EVENT_CONSTRAINT(c, n, m, w) {\
|
||||
{ .idxmsk64[0] = (n) }, \
|
||||
{ .idxmsk64 = (n) }, \
|
||||
.code = (c), \
|
||||
.cmask = (m), \
|
||||
.weight = (w), \
|
||||
@@ -116,7 +116,7 @@ struct cpu_hw_events {
|
||||
EVENT_CONSTRAINT(c, n, INTEL_ARCH_EVTSEL_MASK)
|
||||
|
||||
#define FIXED_EVENT_CONSTRAINT(c, n) \
|
||||
EVENT_CONSTRAINT(c, n, INTEL_ARCH_FIXED_MASK)
|
||||
EVENT_CONSTRAINT(c, (1ULL << (32+n)), INTEL_ARCH_FIXED_MASK)
|
||||
|
||||
#define EVENT_CONSTRAINT_END \
|
||||
EVENT_CONSTRAINT(0, 0, 0)
|
||||
@@ -615,8 +615,8 @@ static int x86_schedule_events(struct cpu_hw_events *cpuc, int n, int *assign)
|
||||
bitmap_zero(used_mask, X86_PMC_IDX_MAX);
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
constraints[i] =
|
||||
x86_pmu.get_event_constraints(cpuc, cpuc->event_list[i]);
|
||||
c = x86_pmu.get_event_constraints(cpuc, cpuc->event_list[i]);
|
||||
constraints[i] = c;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1350,6 +1350,7 @@ static void __init pmu_check_apic(void)
|
||||
|
||||
void __init init_hw_perf_events(void)
|
||||
{
|
||||
struct event_constraint *c;
|
||||
int err;
|
||||
|
||||
pr_info("Performance Events: ");
|
||||
@@ -1398,6 +1399,16 @@ void __init init_hw_perf_events(void)
|
||||
__EVENT_CONSTRAINT(0, (1ULL << x86_pmu.num_events) - 1,
|
||||
0, x86_pmu.num_events);
|
||||
|
||||
if (x86_pmu.event_constraints) {
|
||||
for_each_event_constraint(c, x86_pmu.event_constraints) {
|
||||
if (c->cmask != INTEL_ARCH_FIXED_MASK)
|
||||
continue;
|
||||
|
||||
c->idxmsk64 |= (1ULL << x86_pmu.num_events) - 1;
|
||||
c->weight += x86_pmu.num_events;
|
||||
}
|
||||
}
|
||||
|
||||
pr_info("... version: %d\n", x86_pmu.version);
|
||||
pr_info("... bit width: %d\n", x86_pmu.event_bits);
|
||||
pr_info("... generic registers: %d\n", x86_pmu.num_events);
|
||||
|
Reference in New Issue
Block a user