]> git.karo-electronics.de Git - karo-tx-linux.git/commit
perf, x86: Implement IBS event configuration
authorRobert Richter <robert.richter@amd.com>
Wed, 21 Apr 2010 17:11:37 +0000 (19:11 +0200)
committerRobert Richter <robert.richter@amd.com>
Thu, 15 Dec 2011 14:17:40 +0000 (15:17 +0100)
commit5b9c9d73f1eb5df8bb89b01b05e89292c1130ec5
treecdbf01c4d1080efbd3b6763efd664a8d8cc309e1
parentb80b3e4a4248d7a6f8e8ee7b4ed8d9fe677e061f
perf, x86: Implement IBS event configuration

This patch implements perf configuration for AMD IBS. The IBS pmu is
selected using the type attribute in sysfs. There are two types of ibs
pmus, for instruction fetch (IBS_FETCH) and for instruction execution
(IBS_OP):

 /sys/bus/event_source/devices/ibs_fetch/type
 /sys/bus/event_source/devices/ibs_op/type

Except for the sample period IBS can only be set up with raw config
values and raw data samples. The event attributes for the syscall
should be programmed like this (IBS_FETCH):

        type = get_pmu_type("/sys/bus/event_source/devices/ibs_fetch/type");

        memset(&attr, 0, sizeof(attr));
        attr.type        = type;
        attr.sample_type = PERF_SAMPLE_CPU | PERF_SAMPLE_RAW;
        attr.config      = IBS_FETCH_CONFIG_DEFAULT;

This implementation does not yet support 64 bit counters. It is
limited to the hardware counter bit width which is 20 bits. 64 bit
support can be added later.

V3:
* disable per-task monitoring (mark pmu with perf_invalid_context),
  per-task monitoring can be added in a separate patch

Signed-off-by: Robert Richter <robert.richter@amd.com>
arch/x86/kernel/cpu/perf_event_amd_ibs.c