alibaba_pmu.rst 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. =============================================================
  2. Alibaba's T-Head SoC Uncore Performance Monitoring Unit (PMU)
  3. =============================================================
  4. The Yitian 710, custom-built by Alibaba Group's chip development business,
  5. T-Head, implements uncore PMU for performance and functional debugging to
  6. facilitate system maintenance.
  7. DDR Sub-System Driveway (DRW) PMU Driver
  8. =========================================
  9. Yitian 710 employs eight DDR5/4 channels, four on each die. Each DDR5 channel
  10. is independent of others to service system memory requests. And one DDR5
  11. channel is split into two independent sub-channels. The DDR Sub-System Driveway
  12. implements separate PMUs for each sub-channel to monitor various performance
  13. metrics.
  14. The Driveway PMU devices are named as ali_drw_<sys_base_addr> with perf.
  15. For example, ali_drw_21000 and ali_drw_21080 are two PMU devices for two
  16. sub-channels of the same channel in die 0. And the PMU device of die 1 is
  17. prefixed with ali_drw_400XXXXX, e.g. ali_drw_40021000.
  18. Each sub-channel has 36 PMU counters in total, which is classified into
  19. four groups:
  20. - Group 0: PMU Cycle Counter. This group has one pair of counters
  21. pmu_cycle_cnt_low and pmu_cycle_cnt_high, that is used as the cycle count
  22. based on DDRC core clock.
  23. - Group 1: PMU Bandwidth Counters. This group has 8 counters that are used
  24. to count the total access number of either the eight bank groups in a
  25. selected rank, or four ranks separately in the first 4 counters. The base
  26. transfer unit is 64B.
  27. - Group 2: PMU Retry Counters. This group has 10 counters, that intend to
  28. count the total retry number of each type of uncorrectable error.
  29. - Group 3: PMU Common Counters. This group has 16 counters, that are used
  30. to count the common events.
  31. For now, the Driveway PMU driver only uses counters in group 0 and group 3.
  32. The DDR Controller (DDRCTL) and DDR PHY combine to create a complete solution
  33. for connecting an SoC application bus to DDR memory devices. The DDRCTL
  34. receives transactions Host Interface (HIF) which is custom-defined by Synopsys.
  35. These transactions are queued internally and scheduled for access while
  36. satisfying the SDRAM protocol timing requirements, transaction priorities, and
  37. dependencies between the transactions. The DDRCTL in turn issues commands on
  38. the DDR PHY Interface (DFI) to the PHY module, which launches and captures data
  39. to and from the SDRAM. The driveway PMUs have hardware logic to gather
  40. statistics and performance logging signals on HIF, DFI, etc.
  41. By counting the READ, WRITE and RMW commands sent to the DDRC through the HIF
  42. interface, we could calculate the bandwidth. Example usage of counting memory
  43. data bandwidth::
  44. perf stat \
  45. -e ali_drw_21000/hif_wr/ \
  46. -e ali_drw_21000/hif_rd/ \
  47. -e ali_drw_21000/hif_rmw/ \
  48. -e ali_drw_21000/cycle/ \
  49. -e ali_drw_21080/hif_wr/ \
  50. -e ali_drw_21080/hif_rd/ \
  51. -e ali_drw_21080/hif_rmw/ \
  52. -e ali_drw_21080/cycle/ \
  53. -e ali_drw_23000/hif_wr/ \
  54. -e ali_drw_23000/hif_rd/ \
  55. -e ali_drw_23000/hif_rmw/ \
  56. -e ali_drw_23000/cycle/ \
  57. -e ali_drw_23080/hif_wr/ \
  58. -e ali_drw_23080/hif_rd/ \
  59. -e ali_drw_23080/hif_rmw/ \
  60. -e ali_drw_23080/cycle/ \
  61. -e ali_drw_25000/hif_wr/ \
  62. -e ali_drw_25000/hif_rd/ \
  63. -e ali_drw_25000/hif_rmw/ \
  64. -e ali_drw_25000/cycle/ \
  65. -e ali_drw_25080/hif_wr/ \
  66. -e ali_drw_25080/hif_rd/ \
  67. -e ali_drw_25080/hif_rmw/ \
  68. -e ali_drw_25080/cycle/ \
  69. -e ali_drw_27000/hif_wr/ \
  70. -e ali_drw_27000/hif_rd/ \
  71. -e ali_drw_27000/hif_rmw/ \
  72. -e ali_drw_27000/cycle/ \
  73. -e ali_drw_27080/hif_wr/ \
  74. -e ali_drw_27080/hif_rd/ \
  75. -e ali_drw_27080/hif_rmw/ \
  76. -e ali_drw_27080/cycle/ -- sleep 10
  77. Example usage of counting all memory read/write bandwidth by metric::
  78. perf stat -M ddr_read_bandwidth.all -- sleep 10
  79. perf stat -M ddr_write_bandwidth.all -- sleep 10
  80. The average DRAM bandwidth can be calculated as follows:
  81. - Read Bandwidth = perf_hif_rd * DDRC_WIDTH * DDRC_Freq / DDRC_Cycle
  82. - Write Bandwidth = (perf_hif_wr + perf_hif_rmw) * DDRC_WIDTH * DDRC_Freq / DDRC_Cycle
  83. Here, DDRC_WIDTH = 64 bytes.
  84. The current driver does not support sampling. So "perf record" is
  85. unsupported. Also attach to a task is unsupported as the events are all
  86. uncore.