Back to home page

OSCL-LXR

 
 

    


0001 ================================================
0002 HiSilicon PCIe Performance Monitoring Unit (PMU)
0003 ================================================
0004 
0005 On Hip09, HiSilicon PCIe Performance Monitoring Unit (PMU) could monitor
0006 bandwidth, latency, bus utilization and buffer occupancy data of PCIe.
0007 
0008 Each PCIe Core has a PMU to monitor multi Root Ports of this PCIe Core and
0009 all Endpoints downstream these Root Ports.
0010 
0011 
0012 HiSilicon PCIe PMU driver
0013 =========================
0014 
0015 The PCIe PMU driver registers a perf PMU with the name of its sicl-id and PCIe
0016 Core id.::
0017 
0018   /sys/bus/event_source/hisi_pcie<sicl>_<core>
0019 
0020 PMU driver provides description of available events and filter options in sysfs,
0021 see /sys/bus/event_source/devices/hisi_pcie<sicl>_<core>.
0022 
0023 The "format" directory describes all formats of the config (events) and config1
0024 (filter options) fields of the perf_event_attr structure. The "events" directory
0025 describes all documented events shown in perf list.
0026 
0027 The "identifier" sysfs file allows users to identify the version of the
0028 PMU hardware device.
0029 
0030 The "bus" sysfs file allows users to get the bus number of Root Ports
0031 monitored by PMU.
0032 
0033 Example usage of perf::
0034 
0035   $# perf list
0036   hisi_pcie0_0/rx_mwr_latency/ [kernel PMU event]
0037   hisi_pcie0_0/rx_mwr_cnt/ [kernel PMU event]
0038   ------------------------------------------
0039 
0040   $# perf stat -e hisi_pcie0_0/rx_mwr_latency/
0041   $# perf stat -e hisi_pcie0_0/rx_mwr_cnt/
0042   $# perf stat -g -e hisi_pcie0_0/rx_mwr_latency/ -e hisi_pcie0_0/rx_mwr_cnt/
0043 
0044 The current driver does not support sampling. So "perf record" is unsupported.
0045 Also attach to a task is unsupported for PCIe PMU.
0046 
0047 Filter options
0048 --------------
0049 
0050 1. Target filter
0051 PMU could only monitor the performance of traffic downstream target Root Ports
0052 or downstream target Endpoint. PCIe PMU driver support "port" and "bdf"
0053 interfaces for users, and these two interfaces aren't supported at the same
0054 time.
0055 
0056 -port
0057 "port" filter can be used in all PCIe PMU events, target Root Port can be
0058 selected by configuring the 16-bits-bitmap "port". Multi ports can be selected
0059 for AP-layer-events, and only one port can be selected for TL/DL-layer-events.
0060 
0061 For example, if target Root Port is 0000:00:00.0 (x8 lanes), bit0 of bitmap
0062 should be set, port=0x1; if target Root Port is 0000:00:04.0 (x4 lanes),
0063 bit8 is set, port=0x100; if these two Root Ports are both monitored, port=0x101.
0064 
0065 Example usage of perf::
0066 
0067   $# perf stat -e hisi_pcie0_0/rx_mwr_latency,port=0x1/ sleep 5
0068 
0069 -bdf
0070 
0071 "bdf" filter can only be used in bandwidth events, target Endpoint is selected
0072 by configuring BDF to "bdf". Counter only counts the bandwidth of message
0073 requested by target Endpoint.
0074 
0075 For example, "bdf=0x3900" means BDF of target Endpoint is 0000:39:00.0.
0076 
0077 Example usage of perf::
0078 
0079   $# perf stat -e hisi_pcie0_0/rx_mrd_flux,bdf=0x3900/ sleep 5
0080 
0081 2. Trigger filter
0082 Event statistics start when the first time TLP length is greater/smaller
0083 than trigger condition. You can set the trigger condition by writing "trig_len",
0084 and set the trigger mode by writing "trig_mode". This filter can only be used
0085 in bandwidth events.
0086 
0087 For example, "trig_len=4" means trigger condition is 2^4 DW, "trig_mode=0"
0088 means statistics start when TLP length > trigger condition, "trig_mode=1"
0089 means start when TLP length < condition.
0090 
0091 Example usage of perf::
0092 
0093   $# perf stat -e hisi_pcie0_0/rx_mrd_flux,trig_len=0x4,trig_mode=1/ sleep 5
0094 
0095 3. Threshold filter
0096 Counter counts when TLP length within the specified range. You can set the
0097 threshold by writing "thr_len", and set the threshold mode by writing
0098 "thr_mode". This filter can only be used in bandwidth events.
0099 
0100 For example, "thr_len=4" means threshold is 2^4 DW, "thr_mode=0" means
0101 counter counts when TLP length >= threshold, and "thr_mode=1" means counts
0102 when TLP length < threshold.
0103 
0104 Example usage of perf::
0105 
0106   $# perf stat -e hisi_pcie0_0/rx_mrd_flux,thr_len=0x4,thr_mode=1/ sleep 5