perf/x86: Export some PMU attributes in caps/ directory
authorAndi Kleen <ak@linux.intel.com>
Tue, 22 Aug 2017 18:52:01 +0000 (11:52 -0700)
committerIngo Molnar <mingo@kernel.org>
Fri, 25 Aug 2017 09:04:20 +0000 (11:04 +0200)
commitb00233b5306512a09e339d69ef5e390a77f2d302
tree7422f4c5242cdecb440392915b36371fe42028c3
parenta5df70c354c26e20d5fd8eb64517f724e97ef0b2
perf/x86: Export some PMU attributes in caps/ directory

It can be difficult to figure out for user programs what features
the x86 CPU PMU driver actually supports. Currently it requires
grepping in dmesg, but dmesg is not always available.

This adds a caps directory to /sys/bus/event_source/devices/cpu/,
similar to the caps already used on intel_pt, which can be used to
discover the available capabilities cleanly.

Three capabilities are defined:

 - pmu_name: Underlying CPU name known to the driver
 - max_precise: Max precise level supported
 - branches: Known depth of LBR.

Example:

  % grep . /sys/bus/event_source/devices/cpu/caps/*
  /sys/bus/event_source/devices/cpu/caps/branches:32
  /sys/bus/event_source/devices/cpu/caps/max_precise:3
  /sys/bus/event_source/devices/cpu/caps/pmu_name:skylake

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20170822185201.9261-3-andi@firstfloor.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/x86/events/core.c
arch/x86/events/intel/core.c
arch/x86/events/perf_event.h