perf_events: Add event constraints support for Intel processors
authorStephane Eranian <eranian@googlemail.com>
Tue, 6 Oct 2009 14:42:09 +0000 (16:42 +0200)
committerIngo Molnar <mingo@elte.hu>
Fri, 9 Oct 2009 13:56:12 +0000 (15:56 +0200)
commitb690081d4d3f6a23541493f1682835c3cd5c54a1
tree43b7859a8e75ef2b95a8de8eaa1feba6d64fa85f
parent04a705df47d1ea27ca2b066f24b1951c51792d0d
perf_events: Add event constraints support for Intel processors

On some Intel processors, not all events can be measured in all
counters. Some events can only be measured in one particular
counter, for instance. Assigning an event to the wrong counter does
not crash the machine but this yields bogus counts, i.e., silent
error.

This patch changes the event to counter assignment logic to take
into account event constraints for Intel P6, Core and Nehalem
processors. There is no contraints on Intel Atom. There are
constraints on Intel Yonah (Core Duo) but they are not provided in
this patch given that this processor is not yet supported by
perf_events.

As a result of the constraints, it is possible for some event
groups to never actually be loaded onto the PMU if they contain two
events which can only be measured on a single counter. That
situation can be detected with the scaling information extracted
with read().

Signed-off-by: Stephane Eranian <eranian@gmail.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <1254840129-6198-3-git-send-email-eranian@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/kernel/cpu/perf_event.c