cxl.rst 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. .. SPDX-License-Identifier: GPL-2.0
  2. ======================================
  3. CXL Performance Monitoring Unit (CPMU)
  4. ======================================
  5. The CXL rev 3.0 specification provides a definition of CXL Performance
  6. Monitoring Unit in section 13.2: Performance Monitoring.
  7. CXL components (e.g. Root Port, Switch Upstream Port, End Point) may have
  8. any number of CPMU instances. CPMU capabilities are fully discoverable from
  9. the devices. The specification provides event definitions for all CXL protocol
  10. message types and a set of additional events for things commonly counted on
  11. CXL devices (e.g. DRAM events).
  12. CPMU driver
  13. ===========
  14. The CPMU driver registers a perf PMU with the name pmu_mem<X>.<Y> on the CXL bus
  15. representing the Yth CPMU for memX.
  16. /sys/bus/cxl/device/pmu_mem<X>.<Y>
  17. The associated PMU is registered as
  18. /sys/bus/event_sources/devices/cxl_pmu_mem<X>.<Y>
  19. In common with other CXL bus devices, the id has no specific meaning and the
  20. relationship to specific CXL device should be established via the device parent
  21. of the device on the CXL bus.
  22. PMU driver provides description of available events and filter options in sysfs.
  23. The "format" directory describes all formats of the config (event vendor id,
  24. group id and mask) config1 (threshold, filter enables) and config2 (filter
  25. parameters) fields of the perf_event_attr structure. The "events" directory
  26. describes all documented events show in perf list.
  27. The events shown in perf list are the most fine grained events with a single
  28. bit of the event mask set. More general events may be enable by setting
  29. multiple mask bits in config. For example, all Device to Host Read Requests
  30. may be captured on a single counter by setting the bits for all of
  31. * d2h_req_rdcurr
  32. * d2h_req_rdown
  33. * d2h_req_rdshared
  34. * d2h_req_rdany
  35. * d2h_req_rdownnodata
  36. Example of usage::
  37. $#perf list
  38. cxl_pmu_mem0.0/clock_ticks/ [Kernel PMU event]
  39. cxl_pmu_mem0.0/d2h_req_rdshared/ [Kernel PMU event]
  40. cxl_pmu_mem0.0/h2d_req_snpcur/ [Kernel PMU event]
  41. cxl_pmu_mem0.0/h2d_req_snpdata/ [Kernel PMU event]
  42. cxl_pmu_mem0.0/h2d_req_snpinv/ [Kernel PMU event]
  43. -----------------------------------------------------------
  44. $# perf stat -a -e cxl_pmu_mem0.0/clock_ticks/ -e cxl_pmu_mem0.0/d2h_req_rdshared/
  45. Vendor specific events may also be available and if so can be used via
  46. $# perf stat -a -e cxl_pmu_mem0.0/vid=VID,gid=GID,mask=MASK/
  47. The driver does not support sampling so "perf record" is unsupported.
  48. It only supports system-wide counting so attaching to a task is
  49. unsupported.