Skip to content

Commit 8330904

Browse files
committed
Merge branch 'for-next/perf-hisi' into for-next/perf
* for-next/perf-hisi: drivers/perf: hisi: Add driver for HiSilicon PCIe PMU docs: perf: Add description for HiSilicon PCIe PMU driver
2 parents e73bc4f + 8404b0f commit 8330904

File tree

6 files changed

+1068
-0
lines changed

6 files changed

+1068
-0
lines changed
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
================================================
2+
HiSilicon PCIe Performance Monitoring Unit (PMU)
3+
================================================
4+
5+
On Hip09, HiSilicon PCIe Performance Monitoring Unit (PMU) could monitor
6+
bandwidth, latency, bus utilization and buffer occupancy data of PCIe.
7+
8+
Each PCIe Core has a PMU to monitor multi Root Ports of this PCIe Core and
9+
all Endpoints downstream these Root Ports.
10+
11+
12+
HiSilicon PCIe PMU driver
13+
=========================
14+
15+
The PCIe PMU driver registers a perf PMU with the name of its sicl-id and PCIe
16+
Core id.::
17+
18+
/sys/bus/event_source/hisi_pcie<sicl>_<core>
19+
20+
PMU driver provides description of available events and filter options in sysfs,
21+
see /sys/bus/event_source/devices/hisi_pcie<sicl>_<core>.
22+
23+
The "format" directory describes all formats of the config (events) and config1
24+
(filter options) fields of the perf_event_attr structure. The "events" directory
25+
describes all documented events shown in perf list.
26+
27+
The "identifier" sysfs file allows users to identify the version of the
28+
PMU hardware device.
29+
30+
The "bus" sysfs file allows users to get the bus number of Root Ports
31+
monitored by PMU.
32+
33+
Example usage of perf::
34+
35+
$# perf list
36+
hisi_pcie0_0/rx_mwr_latency/ [kernel PMU event]
37+
hisi_pcie0_0/rx_mwr_cnt/ [kernel PMU event]
38+
------------------------------------------
39+
40+
$# perf stat -e hisi_pcie0_0/rx_mwr_latency/
41+
$# perf stat -e hisi_pcie0_0/rx_mwr_cnt/
42+
$# perf stat -g -e hisi_pcie0_0/rx_mwr_latency/ -e hisi_pcie0_0/rx_mwr_cnt/
43+
44+
The current driver does not support sampling. So "perf record" is unsupported.
45+
Also attach to a task is unsupported for PCIe PMU.
46+
47+
Filter options
48+
--------------
49+
50+
1. Target filter
51+
PMU could only monitor the performance of traffic downstream target Root Ports
52+
or downstream target Endpoint. PCIe PMU driver support "port" and "bdf"
53+
interfaces for users, and these two interfaces aren't supported at the same
54+
time.
55+
56+
-port
57+
"port" filter can be used in all PCIe PMU events, target Root Port can be
58+
selected by configuring the 16-bits-bitmap "port". Multi ports can be selected
59+
for AP-layer-events, and only one port can be selected for TL/DL-layer-events.
60+
61+
For example, if target Root Port is 0000:00:00.0 (x8 lanes), bit0 of bitmap
62+
should be set, port=0x1; if target Root Port is 0000:00:04.0 (x4 lanes),
63+
bit8 is set, port=0x100; if these two Root Ports are both monitored, port=0x101.
64+
65+
Example usage of perf::
66+
67+
$# perf stat -e hisi_pcie0_0/rx_mwr_latency,port=0x1/ sleep 5
68+
69+
-bdf
70+
71+
"bdf" filter can only be used in bandwidth events, target Endpoint is selected
72+
by configuring BDF to "bdf". Counter only counts the bandwidth of message
73+
requested by target Endpoint.
74+
75+
For example, "bdf=0x3900" means BDF of target Endpoint is 0000:39:00.0.
76+
77+
Example usage of perf::
78+
79+
$# perf stat -e hisi_pcie0_0/rx_mrd_flux,bdf=0x3900/ sleep 5
80+
81+
2. Trigger filter
82+
Event statistics start when the first time TLP length is greater/smaller
83+
than trigger condition. You can set the trigger condition by writing "trig_len",
84+
and set the trigger mode by writing "trig_mode". This filter can only be used
85+
in bandwidth events.
86+
87+
For example, "trig_len=4" means trigger condition is 2^4 DW, "trig_mode=0"
88+
means statistics start when TLP length > trigger condition, "trig_mode=1"
89+
means start when TLP length < condition.
90+
91+
Example usage of perf::
92+
93+
$# perf stat -e hisi_pcie0_0/rx_mrd_flux,trig_len=0x4,trig_mode=1/ sleep 5
94+
95+
3. Threshold filter
96+
Counter counts when TLP length within the specified range. You can set the
97+
threshold by writing "thr_len", and set the threshold mode by writing
98+
"thr_mode". This filter can only be used in bandwidth events.
99+
100+
For example, "thr_len=4" means threshold is 2^4 DW, "thr_mode=0" means
101+
counter counts when TLP length >= threshold, and "thr_mode=1" means counts
102+
when TLP length < threshold.
103+
104+
Example usage of perf::
105+
106+
$# perf stat -e hisi_pcie0_0/rx_mrd_flux,thr_len=0x4,thr_mode=1/ sleep 5

MAINTAINERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8607,8 +8607,10 @@ F: drivers/misc/hisi_hikey_usb.c
86078607

86088608
HISILICON PMU DRIVER
86098609
M: Shaokun Zhang <[email protected]>
8610+
M: Qi Liu <[email protected]>
86108611
S: Supported
86118612
W: http://www.hisilicon.com
8613+
F: Documentation/admin-guide/perf/hisi-pcie-pmu.rst
86128614
F: Documentation/admin-guide/perf/hisi-pmu.rst
86138615
F: drivers/perf/hisilicon
86148616

drivers/perf/hisilicon/Kconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,12 @@ config HISI_PMU
55
help
66
Support for HiSilicon SoC L3 Cache performance monitor, Hydra Home
77
Agent performance monitor and DDR Controller performance monitor.
8+
9+
config HISI_PCIE_PMU
10+
tristate "HiSilicon PCIE PERF PMU"
11+
depends on PCI && ARM64
12+
help
13+
Provide support for HiSilicon PCIe performance monitoring unit (PMU)
14+
RCiEP devices.
15+
Adds the PCIe PMU into perf events system for monitoring latency,
16+
bandwidth etc.

drivers/perf/hisilicon/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
obj-$(CONFIG_HISI_PMU) += hisi_uncore_pmu.o hisi_uncore_l3c_pmu.o \
33
hisi_uncore_hha_pmu.o hisi_uncore_ddrc_pmu.o hisi_uncore_sllc_pmu.o \
44
hisi_uncore_pa_pmu.o
5+
6+
obj-$(CONFIG_HISI_PCIE_PMU) += hisi_pcie_pmu.o

0 commit comments

Comments
 (0)