1 ====================================== 1 ====================================== 2 HNS3 Performance Monitoring Unit (PMU) 2 HNS3 Performance Monitoring Unit (PMU) 3 ====================================== 3 ====================================== 4 4 5 HNS3(HiSilicon network system 3) Performance M 5 HNS3(HiSilicon network system 3) Performance Monitoring Unit (PMU) is an 6 End Point device to collect performance statis 6 End Point device to collect performance statistics of HiSilicon SoC NIC. 7 On Hip09, each SICL(Super I/O cluster) has one 7 On Hip09, each SICL(Super I/O cluster) has one PMU device. 8 8 9 HNS3 PMU supports collection of performance st 9 HNS3 PMU supports collection of performance statistics such as bandwidth, 10 latency, packet rate and interrupt rate. 10 latency, packet rate and interrupt rate. 11 11 12 Each HNS3 PMU supports 8 hardware events. 12 Each HNS3 PMU supports 8 hardware events. 13 13 14 HNS3 PMU driver 14 HNS3 PMU driver 15 =============== 15 =============== 16 16 17 The HNS3 PMU driver registers a perf PMU with 17 The HNS3 PMU driver registers a perf PMU with the name of its sicl id.:: 18 18 19 /sys/bus/event_source/devices/hns3_pmu_sicl_ !! 19 /sys/devices/hns3_pmu_sicl_<sicl_id> 20 20 21 PMU driver provides description of available e 21 PMU driver provides description of available events, filter modes, format, 22 identifier and cpumask in sysfs. 22 identifier and cpumask in sysfs. 23 23 24 The "events" directory describes the event cod 24 The "events" directory describes the event code of all supported events 25 shown in perf list. 25 shown in perf list. 26 26 27 The "filtermode" directory describes the suppo 27 The "filtermode" directory describes the supported filter modes of each 28 event. 28 event. 29 29 30 The "format" directory describes all formats o 30 The "format" directory describes all formats of the config (events) and 31 config1 (filter options) fields of the perf_ev 31 config1 (filter options) fields of the perf_event_attr structure. 32 32 33 The "identifier" file shows version of PMU har 33 The "identifier" file shows version of PMU hardware device. 34 34 35 The "bdf_min" and "bdf_max" files show the sup 35 The "bdf_min" and "bdf_max" files show the supported bdf range of each 36 pmu device. 36 pmu device. 37 37 38 The "hw_clk_freq" file shows the hardware cloc 38 The "hw_clk_freq" file shows the hardware clock frequency of each pmu 39 device. 39 device. 40 40 41 Example usage of checking event code and subev 41 Example usage of checking event code and subevent code:: 42 42 43 $# cat /sys/bus/event_source/devices/hns3_pm !! 43 $# cat /sys/devices/hns3_pmu_sicl_0/events/dly_tx_normal_to_mac_time 44 config=0x00204 44 config=0x00204 45 $# cat /sys/bus/event_source/devices/hns3_pm !! 45 $# cat /sys/devices/hns3_pmu_sicl_0/events/dly_tx_normal_to_mac_packet_num 46 config=0x10204 46 config=0x10204 47 47 48 Each performance statistic has a pair of event 48 Each performance statistic has a pair of events to get two values to 49 calculate real performance data in userspace. 49 calculate real performance data in userspace. 50 50 51 The bits 0~15 of config (here 0x0204) are the 51 The bits 0~15 of config (here 0x0204) are the true hardware event code. If 52 two events have same value of bits 0~15 of con 52 two events have same value of bits 0~15 of config, that means they are 53 event pair. And the bit 16 of config indicates 53 event pair. And the bit 16 of config indicates getting counter 0 or 54 counter 1 of hardware event. 54 counter 1 of hardware event. 55 55 56 After getting two values of event pair in user 56 After getting two values of event pair in userspace, the formula of 57 computation to calculate real performance data 57 computation to calculate real performance data is::: 58 58 59 counter 0 / counter 1 59 counter 0 / counter 1 60 60 61 Example usage of checking supported filter mod 61 Example usage of checking supported filter mode:: 62 62 63 $# cat /sys/bus/event_source/devices/hns3_pm !! 63 $# cat /sys/devices/hns3_pmu_sicl_0/filtermode/bw_ssu_rpu_byte_num 64 filter mode supported: global/port/port-tc/f 64 filter mode supported: global/port/port-tc/func/func-queue/ 65 65 66 Example usage of perf:: 66 Example usage of perf:: 67 67 68 $# perf list 68 $# perf list 69 hns3_pmu_sicl_0/bw_ssu_rpu_byte_num/ [kernel 69 hns3_pmu_sicl_0/bw_ssu_rpu_byte_num/ [kernel PMU event] 70 hns3_pmu_sicl_0/bw_ssu_rpu_time/ [kernel 70 hns3_pmu_sicl_0/bw_ssu_rpu_time/ [kernel PMU event] 71 ------------------------------------------ 71 ------------------------------------------ 72 72 73 $# perf stat -g -e hns3_pmu_sicl_0/bw_ssu_rp 73 $# perf stat -g -e hns3_pmu_sicl_0/bw_ssu_rpu_byte_num,global=1/ -e hns3_pmu_sicl_0/bw_ssu_rpu_time,global=1/ -I 1000 74 or 74 or 75 $# perf stat -g -e hns3_pmu_sicl_0/config=0x 75 $# perf stat -g -e hns3_pmu_sicl_0/config=0x00002,global=1/ -e hns3_pmu_sicl_0/config=0x10002,global=1/ -I 1000 76 76 77 77 78 Filter modes 78 Filter modes 79 -------------- 79 -------------- 80 80 81 1. global mode 81 1. global mode 82 PMU collect performance statistics for all HNS 82 PMU collect performance statistics for all HNS3 PCIe functions of IO DIE. 83 Set the "global" filter option to 1 will enabl 83 Set the "global" filter option to 1 will enable this mode. 84 Example usage of perf:: 84 Example usage of perf:: 85 85 86 $# perf stat -a -e hns3_pmu_sicl_0/config=0x 86 $# perf stat -a -e hns3_pmu_sicl_0/config=0x1020F,global=1/ -I 1000 87 87 88 2. port mode 88 2. port mode 89 PMU collect performance statistic of one whole 89 PMU collect performance statistic of one whole physical port. The port id 90 is same as mac id. The "tc" filter option must 90 is same as mac id. The "tc" filter option must be set to 0xF in this mode, 91 here tc stands for traffic class. 91 here tc stands for traffic class. 92 92 93 Example usage of perf:: 93 Example usage of perf:: 94 94 95 $# perf stat -a -e hns3_pmu_sicl_0/config=0x 95 $# perf stat -a -e hns3_pmu_sicl_0/config=0x1020F,port=0,tc=0xF/ -I 1000 96 96 97 3. port-tc mode 97 3. port-tc mode 98 PMU collect performance statistic of one tc of 98 PMU collect performance statistic of one tc of physical port. The port id 99 is same as mac id. The "tc" filter option must 99 is same as mac id. The "tc" filter option must be set to 0 ~ 7 in this 100 mode. 100 mode. 101 Example usage of perf:: 101 Example usage of perf:: 102 102 103 $# perf stat -a -e hns3_pmu_sicl_0/config=0x 103 $# perf stat -a -e hns3_pmu_sicl_0/config=0x1020F,port=0,tc=0/ -I 1000 104 104 105 4. func mode 105 4. func mode 106 PMU collect performance statistic of one PF/VF 106 PMU collect performance statistic of one PF/VF. The function id is BDF of 107 PF/VF, its conversion formula:: 107 PF/VF, its conversion formula:: 108 108 109 func = (bus << 8) + (device << 3) + (functio 109 func = (bus << 8) + (device << 3) + (function) 110 110 111 for example: 111 for example: 112 BDF func 112 BDF func 113 35:00.0 0x3500 113 35:00.0 0x3500 114 35:00.1 0x3501 114 35:00.1 0x3501 115 35:01.0 0x3508 115 35:01.0 0x3508 116 116 117 In this mode, the "queue" filter option must b 117 In this mode, the "queue" filter option must be set to 0xFFFF. 118 Example usage of perf:: 118 Example usage of perf:: 119 119 120 $# perf stat -a -e hns3_pmu_sicl_0/config=0x 120 $# perf stat -a -e hns3_pmu_sicl_0/config=0x1020F,bdf=0x3500,queue=0xFFFF/ -I 1000 121 121 122 5. func-queue mode 122 5. func-queue mode 123 PMU collect performance statistic of one queue 123 PMU collect performance statistic of one queue of PF/VF. The function id 124 is BDF of PF/VF, the "queue" filter option mus 124 is BDF of PF/VF, the "queue" filter option must be set to the exact queue 125 id of function. 125 id of function. 126 Example usage of perf:: 126 Example usage of perf:: 127 127 128 $# perf stat -a -e hns3_pmu_sicl_0/config=0x 128 $# perf stat -a -e hns3_pmu_sicl_0/config=0x1020F,bdf=0x3500,queue=0/ -I 1000 129 129 130 6. func-intr mode 130 6. func-intr mode 131 PMU collect performance statistic of one inter 131 PMU collect performance statistic of one interrupt of PF/VF. The function 132 id is BDF of PF/VF, the "intr" filter option m 132 id is BDF of PF/VF, the "intr" filter option must be set to the exact 133 interrupt id of function. 133 interrupt id of function. 134 Example usage of perf:: 134 Example usage of perf:: 135 135 136 $# perf stat -a -e hns3_pmu_sicl_0/config=0x 136 $# perf stat -a -e hns3_pmu_sicl_0/config=0x00301,bdf=0x3500,intr=0/ -I 1000
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.