1 ============================================== 1 ================================================ 2 HiSilicon PCIe Performance Monitoring Unit (PM 2 HiSilicon PCIe Performance Monitoring Unit (PMU) 3 ============================================== 3 ================================================ 4 4 5 On Hip09, HiSilicon PCIe Performance Monitorin 5 On Hip09, HiSilicon PCIe Performance Monitoring Unit (PMU) could monitor 6 bandwidth, latency, bus utilization and buffer 6 bandwidth, latency, bus utilization and buffer occupancy data of PCIe. 7 7 8 Each PCIe Core has a PMU to monitor multi Root 8 Each PCIe Core has a PMU to monitor multi Root Ports of this PCIe Core and 9 all Endpoints downstream these Root Ports. 9 all Endpoints downstream these Root Ports. 10 10 11 11 12 HiSilicon PCIe PMU driver 12 HiSilicon PCIe PMU driver 13 ========================= 13 ========================= 14 14 15 The PCIe PMU driver registers a perf PMU with 15 The PCIe PMU driver registers a perf PMU with the name of its sicl-id and PCIe 16 Core id.:: 16 Core id.:: 17 17 18 /sys/bus/event_source/hisi_pcie<sicl>_core<c 18 /sys/bus/event_source/hisi_pcie<sicl>_core<core> 19 19 20 PMU driver provides description of available e 20 PMU driver provides description of available events and filter options in sysfs, 21 see /sys/bus/event_source/devices/hisi_pcie<si 21 see /sys/bus/event_source/devices/hisi_pcie<sicl>_core<core>. 22 22 23 The "format" directory describes all formats o 23 The "format" directory describes all formats of the config (events) and config1 24 (filter options) fields of the perf_event_attr 24 (filter options) fields of the perf_event_attr structure. The "events" directory 25 describes all documented events shown in perf 25 describes all documented events shown in perf list. 26 26 27 The "identifier" sysfs file allows users to id 27 The "identifier" sysfs file allows users to identify the version of the 28 PMU hardware device. 28 PMU hardware device. 29 29 30 The "bus" sysfs file allows users to get the b 30 The "bus" sysfs file allows users to get the bus number of Root Ports 31 monitored by PMU. 31 monitored by PMU. 32 32 33 Example usage of perf:: 33 Example usage of perf:: 34 34 35 $# perf list 35 $# perf list 36 hisi_pcie0_core0/rx_mwr_latency/ [kernel PMU 36 hisi_pcie0_core0/rx_mwr_latency/ [kernel PMU event] 37 hisi_pcie0_core0/rx_mwr_cnt/ [kernel PMU eve 37 hisi_pcie0_core0/rx_mwr_cnt/ [kernel PMU event] 38 ------------------------------------------ 38 ------------------------------------------ 39 39 40 $# perf stat -e hisi_pcie0_core0/rx_mwr_late !! 40 $# perf stat -e hisi_pcie0_core0/rx_mwr_latency/ 41 $# perf stat -e hisi_pcie0_core0/rx_mwr_cnt, !! 41 $# perf stat -e hisi_pcie0_core0/rx_mwr_cnt/ 42 !! 42 $# perf stat -g -e hisi_pcie0_core0/rx_mwr_latency/ -e hisi_pcie0_core0/rx_mwr_cnt/ 43 The related events usually used to calculate t << 44 They need to start and end counting at the sam << 45 are best used in the same event group to get t << 46 ways to know if they are related events: << 47 << 48 a) By event name, such as the latency events " << 49 bandwidth events "xxx_flux, xxx_time". << 50 b) By event type, such as "event=0xXXXX, event << 51 << 52 Example usage of perf group:: << 53 << 54 $# perf stat -e "{hisi_pcie0_core0/rx_mwr_la << 55 43 56 The current driver does not support sampling. 44 The current driver does not support sampling. So "perf record" is unsupported. 57 Also attach to a task is unsupported for PCIe 45 Also attach to a task is unsupported for PCIe PMU. 58 46 59 Filter options 47 Filter options 60 -------------- 48 -------------- 61 49 62 1. Target filter 50 1. Target filter 63 51 64 PMU could only monitor the performance of t 52 PMU could only monitor the performance of traffic downstream target Root 65 Ports or downstream target Endpoint. PCIe P 53 Ports or downstream target Endpoint. PCIe PMU driver support "port" and 66 "bdf" interfaces for users. !! 54 "bdf" interfaces for users, and these two interfaces aren't supported at the 67 Please notice that, one of these two interf !! 55 same time. 68 interfaces aren't supported at the same tim << 69 "port" filter is valid. << 70 If "port" filter not being set or is set ex << 71 "bdf" filter will be in effect, because "bd << 72 56 73 - port 57 - port 74 58 75 "port" filter can be used in all PCIe PMU 59 "port" filter can be used in all PCIe PMU events, target Root Port can be 76 selected by configuring the 16-bits-bitma 60 selected by configuring the 16-bits-bitmap "port". Multi ports can be 77 selected for AP-layer-events, and only on 61 selected for AP-layer-events, and only one port can be selected for 78 TL/DL-layer-events. 62 TL/DL-layer-events. 79 63 80 For example, if target Root Port is 0000: 64 For example, if target Root Port is 0000:00:00.0 (x8 lanes), bit0 of 81 bitmap should be set, port=0x1; if target 65 bitmap should be set, port=0x1; if target Root Port is 0000:00:04.0 (x4 82 lanes), bit8 is set, port=0x100; if these 66 lanes), bit8 is set, port=0x100; if these two Root Ports are both 83 monitored, port=0x101. 67 monitored, port=0x101. 84 68 85 Example usage of perf:: 69 Example usage of perf:: 86 70 87 $# perf stat -e hisi_pcie0_core0/rx_mwr 71 $# perf stat -e hisi_pcie0_core0/rx_mwr_latency,port=0x1/ sleep 5 88 72 89 - bdf 73 - bdf 90 74 91 "bdf" filter can only be used in bandwidt 75 "bdf" filter can only be used in bandwidth events, target Endpoint is 92 selected by configuring BDF to "bdf". Cou 76 selected by configuring BDF to "bdf". Counter only counts the bandwidth of 93 message requested by target Endpoint. 77 message requested by target Endpoint. 94 78 95 For example, "bdf=0x3900" means BDF of ta 79 For example, "bdf=0x3900" means BDF of target Endpoint is 0000:39:00.0. 96 80 97 Example usage of perf:: 81 Example usage of perf:: 98 82 99 $# perf stat -e hisi_pcie0_core0/rx_mrd 83 $# perf stat -e hisi_pcie0_core0/rx_mrd_flux,bdf=0x3900/ sleep 5 100 84 101 2. Trigger filter 85 2. Trigger filter 102 86 103 Event statistics start when the first time 87 Event statistics start when the first time TLP length is greater/smaller 104 than trigger condition. You can set the tri 88 than trigger condition. You can set the trigger condition by writing 105 "trig_len", and set the trigger mode by wri 89 "trig_len", and set the trigger mode by writing "trig_mode". This filter can 106 only be used in bandwidth events. 90 only be used in bandwidth events. 107 91 108 For example, "trig_len=4" means trigger con 92 For example, "trig_len=4" means trigger condition is 2^4 DW, "trig_mode=0" 109 means statistics start when TLP length > tr 93 means statistics start when TLP length > trigger condition, "trig_mode=1" 110 means start when TLP length < condition. 94 means start when TLP length < condition. 111 95 112 Example usage of perf:: 96 Example usage of perf:: 113 97 114 $# perf stat -e hisi_pcie0_core0/rx_mrd_f !! 98 $# perf stat -e hisi_pcie0_core0/rx_mrd_flux,trig_len=0x4,trig_mode=1/ sleep 5 115 99 116 3. Threshold filter 100 3. Threshold filter 117 101 118 Counter counts when TLP length within the s 102 Counter counts when TLP length within the specified range. You can set the 119 threshold by writing "thr_len", and set the 103 threshold by writing "thr_len", and set the threshold mode by writing 120 "thr_mode". This filter can only be used in 104 "thr_mode". This filter can only be used in bandwidth events. 121 105 122 For example, "thr_len=4" means threshold is 106 For example, "thr_len=4" means threshold is 2^4 DW, "thr_mode=0" means 123 counter counts when TLP length >= threshold 107 counter counts when TLP length >= threshold, and "thr_mode=1" means counts 124 when TLP length < threshold. 108 when TLP length < threshold. 125 109 126 Example usage of perf:: 110 Example usage of perf:: 127 111 128 $# perf stat -e hisi_pcie0_core0/rx_mrd_f !! 112 $# perf stat -e hisi_pcie0_core0/rx_mrd_flux,thr_len=0x4,thr_mode=1/ sleep 5 129 113 130 4. TLP Length filter 114 4. TLP Length filter 131 115 132 When counting bandwidth, the data can be co 116 When counting bandwidth, the data can be composed of certain parts of TLP 133 packets. You can specify it through "len_mo 117 packets. You can specify it through "len_mode": 134 118 135 - 2'b00: Reserved (Do not use this since th 119 - 2'b00: Reserved (Do not use this since the behaviour is undefined) 136 - 2'b01: Bandwidth of TLP payloads 120 - 2'b01: Bandwidth of TLP payloads 137 - 2'b10: Bandwidth of TLP headers 121 - 2'b10: Bandwidth of TLP headers 138 - 2'b11: Bandwidth of both TLP payloads and 122 - 2'b11: Bandwidth of both TLP payloads and headers 139 123 140 For example, "len_mode=2" means only counti 124 For example, "len_mode=2" means only counting the bandwidth of TLP headers 141 and "len_mode=3" means the final bandwidth 125 and "len_mode=3" means the final bandwidth data is composed of both TLP 142 headers and payloads. Default value if not 126 headers and payloads. Default value if not specified is 2'b11. 143 127 144 Example usage of perf:: 128 Example usage of perf:: 145 129 146 $# perf stat -e hisi_pcie0_core0/rx_mrd_f !! 130 $# perf stat -e hisi_pcie0_core0/rx_mrd_flux,len_mode=0x1/ sleep 5
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.