Skip to content

Commit f0fabf9

Browse files
Ravi Bangoriaacmel
authored andcommitted
perf mem/c2c: Fix perf_mem_events to support powerpc
PowerPC hardware does not have a builtin latency filter (--ldlat) for the "mem-load" event and perf_mem_events by default includes "/ldlat=30/" which is causing a failure on PowerPC. Refactor the code to support "perf mem/c2c" on PowerPC. This patch depends on kernel side changes done my Madhavan: https://lists.ozlabs.org/pipermail/linuxppc-dev/2018-December/182596.html Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com> Acked-by: Jiri Olsa <jolsa@kernel.org> Cc: Dick Fowles <fowles@inreach.com> Cc: Don Zickus <dzickus@redhat.com> Cc: Joe Mario <jmario@redhat.com> Cc: Madhavan Srinivasan <maddy@linux.vnet.ibm.com> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Namhyung Kim <namhyung@kernel.org> Cc: linuxppc-dev@lists.ozlabs.org Link: http://lkml.kernel.org/r/20190129132412.771-1-ravi.bangoria@linux.ibm.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 489338a commit f0fabf9

File tree

5 files changed

+26
-6
lines changed

5 files changed

+26
-6
lines changed

tools/perf/Documentation/perf-c2c.txt

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,11 @@ C2C stands for Cache To Cache.
1919
The perf c2c tool provides means for Shared Data C2C/HITM analysis. It allows
2020
you to track down the cacheline contentions.
2121

22-
The tool is based on x86's load latency and precise store facility events
23-
provided by Intel CPUs. These events provide:
22+
On x86, the tool is based on load latency and precise store facility events
23+
provided by Intel CPUs. On PowerPC, the tool uses random instruction sampling
24+
with thresholding feature.
25+
26+
These events provide:
2427
- memory address of the access
2528
- type of the access (load and store details)
2629
- latency (in cycles) of the load access
@@ -46,7 +49,7 @@ RECORD OPTIONS
4649

4750
-l::
4851
--ldlat::
49-
Configure mem-loads latency.
52+
Configure mem-loads latency. (x86 only)
5053

5154
-k::
5255
--all-kernel::
@@ -119,11 +122,16 @@ Following perf record options are configured by default:
119122
-W,-d,--phys-data,--sample-cpu
120123

121124
Unless specified otherwise with '-e' option, following events are monitored by
122-
default:
125+
default on x86:
123126

124127
cpu/mem-loads,ldlat=30/P
125128
cpu/mem-stores/P
126129

130+
and following on PowerPC:
131+
132+
cpu/mem-loads/
133+
cpu/mem-stores/
134+
127135
User can pass any 'perf record' option behind '--' mark, like (to enable
128136
callchains and system wide monitoring):
129137

tools/perf/Documentation/perf-mem.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ RECORD OPTIONS
8282
Be more verbose (show counter open errors, etc)
8383

8484
--ldlat <n>::
85-
Specify desired latency for loads event.
85+
Specify desired latency for loads event. (x86 only)
8686

8787
In addition, for report all perf report options are valid, and for record
8888
all perf record options.

tools/perf/arch/powerpc/util/Build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ libperf-y += header.o
22
libperf-y += sym-handling.o
33
libperf-y += kvm-stat.o
44
libperf-y += perf_regs.o
5+
libperf-y += mem-events.o
56

67
libperf-$(CONFIG_DWARF) += dwarf-regs.o
78
libperf-$(CONFIG_DWARF) += skip-callchain-idx.o
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
#include "mem-events.h"
3+
4+
/* PowerPC does not support 'ldlat' parameter. */
5+
char *perf_mem_events__name(int i)
6+
{
7+
if (i == PERF_MEM_EVENTS__LOAD)
8+
return (char *) "cpu/mem-loads/";
9+
10+
return (char *) "cpu/mem-stores/";
11+
}

tools/perf/util/mem-events.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ struct perf_mem_event perf_mem_events[PERF_MEM_EVENTS__MAX] = {
2828
static char mem_loads_name[100];
2929
static bool mem_loads_name__init;
3030

31-
char *perf_mem_events__name(int i)
31+
char * __weak perf_mem_events__name(int i)
3232
{
3333
if (i == PERF_MEM_EVENTS__LOAD) {
3434
if (!mem_loads_name__init) {

0 commit comments

Comments
 (0)