+41
−5
tools/arch/x86/include/asm/amd-ibs.h
0 → 100644
+136
−0
+20
−0
Loading
Merge Pull Request from: @PvsNarasimha
perf support:
sample type PERF_SAMPLE_DATA_PAGE_SIZE support
perf tools: Support PERF_SAMPLE_WEIGHT_STRUCT
perf record ibs: Warn about sampling period skew
HYBRID_TOPOLOGY feature
Record non-CPU PMU capabilities
perf script ibs: Support new IBS bits in raw trace dump
perf tool support for IBS DataSrc and L3 miss filtering
"ref-cycles" event support for Zen 4 and later microarchitectures
Install perf and perftest tool to verify patched kernel.
```javascript
#cd /kernel/tools/perf/
#sudo make perf
#cp perf /usr/bin/
```
*Run Test cases*
-----------------------------
* perf/x86/amd/core: Define a proper ref-cycles event for Zen 4 and later
* perf/x86/amd/core: Update and fix stalled-cycles-* events for Zen 2 and later
* x86: Fix comment for X86_FEATURE_ZEN
```javascript
perf list | grep ref-cycles
ref-cycles [Hardware event]
ref-cycles OR cpu/ref-cycles/ [Kernel PMU event]
```
```javascript
perf stat -e "{ref-cycles, cpu/ref-cycles/}" sleep 5
Performance counter stats for 'sleep 5':
371,296 ref-cycles:u
371,296 cpu/ref-cycles/u
5.002200577 seconds time elapsed
0.000000000 seconds user
0.001862000 seconds sys
```
-------------------------------------------------------------------
* perf script ibs: Support new IBS bits in raw trace dump
* perf tool ibs: Sync AMD IBS header file
* perf report: Add support to print a textual representation of IBS raw sample data
* perf evlist: Use the right prefix for 'struct evlist' sample id lookup methods
* perf evlist: Use the right prefix for 'struct evlist' sample parsing methods
* perf evlist: Use the right prefix for 'struct evlist' raw samples methods
* perf report: Add tools/arch/x86/include/asm/amd-ibs.h
```javascript
$sudo perf record -c 130 -a -e ibs_op/l3missonly=1/ --raw-samples
$sudo perf report -D
```
...
ibs_op_ctl: 0000004500070008 MaxCnt 128 L3MissOnly 1 En 1
Val 1 CntCtl 0=cycles CurCnt 69
ibs_op_data: 0000000000710002 CompToRetCtr 2 TagToRetCtr 113
BrnRet 0 RipInvalid 0 BrnFuse 0 Microcode 0
ibs_op_data2: 0000000000000002 CacheHitSt 0=M-state RmtNode 0
DataSrc 2=A peer cache in a near CCX
ibs_op_data3: 000000681d1700a1 LdOp 1 StOp 0 DcL1TlbMiss 0
DcL2TlbMiss 0 DcL1TlbHit2M 0 DcL1TlbHit1G 1 DcL2TlbHit2M 0
DcMiss 1 DcMisAcc 0 DcWcMemAcc 0 DcUcMemAcc 0 DcLockedOp 0
DcMissNoMabAlloc 1 DcLinAddrValid 1 DcPhyAddrValid 1
DcL2TlbHit1G 0 L2Miss 1 SwPf 0 OpMemWidth 8 bytes
OpDcMissOpenMemReqs 7 DcMissLat 104 TlbRefillLat 0
```
*IBS Fetch PMU ex:*
```javascript
$sudo perf record -c 130 -a -e ibs_fetch/l3missonly=1/ --raw-samples
sudo ./perf report -D
...
ibs_fetch_ctl: 3c1f00c700080008 MaxCnt 128 Cnt 128 Lat 199
En 1 Val 1 Comp 1 IcMiss 1 PhyAddrValid 1 L1TlbPgSz 4KB
L1TlbMiss 0 L2TlbMiss 0 RandEn 0 L2Miss 1 L3MissOnly 1
FetchOcMiss 1 FetchL3Miss 1
```
----------------------------------------------------------------------------------
* perf header: Record non-CPU PMU capabilities
* perf inject: Keep some features sections from input file
* libperf: Add preadn()
* perf header: Add ability to keep feature sections
```javascript
$ perf inject -i perf.data-from-desktop -o injected-perf.data
$ perf script --header-only -i injected-perf.data | head -15
# ========
# captured on : Fri May 20 15:08:54 2022
# header version : 1
# data offset : 1208
# data size : 837480
# feat offset : 838688
# hostname : Desktop
# os release : 5.13.0-41-generic
# perf version : 5.18.rc5.gac837f7ca7ed
# arch : x86_64
# nrcpus online : 28
# nrcpus avail : 28
# cpudesc : Intel(R) Core(TM) i9-9940X CPU @ 3.30GHz
# cpuid : GenuineIntel,6,85,4
# total memory : 65548656 kB
```
--------------------------------------------------------------------------------------
* perf tools: Support PERF_SAMPLE_WEIGHT_STRUCT
* perf script: Fix PERF_SAMPLE_WEIGHT_STRUCT support
* perf record: Add support for PERF_SAMPLE_CODE_PAGE_SIZE
```javascript
sudo perf record --code-page-size sleep 1
Error:
Asking for the code page size isn't supported by this kernel.
```
-----------------------------------------------------------------------------------------
* perf evsel: Emit warning about kernel not supporting the data page size sample_type bit
* perf record: Support new sample type for data page size
```javascript
sudo perf record --data-page-size sleep 1
Error:
Asking for the data page size isn't supported by this kernel.
```
-----------------------------------------------------------------------------------------
* perf/x86/amd: Do not WARN() on every IRQ
* perf/x86/amd/core: Avoid register reset when CPU is dead
```javascript
git clone https://github.com/deater/perf_event_tests.git
[sudo sysctl kernel.perf_event_paranoid=2]
./fuzzer/perf_fuzzer -t OC -s 100
....
....
Close: 5/5 Successful
Read: 0/0 Successful
Write: 0/0 Successful
Ioctl: 0/0 Successful:
```
--------------------------------------------------------------------------------
* perf header: Store PMU caps in an array of strings
* perf header: Pass "cpu" pmu name while printing caps
* perf header: Support HYBRID_CPU_PMU_CAPS feature
* perf header: Support HYBRID_TOPOLOGY feature
* perf pmu: Add hybrid helper functions
* perf pmu: Save detected hybrid pmus to a global pmu list
* perf env: Conditionally compile BPF support code on having HAVE_LIBBPF_SUPPORT
* perf pmu: Parse pmu caps sysfs only once
```javascript
sudo ./perf record -c 10000 -C 0 -e ibs_fetch/l3missonly=1/ sleep 5
WARNING: Hw internally resets sampling period when L3 Miss Filtering is enabled
and tagged operation does not cause L3 Miss. This causes sampling period skew.
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.369 MB perf.data ]
[amd@volcano9f8e-oshost malathi]$ sudo ./perf report --header-only -I
...
...
search HYBRID_TOPO
```
Link:https://gitee.com/openeuler/kernel/pulls/12311
Reviewed-by:
Liu Chao <liuchao173@huawei.com>
Reviewed-by:
Wenkuan Wang <wenkuan.wang@amd.com>
Reviewed-by:
Li Nan <linan122@huawei.com>
Signed-off-by:
Li Nan <linan122@huawei.com>