Skip to content

Commit 0d14165

Browse files
committed
Merge: Support to handle compatible mode PVR for perf
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/6242 Description: Support to handle compatible mode PVR for perf JIRA: https://issues.redhat.com/browse/RHEL-75636 Build Info: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=66443824 Tested: Verified Brew build test kernel RPMs Signed-off-by: Mamatha Inamdar <minamdar@redhat.com> Approved-by: Steve Best <sbest@redhat.com> Approved-by: Tony Camuso <tcamuso@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Rado Vrbovsky <rvrbovsk@redhat.com>
2 parents 8db6275 + 7c7f7c9 commit 0d14165

File tree

3 files changed

+149
-1
lines changed

3 files changed

+149
-1
lines changed

tools/perf/arch/powerpc/util/header.c

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,18 @@
1010
#include "utils_header.h"
1111
#include "metricgroup.h"
1212
#include <api/fs/fs.h>
13+
#include <sys/auxv.h>
14+
15+
static bool is_compat_mode(void)
16+
{
17+
u64 base_platform = getauxval(AT_BASE_PLATFORM);
18+
u64 platform = getauxval(AT_PLATFORM);
19+
20+
if (!strcmp((char *)platform, (char *)base_platform))
21+
return false;
22+
23+
return true;
24+
}
1325

1426
int
1527
get_cpuid(char *buffer, size_t sz)
@@ -33,8 +45,26 @@ char *
3345
get_cpuid_str(struct perf_pmu *pmu __maybe_unused)
3446
{
3547
char *bufp;
48+
unsigned long pvr;
49+
50+
/*
51+
* IBM Power System supports compatible mode. That is
52+
* Nth generation platform can support previous generation
53+
* OS in a mode called compatibile mode. For ex. LPAR can be
54+
* booted in a Power9 mode when the system is a Power10.
55+
*
56+
* In the compatible mode, care must be taken when generating
57+
* PVR value. When read, PVR will be of the AT_BASE_PLATFORM
58+
* To support generic events, return 0x00ffffff as pvr when
59+
* booted in compat mode. Based on this pvr value, json will
60+
* pick events from pmu-events/arch/powerpc/compat
61+
*/
62+
if (!is_compat_mode())
63+
pvr = mfspr(SPRN_PVR);
64+
else
65+
pvr = 0x00ffffff;
3666

37-
if (asprintf(&bufp, "0x%.8lx", mfspr(SPRN_PVR)) < 0)
67+
if (asprintf(&bufp, "0x%.8lx", pvr) < 0)
3868
bufp = NULL;
3969

4070
return bufp;
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
[
2+
{
3+
"EventCode": "0x600F4",
4+
"EventName": "PM_CYC",
5+
"BriefDescription": "Processor cycles."
6+
},
7+
{
8+
"EventCode": "0x100F2",
9+
"EventName": "PM_CYC_INST_CMPL",
10+
"BriefDescription": "1 or more ppc insts finished"
11+
},
12+
{
13+
"EventCode": "0x100f4",
14+
"EventName": "PM_FLOP_CMPL",
15+
"BriefDescription": "Floating Point Operations Finished."
16+
},
17+
{
18+
"EventCode": "0x100F6",
19+
"EventName": "PM_L1_ITLB_MISS",
20+
"BriefDescription": "Number of I-ERAT reloads."
21+
},
22+
{
23+
"EventCode": "0x100F8",
24+
"EventName": "PM_NO_INST_AVAIL",
25+
"BriefDescription": "Number of cycles the ICT has no itags assigned to this thread."
26+
},
27+
{
28+
"EventCode": "0x100fc",
29+
"EventName": "PM_LD_CMPL",
30+
"BriefDescription": "Load instruction completed."
31+
},
32+
{
33+
"EventCode": "0x200F0",
34+
"EventName": "PM_ST_CMPL",
35+
"BriefDescription": "Stores completed from S2Q (2nd-level store queue)."
36+
},
37+
{
38+
"EventCode": "0x200F2",
39+
"EventName": "PM_INST_DISP",
40+
"BriefDescription": "PowerPC instruction dispatched."
41+
},
42+
{
43+
"EventCode": "0x200F4",
44+
"EventName": "PM_RUN_CYC",
45+
"BriefDescription": "Processor cycles gated by the run latch."
46+
},
47+
{
48+
"EventCode": "0x200F6",
49+
"EventName": "PM_L1_DTLB_RELOAD",
50+
"BriefDescription": "DERAT Reloaded due to a DERAT miss."
51+
},
52+
{
53+
"EventCode": "0x200FA",
54+
"EventName": "PM_BR_TAKEN_CMPL",
55+
"BriefDescription": "Branch Taken instruction completed."
56+
},
57+
{
58+
"EventCode": "0x200FC",
59+
"EventName": "PM_L1_ICACHE_MISS",
60+
"BriefDescription": "Demand instruction cache miss."
61+
},
62+
{
63+
"EventCode": "0x200FE",
64+
"EventName": "PM_L1_RELOAD_FROM_MEM",
65+
"BriefDescription": "L1 Dcache reload from memory"
66+
},
67+
{
68+
"EventCode": "0x300F0",
69+
"EventName": "PM_ST_MISS_L1",
70+
"BriefDescription": "Store Missed L1"
71+
},
72+
{
73+
"EventCode": "0x300FC",
74+
"EventName": "PM_DTLB_MISS",
75+
"BriefDescription": "Data PTEG reload"
76+
},
77+
{
78+
"EventCode": "0x300FE",
79+
"EventName": "PM_DATA_FROM_L3MISS",
80+
"BriefDescription": "Demand LD - L3 Miss (not L2 hit and not L3 hit)"
81+
},
82+
{
83+
"EventCode": "0x400F0",
84+
"EventName": "PM_LD_MISS_L1",
85+
"BriefDescription": "L1 Dcache load miss"
86+
},
87+
{
88+
"EventCode": "0x400F2",
89+
"EventName": "PM_CYC_INST_DISP",
90+
"BriefDescription": "Cycle when instruction(s) dispatched."
91+
},
92+
{
93+
"EventCode": "0x400F6",
94+
"EventName": "PM_BR_MPRED_CMPL",
95+
"BriefDescription": "A mispredicted branch completed. Includes direction and target."
96+
},
97+
{
98+
"EventCode": "0x400FA",
99+
"EventName": "PM_RUN_INST_CMPL",
100+
"BriefDescription": "PowerPC instruction completed while the run latch is set."
101+
},
102+
{
103+
"EventCode": "0x400FC",
104+
"EventName": "PM_ITLB_MISS",
105+
"BriefDescription": "Instruction TLB reload (after a miss), all page sizes. Includes only demand misses."
106+
},
107+
{
108+
"EventCode": "0x400fe",
109+
"EventName": "PM_LD_NOT_CACHED",
110+
"BriefDescription": "Load data not cached."
111+
},
112+
{
113+
"EventCode": "0x500fa",
114+
"EventName": "PM_INST_CMPL",
115+
"BriefDescription": "Instructions."
116+
}
117+
]

tools/perf/pmu-events/arch/powerpc/mapfile.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@
1616
0x004e[[:xdigit:]]{4},1,power9,core
1717
0x0080[[:xdigit:]]{4},1,power10,core
1818
0x0082[[:xdigit:]]{4},1,power10,core
19+
0x00ffffff,1,compat,core

0 commit comments

Comments
 (0)