• Andi Kleen's avatar
    perf/x86/intel: Add topdown events to Intel Core · a39fcae7
    Andi Kleen authored
    Add declarations for the events needed for topdown to the
    Intel big core CPUs starting with Sandy Bridge. We need
    to report different values if HyperThreading is on or off.
    The only thing this patch does is to export some events
    in sysfs.
    topdown level 1 uses a set of abstracted metrics which
    are generic to out of order CPU cores (although some
    CPUs may not implement all of them):
    topdown-total-slots	  Available slots in the pipeline
    topdown-slots-issued	  Slots issued into the pipeline
    topdown-slots-retired	  Slots successfully retired
    topdown-fetch-bubbles	  Pipeline gaps in the frontend
    topdown-recovery-bubbles  Pipeline gaps during recovery
    			  from misspeculation
    A slot is a single operation in the CPU pipe line.
    These metrics then allow to compute four useful metrics:
    FrontendBound, BackendBound, Retiring, BadSpeculation.
    The formulas to compute the metrics are generic, they
    only change based on the availability on the abstracted
    input values.
    The kernel declares the events supported by the current
    CPU and their scaling factors (such as the pipeline width)
    and perf stat then computes the formulas based on the
    available metrics.  This is similar how existing
    perf metrics, such as TSC metrics or IPC, are implemented.
    This abstracts all CPU pipe line specific knowledge in the
    kernel driver, but still avoids the need for larger scale perf
    interface changes.
    For HyperThreading the any bit is needed to get accurate
    values when both threads are executing. This implies that
    the events can only be collected as root or with
    perf_event_paranoid=-1 for now.
    The basic scheme is based on the following paper:
      Yasin, A Top Down Method for Performance analysis and Counter architecture ISPASS14 (pdf available via google)
    Signed-off-by: default avatarAndi Kleen <ak@linux.intel.com>
    Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
    Cc: Jiri Olsa <jolsa@redhat.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Stephane Eranian <eranian@google.com>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Vince Weaver <vincent.weaver@maine.edu>
    Cc: acme@kernel.org
    Cc: jolsa@kernel.org
    Link: http://lkml.kernel.org/r/1463703002-19686-4-git-send-email-andi@firstfloor.orgSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
core.c 112 KB