From: Hemant Kumar <hemant@linux.vnet.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: maddy@linux.vnet.ibm.com, mpe@ellerman.id.au,
benh@kernel.crashing.org, paulus@samba.org, anton@samba.org,
sukadev@linux.vnet.ibm.com, mikey@neuling.org,
stewart@linux.vnet.ibm.com, eranian@google.com,
Hemant Kumar <hemant@linux.vnet.ibm.com>
Subject: [PATCH 0/6] IMA Instrumentation support
Date: Thu, 3 Nov 2016 12:52:29 +0530 [thread overview]
Message-ID: <1478157755-14636-1-git-send-email-hemant@linux.vnet.ibm.com> (raw)
Powerpc has In-Memory-Accumulation (IMA) infrastructure which contains
various Performance Monitoring Units (PMUs) at Nest level (these are
on-chip but off-core). These Nest PMU counters are handled by a Nest
IMA microcode. This microcode runs in the OCC (On-Chip Controller)
complex and its purpose is to program the nest counters, collect the
counter data and move the counter data to memory.
The IMA infrastructure encapsulates nest (per-chip), core and thread
level counters. While the nest IMA PMUs are handled by the nest IMA
microcode, the core and thread level PMUs are handled by the Core-HPMC
engine. This patchset enables the nest IMA PMUs and is based on the
initial work done by Madhavan Srinivasan.
"Nest Instrumentation Support" : https://lists.ozlabs.org/pipermail/linuxppc-dev/2015-August/132078.html
Nest events:
Per-chip nest instrumentation provides various per-chip metrics
such as memory, powerbus, Xlink and Alink bandwidth.
PMU Events' Information:
OPAL obtains the Nest PMU and event information from the IMA Catalog
and passes on to the kernel via the device tree. The events' information
contains :
- Event name
- Event Offset
- Event description
and, maybe :
- Event scale
- Event unit
The event offset in the memory is where the counter data gets
accumulated.
The OPAL-side patches are posted upstream :
https://lists.ozlabs.org/pipermail/skiboot/2016-October/005235.html
The kernel discovers the IMA counters information in the device tree
at the "ima-counters" device node which has a compatible field
"ibm,opal-in-memory-counters".
Parsing of the Events' information:
To parse the IMA PMUs and events information, the kernel has to
discover the "ima-counters" node and walk through the pmu and event
nodes.
Here is an excerpt of the dt showing the ima-counters and mcs node:
/dts-v1/;
[...]
ima-counters {
ima-nest-offset = <0x320000>;
compatible = "ibm,opal-in-memory-counters";
ima-nest-size = <0x30000>;
#address-cells = <0x1>;
#size-cells = <0x1>;
phandle = <0x10000238>;
version-id = [00];
mcs {
compatible = "ibm,ima-counters-chip";
ranges;
#address-cells = <0x1>;
#size-cells = <0x1>;
phandle = <0x10000279>;
PM_MCS_UP_128B_DATA_XFER_MC0@528 {
desc = "Total Read Bandwidth seen on both MCS of MC0";
phandle = <0x1000028c>;
reg = <0x118 0x8>;
scale = "1.2207e-4";
unit = "MiB";
};
[...]
>From the device tree, the kernel parses the PMUs and their events'
information.
After parsing the nest IMA PMUs and their events, the PMUs and their
attributes are registered in the kernel.
Example Usage :
# perf list
[...]
nest_alink/PM_ALINK0_IN_DATA_CYC/ [Kernel PMU event]
nest_alink/PM_ALINK0_IN_DATA_CYC_LAST_SAMPLE/ [Kernel PMU event]
nest_alink/PM_ALINK0_IN_IDL_CYC/ [Kernel PMU event]
[...]
nest_mcs/PM_MCS_DOWN_128B_DATA_XFER_MC0/ [Kernel PMU event]
nest_mcs/PM_MCS_DOWN_128B_DATA_XFER_MC0_LAST_SAMPLE/ [Kernel PMU event]
nest_mcs/PM_MCS_DOWN_128B_DATA_XFER_MC1/ [Kernel PMU event]
[...]
nest_phb/PM_PHB_ANY_DMA_RCV_PHB0/ [Kernel PMU event]
nest_phb/PM_PHB_ANY_DMA_RCV_PHB0_LAST_SAMPLE/ [Kernel PMU event]
nest_phb/PM_PHB_ANY_DMA_RCV_PHB1/ [Kernel PMU event]
[...]
# perf stat -e "nest_mcs/PM_MCS_DOWN_128B_DATA_XFER_MC2/" -e "nest_mcs/PM_MCS_UP_128B_DATA_XFER_MC2/" -a --per-socket
TODOs:
- Add support for Core IMA.
- Add support for thread IMA.
Comments/feedback/suggestions are welcome.
Cc: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Anton Blanchard <anton@samba.org>
Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
Cc: Michael Neuling <mikey@neuling.org>
Cc: Stewart Smith <stewart@linux.vnet.ibm.com>
Cc: Stephane Eranian <eranian@google.com>
Signed-off-by: Hemant Kumar <hemant@linux.vnet.ibm.com>
Hemant Kumar (6):
powerpc/powernv: Data structure and macros definitions
powerpc/powernv: Autoload IMA device driver module
powerpc/powernv: Detect supported IMA units and its events
powerpc/perf: Add event attribute and group to IMA pmus
powerpc/perf: Generic ima pmu event functions
powerpc/perf: IMA pmu cpumask and cpu hotplug support
arch/powerpc/include/asm/ima-pmu.h | 75 +++++
arch/powerpc/include/asm/opal-api.h | 3 +-
arch/powerpc/include/asm/opal.h | 2 +
arch/powerpc/perf/Makefile | 3 +-
arch/powerpc/perf/ima-pmu.c | 383 +++++++++++++++++++++
arch/powerpc/platforms/powernv/Makefile | 2 +-
arch/powerpc/platforms/powernv/opal-ima.c | 447 +++++++++++++++++++++++++
arch/powerpc/platforms/powernv/opal-wrappers.S | 1 +
arch/powerpc/platforms/powernv/opal.c | 13 +
9 files changed, 926 insertions(+), 3 deletions(-)
create mode 100644 arch/powerpc/include/asm/ima-pmu.h
create mode 100644 arch/powerpc/perf/ima-pmu.c
create mode 100644 arch/powerpc/platforms/powernv/opal-ima.c
--
2.7.4
next reply other threads:[~2016-11-03 7:23 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-03 7:22 Hemant Kumar [this message]
2016-11-03 7:22 ` [PATCH 1/6] powerpc/powernv: Data structure and macros definitions Hemant Kumar
2016-11-03 7:22 ` [PATCH 2/6] powerpc/powernv: Autoload IMA device driver module Hemant Kumar
2016-11-03 7:22 ` [PATCH 3/6] powerpc/powernv: Detect supported IMA units and its events Hemant Kumar
2016-11-03 7:22 ` [PATCH 4/6] powerpc/perf: Add event attribute and group to IMA pmus Hemant Kumar
2016-11-03 7:22 ` [PATCH 5/6] powerpc/perf: Generic ima pmu event functions Hemant Kumar
2016-11-03 7:22 ` [PATCH 6/6] powerpc/perf: IMA pmu cpumask and cpu hotplug support Hemant Kumar
2016-11-03 10:26 ` kbuild test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1478157755-14636-1-git-send-email-hemant@linux.vnet.ibm.com \
--to=hemant@linux.vnet.ibm.com \
--cc=anton@samba.org \
--cc=benh@kernel.crashing.org \
--cc=eranian@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maddy@linux.vnet.ibm.com \
--cc=mikey@neuling.org \
--cc=mpe@ellerman.id.au \
--cc=paulus@samba.org \
--cc=stewart@linux.vnet.ibm.com \
--cc=sukadev@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome