[RFC PATCH 0/7] powerpc/powernv: Nest Instrumentation support

From: Madhavan Srinivasan
Date: Wed Mar 11 2015 - 09:08:29 EST

This patchset enables Nest Instrumentation support on powerpc.
POWER8 has per-chip Nest Intrumentation which provides various
per-chip utilisation metrics like memory bandwidth, IO bandwidth
and many other component metrics.

Nest Instrumentation provides an interface (via PORE Engine)
to configure and move the nest counter data to memory. From
kernel side, OPAL Call interface is used to activate/deactivate
PORE Engine for nest data collection.

OPAL at boot, detects the feature, initializes it and pass on
the nest units and other related information such as memory
region, events supported so on, to kernel via device-tree.

Patchset uses Intel's uncore framework to enable the consumption
of Nest instrumentation data on powerpc. First three patches are
derived from arch/x86/kernel/cpu/perf_event_intel_uncore.[c/h].
But patches differ since "box" level abstration is not implemented
As a TODO, need to rework the code to reduce code duplication.

Fourth patch in the series adds the OPAL call interface to kernel.
Fifth patch defines a generic pmu functions to be shared by all
nest pmu units. And sixth patch defines the Device-tree parsing
functions to populate various structures to aid the pmu registration.
Patch also explains the device-tree layout for nest counter units.

Here is sample perf usage to explain the interface and
values represeneted here are bogus, since platform enablement is

# ./perf list
uncore_mcs_0/mcs_read/ [Kernel PMU event]
uncore_mcs_0/mcs_write/ [Kernel PMU event]
uncore_mcs_1/mcs_read/ [Kernel PMU event]
uncore_mcs_1/mcs_write/ [Kernel PMU event]
uncore_mcs_2/mcs_read/ [Kernel PMU event]
uncore_mcs_2/mcs_write/ [Kernel PMU event]
uncore_mcs_3/mcs_read/ [Kernel PMU event]
uncore_mcs_3/mcs_write/ [Kernel PMU event]

[root@ltctul57a-p1 perf]# ./perf stat -e 'uncore_mcs_0/mcs_read/' -e 'uncore_mcs_0/mcs_write/' -a sleep 1

Performance counter stats for 'system wide':

64.00 MiB/s uncore_mcs_0/mcs_read/ [100.00%]
64.00 MiB/s uncore_mcs_0/mcs_write/

1.000723515 seconds time elapsed

Kindly let me know you comments and feedback.

Madhavan Srinivasan (7):
powerpc/powernv: Data structure and macros definition
powerpc/powernv: uncore foundation code
powerpc/powernv: uncore cpumask and CPU hotplug
powerpc/powernv: Add OPAL support for uncore pmu
powerpc/powernv: Add POWER8 uncore pmu support
powerpc/powernv: add support to parse dt for uncore pmu
powerpc/powernv: enable uncore related file in Makefile

arch/powerpc/include/asm/opal.h | 3 +
arch/powerpc/perf/Makefile | 2 +-
arch/powerpc/perf/uncore_pmu.c | 260 ++++++++++++++++
arch/powerpc/perf/uncore_pmu.h | 89 ++++++
arch/powerpc/perf/uncore_pmu_p8.c | 403 +++++++++++++++++++++++++
arch/powerpc/platforms/powernv/opal-wrappers.S | 1 +
6 files changed, 757 insertions(+), 1 deletion(-)
create mode 100644 arch/powerpc/perf/uncore_pmu.c
create mode 100644 arch/powerpc/perf/uncore_pmu.h
create mode 100644 arch/powerpc/perf/uncore_pmu_p8.c


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/