Skip to content

Commit 5d7107c

Browse files
jic23djbw
authored andcommitted
perf: CXL Performance Monitoring Unit driver
CXL rev 3.0 introduces a standard performance monitoring hardware block to CXL. Instances are discovered using CXL Register Locator DVSEC entries. Each CXL component may have multiple PMUs. This initial driver supports a subset of types of counter. It supports counters that are either fixed or configurable, but requires that they support the ability to freeze and write value whilst frozen. Development done with QEMU model which will be posted shortly. Example: $ perf stat -a -e cxl_pmu_mem0.0/h2d_req_snpcur/ -e cxl_pmu_mem0.0/h2d_req_snpdata/ -e cxl_pmu_mem0.0/clock_ticks/ sleep 1 Performance counter stats for 'system wide': 96,757,023,244,321 cxl_pmu_mem0.0/h2d_req_snpcur/ 96,757,023,244,365 cxl_pmu_mem0.0/h2d_req_snpdata/ 193,514,046,488,653 cxl_pmu_mem0.0/clock_ticks/ 1.090539600 seconds time elapsed Reviewed-by: Dave Jiang <dave.jiang@intel.com> Reviewed-by: Kan Liang <kan.liang@linux.intel.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Link: https://lore.kernel.org/r/20230526095824.16336-5-Jonathan.Cameron@huawei.com Signed-off-by: Dan Williams <dan.j.williams@intel.com>
1 parent 1ad3f70 commit 5d7107c

5 files changed

Lines changed: 1023 additions & 0 deletions

File tree

MAINTAINERS

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5193,6 +5193,12 @@ S: Maintained
51935193
F: drivers/cxl/
51945194
F: include/uapi/linux/cxl_mem.h
51955195

5196+
COMPUTE EXPRESS LINK PMU (CPMU)
5197+
M: Jonathan Cameron <jonathan.cameron@huawei.com>
5198+
L: linux-cxl@vger.kernel.org
5199+
S: Maintained
5200+
F: drivers/perf/cxl_pmu.c
5201+
51965202
CONEXANT ACCESSRUNNER USB DRIVER
51975203
L: accessrunner-general@lists.sourceforge.net
51985204
S: Orphan

drivers/cxl/Kconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,4 +139,17 @@ config CXL_REGION_INVALIDATION_TEST
139139
If unsure, or if this kernel is meant for production environments,
140140
say N.
141141

142+
config CXL_PMU
143+
tristate "CXL Performance Monitoring Unit"
144+
default CXL_BUS
145+
depends on PERF_EVENTS
146+
help
147+
Support performance monitoring as defined in CXL rev 3.0
148+
section 13.2: Performance Monitoring. CXL components may have
149+
one or more CXL Performance Monitoring Units (CPMUs).
150+
151+
Say 'y/m' to enable a driver that will attach to performance
152+
monitoring units and provide standard perf based interfaces.
153+
154+
If unsure say 'm'.
142155
endif

drivers/perf/Kconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,4 +213,17 @@ source "drivers/perf/arm_cspmu/Kconfig"
213213

214214
source "drivers/perf/amlogic/Kconfig"
215215

216+
config CXL_PMU
217+
tristate "CXL Performance Monitoring Unit"
218+
depends on CXL_BUS
219+
help
220+
Support performance monitoring as defined in CXL rev 3.0
221+
section 13.2: Performance Monitoring. CXL components may have
222+
one or more CXL Performance Monitoring Units (CPMUs).
223+
224+
Say 'y/m' to enable a driver that will attach to performance
225+
monitoring units and provide standard perf based interfaces.
226+
227+
If unsure say 'm'.
228+
216229
endmenu

drivers/perf/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ obj-$(CONFIG_APPLE_M1_CPU_PMU) += apple_m1_cpu_pmu.o
2424
obj-$(CONFIG_ALIBABA_UNCORE_DRW_PMU) += alibaba_uncore_drw_pmu.o
2525
obj-$(CONFIG_ARM_CORESIGHT_PMU_ARCH_SYSTEM_PMU) += arm_cspmu/
2626
obj-$(CONFIG_MESON_DDR_PMU) += amlogic/
27+
obj-$(CONFIG_CXL_PMU) += cxl_pmu.o

0 commit comments

Comments
 (0)