137 lines · plain
1======================================2HNS3 Performance Monitoring Unit (PMU)3======================================4 5HNS3(HiSilicon network system 3) Performance Monitoring Unit (PMU) is an6End Point device to collect performance statistics of HiSilicon SoC NIC.7On Hip09, each SICL(Super I/O cluster) has one PMU device.8 9HNS3 PMU supports collection of performance statistics such as bandwidth,10latency, packet rate and interrupt rate.11 12Each HNS3 PMU supports 8 hardware events.13 14HNS3 PMU driver15===============16 17The HNS3 PMU driver registers a perf PMU with the name of its sicl id.::18 19 /sys/bus/event_source/devices/hns3_pmu_sicl_<sicl_id>20 21PMU driver provides description of available events, filter modes, format,22identifier and cpumask in sysfs.23 24The "events" directory describes the event code of all supported events25shown in perf list.26 27The "filtermode" directory describes the supported filter modes of each28event.29 30The "format" directory describes all formats of the config (events) and31config1 (filter options) fields of the perf_event_attr structure.32 33The "identifier" file shows version of PMU hardware device.34 35The "bdf_min" and "bdf_max" files show the supported bdf range of each36pmu device.37 38The "hw_clk_freq" file shows the hardware clock frequency of each pmu39device.40 41Example usage of checking event code and subevent code::42 43 $# cat /sys/bus/event_source/devices/hns3_pmu_sicl_0/events/dly_tx_normal_to_mac_time44 config=0x0020445 $# cat /sys/bus/event_source/devices/hns3_pmu_sicl_0/events/dly_tx_normal_to_mac_packet_num46 config=0x1020447 48Each performance statistic has a pair of events to get two values to49calculate real performance data in userspace.50 51The bits 0~15 of config (here 0x0204) are the true hardware event code. If52two events have same value of bits 0~15 of config, that means they are53event pair. And the bit 16 of config indicates getting counter 0 or54counter 1 of hardware event.55 56After getting two values of event pair in userspace, the formula of57computation to calculate real performance data is:::58 59 counter 0 / counter 160 61Example usage of checking supported filter mode::62 63 $# cat /sys/bus/event_source/devices/hns3_pmu_sicl_0/filtermode/bw_ssu_rpu_byte_num64 filter mode supported: global/port/port-tc/func/func-queue/65 66Example usage of perf::67 68 $# perf list69 hns3_pmu_sicl_0/bw_ssu_rpu_byte_num/ [kernel PMU event]70 hns3_pmu_sicl_0/bw_ssu_rpu_time/ [kernel PMU event]71 ------------------------------------------72 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 100074 or75 $# perf stat -g -e hns3_pmu_sicl_0/config=0x00002,global=1/ -e hns3_pmu_sicl_0/config=0x10002,global=1/ -I 100076 77 78Filter modes79--------------80 811. global mode82PMU collect performance statistics for all HNS3 PCIe functions of IO DIE.83Set the "global" filter option to 1 will enable this mode.84Example usage of perf::85 86 $# perf stat -a -e hns3_pmu_sicl_0/config=0x1020F,global=1/ -I 100087 882. port mode89PMU collect performance statistic of one whole physical port. The port id90is same as mac id. The "tc" filter option must be set to 0xF in this mode,91here tc stands for traffic class.92 93Example usage of perf::94 95 $# perf stat -a -e hns3_pmu_sicl_0/config=0x1020F,port=0,tc=0xF/ -I 100096 973. port-tc mode98PMU collect performance statistic of one tc of physical port. The port id99is same as mac id. The "tc" filter option must be set to 0 ~ 7 in this100mode.101Example usage of perf::102 103 $# perf stat -a -e hns3_pmu_sicl_0/config=0x1020F,port=0,tc=0/ -I 1000104 1054. func mode106PMU collect performance statistic of one PF/VF. The function id is BDF of107PF/VF, its conversion formula::108 109 func = (bus << 8) + (device << 3) + (function)110 111for example:112 BDF func113 35:00.0 0x3500114 35:00.1 0x3501115 35:01.0 0x3508116 117In this mode, the "queue" filter option must be set to 0xFFFF.118Example usage of perf::119 120 $# perf stat -a -e hns3_pmu_sicl_0/config=0x1020F,bdf=0x3500,queue=0xFFFF/ -I 1000121 1225. func-queue mode123PMU collect performance statistic of one queue of PF/VF. The function id124is BDF of PF/VF, the "queue" filter option must be set to the exact queue125id of function.126Example usage of perf::127 128 $# perf stat -a -e hns3_pmu_sicl_0/config=0x1020F,bdf=0x3500,queue=0/ -I 1000129 1306. func-intr mode131PMU collect performance statistic of one interrupt of PF/VF. The function132id is BDF of PF/VF, the "intr" filter option must be set to the exact133interrupt id of function.134Example usage of perf::135 136 $# perf stat -a -e hns3_pmu_sicl_0/config=0x00301,bdf=0x3500,intr=0/ -I 1000137