hns3-pmu.rst 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. ======================================
  2. HNS3 Performance Monitoring Unit (PMU)
  3. ======================================
  4. HNS3(HiSilicon network system 3) Performance Monitoring Unit (PMU) is an
  5. End Point device to collect performance statistics of HiSilicon SoC NIC.
  6. On Hip09, each SICL(Super I/O cluster) has one PMU device.
  7. HNS3 PMU supports collection of performance statistics such as bandwidth,
  8. latency, packet rate and interrupt rate.
  9. Each HNS3 PMU supports 8 hardware events.
  10. HNS3 PMU driver
  11. ===============
  12. The HNS3 PMU driver registers a perf PMU with the name of its sicl id.::
  13. /sys/bus/event_source/devices/hns3_pmu_sicl_<sicl_id>
  14. PMU driver provides description of available events, filter modes, format,
  15. identifier and cpumask in sysfs.
  16. The "events" directory describes the event code of all supported events
  17. shown in perf list.
  18. The "filtermode" directory describes the supported filter modes of each
  19. event.
  20. The "format" directory describes all formats of the config (events) and
  21. config1 (filter options) fields of the perf_event_attr structure.
  22. The "identifier" file shows version of PMU hardware device.
  23. The "bdf_min" and "bdf_max" files show the supported bdf range of each
  24. pmu device.
  25. The "hw_clk_freq" file shows the hardware clock frequency of each pmu
  26. device.
  27. Example usage of checking event code and subevent code::
  28. $# cat /sys/bus/event_source/devices/hns3_pmu_sicl_0/events/dly_tx_normal_to_mac_time
  29. config=0x00204
  30. $# cat /sys/bus/event_source/devices/hns3_pmu_sicl_0/events/dly_tx_normal_to_mac_packet_num
  31. config=0x10204
  32. Each performance statistic has a pair of events to get two values to
  33. calculate real performance data in userspace.
  34. The bits 0~15 of config (here 0x0204) are the true hardware event code. If
  35. two events have same value of bits 0~15 of config, that means they are
  36. event pair. And the bit 16 of config indicates getting counter 0 or
  37. counter 1 of hardware event.
  38. After getting two values of event pair in userspace, the formula of
  39. computation to calculate real performance data is:::
  40. counter 0 / counter 1
  41. Example usage of checking supported filter mode::
  42. $# cat /sys/bus/event_source/devices/hns3_pmu_sicl_0/filtermode/bw_ssu_rpu_byte_num
  43. filter mode supported: global/port/port-tc/func/func-queue/
  44. Example usage of perf::
  45. $# perf list
  46. hns3_pmu_sicl_0/bw_ssu_rpu_byte_num/ [kernel PMU event]
  47. hns3_pmu_sicl_0/bw_ssu_rpu_time/ [kernel PMU event]
  48. ------------------------------------------
  49. $# 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
  50. or
  51. $# perf stat -g -e hns3_pmu_sicl_0/config=0x00002,global=1/ -e hns3_pmu_sicl_0/config=0x10002,global=1/ -I 1000
  52. Filter modes
  53. --------------
  54. 1. global mode
  55. PMU collect performance statistics for all HNS3 PCIe functions of IO DIE.
  56. Set the "global" filter option to 1 will enable this mode.
  57. Example usage of perf::
  58. $# perf stat -a -e hns3_pmu_sicl_0/config=0x1020F,global=1/ -I 1000
  59. 2. port mode
  60. PMU collect performance statistic of one whole physical port. The port id
  61. is same as mac id. The "tc" filter option must be set to 0xF in this mode,
  62. here tc stands for traffic class.
  63. Example usage of perf::
  64. $# perf stat -a -e hns3_pmu_sicl_0/config=0x1020F,port=0,tc=0xF/ -I 1000
  65. 3. port-tc mode
  66. PMU collect performance statistic of one tc of physical port. The port id
  67. is same as mac id. The "tc" filter option must be set to 0 ~ 7 in this
  68. mode.
  69. Example usage of perf::
  70. $# perf stat -a -e hns3_pmu_sicl_0/config=0x1020F,port=0,tc=0/ -I 1000
  71. 4. func mode
  72. PMU collect performance statistic of one PF/VF. The function id is BDF of
  73. PF/VF, its conversion formula::
  74. func = (bus << 8) + (device << 3) + (function)
  75. for example:
  76. BDF func
  77. 35:00.0 0x3500
  78. 35:00.1 0x3501
  79. 35:01.0 0x3508
  80. In this mode, the "queue" filter option must be set to 0xFFFF.
  81. Example usage of perf::
  82. $# perf stat -a -e hns3_pmu_sicl_0/config=0x1020F,bdf=0x3500,queue=0xFFFF/ -I 1000
  83. 5. func-queue mode
  84. PMU collect performance statistic of one queue of PF/VF. The function id
  85. is BDF of PF/VF, the "queue" filter option must be set to the exact queue
  86. id of function.
  87. Example usage of perf::
  88. $# perf stat -a -e hns3_pmu_sicl_0/config=0x1020F,bdf=0x3500,queue=0/ -I 1000
  89. 6. func-intr mode
  90. PMU collect performance statistic of one interrupt of PF/VF. The function
  91. id is BDF of PF/VF, the "intr" filter option must be set to the exact
  92. interrupt id of function.
  93. Example usage of perf::
  94. $# perf stat -a -e hns3_pmu_sicl_0/config=0x00301,bdf=0x3500,intr=0/ -I 1000