CXL 3.0 Performance Monitoring Unit support
Subsystems (3)
cover CXL 3.0 Performance Monitoring Unit support
The CXL rev 3.0 specification introduces a CXL Performance Monitoring Unit definition. CXL components may have any number of these blocks. The definition is highly flexible, but that does bring complexity in the driver.
Initially posted as an RFC for a number of reasons.
1) The QEMU model against which this was developed needs tidying up and review for correctness. I'll reply with a link to that thread once the QEMU code has been posted for review.
2) There are quite a lot of corner cases that will need working through with variants of the model, or I'll have to design a pathological set of CPMUs to hit all the corner cases in one go.
3) I'm not sure it makes sense to hang this of the cxl/pci driver but couldn't really figure out where else in the current structure we could make it fit cleanly.
4) The interrupt initialization code is something we talked about for DOE but in the end DOE interrupt support was dropped (for now). It requires the cxl/pci driver to do a small amount of parsing of registers otherwise only relevant to the CPMU driver in order to establish what interrupt vector the CPMU is using and hence ensure the cxl/pci driver requests sufficient vectors. Given this effects how other interrupts will be handled in cxl/pci, we need to confirm the handle in general enough to not need a complete rewrite when we add another interrupt use case.
5) I'm not sure how to expose to user space the sets of events that may be summed (given by a mask in the Counter Event Capabilities registers). For now the driver advertises the individual events. Each individual event may form part of multiple overlapping groups for example. It may be a case of these allowed combinations only being discoverable by requesting a combination and checking for errors on start.
6) Driver location. In past perf maintainers have requested perf drivers for PCI etc be under drivers/perf. That would require moving some CXL headers to be more generally visible, but is certainly possible if there is agreement between CXL and perf maintainers on the correct location.
7) Documentation needs improving, but I didn't want to spend too much time on that whilst we have so many open questions. I'll separately raise the question about pmu->dev parenting which is mentioned in the Docs patch introduction.
CXL rev 3.0 specification available from https://www.computeexpresslink.org
Jonathan Cameron (4):
cxl: Add function to count regblocks of a given type. cxl/pci: Find and register CXL PMU devices
cxl: CXL Performance Monitoring Unit driver
docs: perf: Minimal introduction the the CXL PMU device and driver.
Documentation/admin-guide/perf/cxl.rst | 60 ++ Documentation/admin-guide/perf/index.rst | 1 + drivers/cxl/Kconfig | 12 + drivers/cxl/Makefile | 1 + drivers/cxl/core/Makefile | 1 + drivers/cxl/core/core.h | 3 + drivers/cxl/core/cpmu.c | 67 ++ drivers/cxl/core/pci.c | 2 +- drivers/cxl/core/port.c | 4 +- drivers/cxl/core/regs.c | 64 +- drivers/cxl/cpmu.c | 942 +++++++++++++++++++++++ drivers/cxl/cpmu.h | 54 ++ drivers/cxl/cxl.h | 16 + drivers/cxl/cxlpci.h | 1 + drivers/cxl/pci.c | 78 +- 15 files changed, 1299 insertions(+), 7 deletions(-) create mode 100644 Documentation/admin-guide/perf/cxl.rst create mode 100644 drivers/cxl/core/cpmu.c create mode 100644 drivers/cxl/cpmu.c create mode 100644 drivers/cxl/cpmu.h
Signature · 1 line
2.32.0
RFC PATCH 1/4 cxl: Add function to count regblocks of a given type.
Until the recently release CXL 3.0 specification, there was only ever one instance of any given register block pointed to by the Register Block Locator DVSEC. Now, the specification allows for multiple CXL PMU instances, each with their own register block.
To enable this add an index parameter to cxl_find_regblock() and use that to implement cxl_count_regblock().
--- drivers/cxl/core/pci.c | 2 +- drivers/cxl/core/port.c | 2 +- drivers/cxl/core/regs.c | 35 ++++++++++++++++++++++++++++++++--- drivers/cxl/cxl.h | 3 ++- drivers/cxl/pci.c | 2 +- 5 files changed, 37 insertions(+), 7 deletions(-)
drivers/cxl/core/pci.c +1 -1
@@ -49,7 +49,7 @@ static int match_add_dports(struct pci_dev *pdev, void *data) &lnkcap))return 0 ; - rc =cxl_find_regblock (pdev,CXL_REGLOC_RBI_COMPONENT , &map); + rc =cxl_find_regblock (pdev,CXL_REGLOC_RBI_COMPONENT , &map,0 );if (rc)dev_dbg (&port->dev,"failed to find component registers\n" );
drivers/cxl/core/port.c +1 -1
@@ -1235,7 +1235,7 @@ static resource_size_t find_component_registers(struct device *dev) pdev =to_pci_dev (dev); -cxl_find_regblock (pdev,CXL_REGLOC_RBI_COMPONENT , &map); +cxl_find_regblock (pdev,CXL_REGLOC_RBI_COMPONENT , &map,0 );return cxl_regmap_to_base (pdev, &map); }
drivers/cxl/core/regs.c +32 -3
@@ -262,6 +262,7 @@ static void cxl_decode_regblock(u32 reg_lo, u32 reg_hi,* @pdev: The CXL PCI device to enumerate. * @type: Register Block Indicator id * @map: Enumeration output, clobbered on error +* @index: Index into which particular instance of a regblock we want. * * Return: 0 if register block enumerated, negative error code otherwise *
@@ -269,9 +270,10 @@ static void cxl_decode_regblock(u32 reg_lo, u32 reg_hi,* by @type. */ int cxl_find_regblock (struct pci_dev *pdev,enum cxl_regloc_type type, -struct cxl_register_map *map) +struct cxl_register_map *map,int index) {u32 regloc_size, regblocks; +int instance =0 ;int regloc, i; map->block_offset =U64_MAX ;
@@ -294,11 +296,38 @@ int cxl_find_regblock(struct pci_dev *pdev, enum cxl_regloc_type type,cxl_decode_regblock (reg_lo, reg_hi, map); -if (map->reg_type == type) -return 0 ; +if (map->reg_type == type) { +if (index == instance) +return 0 ; + instance++; + } } map->block_offset =U64_MAX ;return -ENODEV ; }EXPORT_SYMBOL_NS_GPL (cxl_find_regblock,CXL ); + +/** +* cxl_count_regblock() - Count instances of a given regblock type. +* @pdev: The CXL PCI device to enumerate. +* @type: Register Block Indicator id +* +* Some regblocks may be repeated. Count how many instances. +* +* Return: count of matching regblocks. +*/ +int cxl_count_regblock (struct pci_dev *pdev,enum cxl_regloc_type type) +{ +struct cxl_register_map map; +int rc, count =0 ; + +while (1 ) { + rc =cxl_find_regblock (pdev, type, &map, count); +if (rc) +return count; + count++; + } +} +EXPORT_SYMBOL_NS_GPL (cxl_count_regblock,CXL ); +
drivers/cxl/cxl.h +2 -1
@@ -216,8 +216,9 @@ int cxl_map_device_regs(struct pci_dev *pdev, struct cxl_register_map *map);enum cxl_regloc_type ; +int cxl_count_regblock (struct pci_dev *pdev,enum cxl_regloc_type type);int cxl_find_regblock (struct pci_dev *pdev,enum cxl_regloc_type type, -struct cxl_register_map *map); +struct cxl_register_map *map,int index);void __iomem *devm_cxl_iomap_block (struct device *dev,resource_size_t addr,resource_size_t length);
drivers/cxl/pci.c +1 -1
@@ -373,7 +373,7 @@ static int cxl_setup_regs(struct pci_dev *pdev, enum cxl_regloc_type type, {int rc; - rc =cxl_find_regblock (pdev, type, map); + rc =cxl_find_regblock (pdev, type, map,0 );if (rc)return rc;
Signature · 1 line
2.32.0
RFC PATCH 2/4 cxl/pci: Find and register CXL PMU devices
In reply to Jonathan CameronCXL PMU devices can be found from entries in the Register Locator DVSEC.
In order to register the minimum number of IRQ vectors necessary to support all CPMUs found, separate the registration into two steps. First find the devices, and query the IRQs used and then register the devices. Between these two steps, request the IRQ vectors necessary and enable bus master support.
Future IRQ users for CXL type 3 devices (e.g. DOEs) will need to follow a similar pattern the number of vectors necessary is known before any parts of the driver stack rely on their availability.
---
Open questions
1) Is this IRQ vector 'count' / request then use approach flexible enough for other interrupt users on these devices.
2) Does hanging the CPMU off the PCI device make sense. These can occur in Switch upstream ports as well.
3) Naming. It would be nice if the device naming indicated which EP these were associated with, but that wouldn't be inline with the rest of the CXL bus device naming. What is best option here?
--- drivers/cxl/core/Makefile | 1 + drivers/cxl/core/core.h | 3 ++ drivers/cxl/core/cpmu.c | 67 ++++++++++++++++++++++++++++++++++ drivers/cxl/core/port.c | 2 ++ drivers/cxl/core/regs.c | 29 +++++++++++++++ drivers/cxl/cpmu.h | 54 ++++++++++++++++++++++++++++ drivers/cxl/cxl.h | 15 ++++++++ drivers/cxl/cxlpci.h | 1 + drivers/cxl/pci.c | 76 ++++++++++++++++++++++++++++++++++++++- 9 files changed, 247 insertions(+), 1 deletion(-)
drivers/cxl/core/Makefile +1 -0
@@ -10,4 +10,5 @@ cxl_core-y += memdev.o cxl_core-y += mbox.o cxl_core-y += pci.o cxl_core-y += hdm.o +cxl_core-y += cpmu.o cxl_core-$(CONFIG_CXL_REGION) += region.o
drivers/cxl/core/core.h +3 -0
@@ -14,12 +14,14 @@ extern struct device_attribute dev_attr_create_pmem_region;extern struct device_attribute dev_attr_delete_region;extern struct device_attribute dev_attr_region;extern const struct device_type cxl_pmem_region_type; +extern const struct device_type cxl_cpmu_type;extern const struct device_type cxl_region_type;void cxl_decoder_kill_region (struct cxl_endpoint_decoder *cxled);#define CXL_REGION_ATTR (x) (&dev_attr_##x.attr)#define CXL_REGION_TYPE (x) (&cxl_region_type)#define SET_CXL_REGION_ATTR (x) (&dev_attr_##x.attr),#define CXL_PMEM_REGION_TYPE (x) (&cxl_pmem_region_type) +#define CXL_CPMU_TYPE (x) (&cxl_cpmu_region_type)int cxl_region_init (void );void cxl_region_exit (void );#else
@@ -37,6 +39,7 @@ static inline void cxl_region_exit(void)#define CXL_REGION_TYPE (x) NULL#define SET_CXL_REGION_ATTR (x)#define CXL_PMEM_REGION_TYPE (x) NULL +#define CXL_CPMU_TYPE (x) NULL#endif struct cxl_send_command ;
drivers/cxl/core/cpmu.c new file +67 -0
67 lines not on this page · raw message
drivers/cxl/core/port.c +2 -0
@@ -55,6 +55,8 @@ static int cxl_device_id(struct device *dev)return CXL_DEVICE_MEMORY_EXPANDER ;if (dev->type ==CXL_REGION_TYPE ())return CXL_DEVICE_REGION ; +if (dev->type == &cxl_cpmu_type) +return CXL_DEVICE_CPMU ;return 0 ; }
drivers/cxl/core/regs.c +29 -0
@@ -6,6 +6,7 @@#include <linux/pci.h> #include <cxlmem.h> #include <cxlpci.h> +#include <cpmu.h> /** * DOC: cxl registers
@@ -331,3 +332,31 @@ int cxl_count_regblock(struct pci_dev *pdev, enum cxl_regloc_type type) }EXPORT_SYMBOL_NS_GPL (cxl_count_regblock,CXL ); +int cxl_map_cpmu_regs (struct pci_dev *pdev, +struct cxl_cpmu_regs *regs, +struct cxl_register_map *map) +{ +struct device *dev = &pdev->dev; +resource_size_t phys_addr; + + phys_addr =pci_resource_start (pdev, map->barno) + map->block_offset; + regs->cpmu =devm_cxl_iomap_block (dev, phys_addr,CPMU_REGMAP_SIZE ); +if (!regs->cpmu) +return -ENOMEM ; + +return 0 ; +} +EXPORT_SYMBOL_NS_GPL (cxl_map_cpmu_regs,CXL ); + +int cxl_cpmu_get_irq (struct cxl_cpmu_regs *regs) +{ +int irq =-1 ; +u64 val; + + val =readq (regs->cpmu +CPMU_CAP_REG ); +if (FIELD_GET (CPMU_CAP_INT , val)) + irq =FIELD_GET (CPMU_CAP_MSI_N_MSK , val); + +return irq; +} +EXPORT_SYMBOL_NS_GPL (cxl_cpmu_get_irq,CXL );
drivers/cxl/cpmu.h new file +54 -0
54 lines not on this page · raw message
drivers/cxl/cxl.h +15 -0
@@ -166,6 +166,10 @@ struct cxl_regs {struct_group_tagged (cxl_device_regs, device_regs, void __iomem *status, *mbox, *memdev; ); + +struct_group_tagged (cxl_cpmu_regs, cpmu_regs, + void __iomem *cpmu; + ); };struct cxl_reg_map {
@@ -184,6 +188,10 @@ struct cxl_device_reg_map {struct cxl_reg_map memdev; }; +struct cxl_cpmu_reg_map { +struct cxl_reg_map cpmu; +}; +/** * struct cxl_register_map - DVSEC harvested register block mapping parameters * @base: virtual base of the register-block-BAR + @block_offset
@@ -201,6 +209,7 @@ struct cxl_register_map {union {struct cxl_component_reg_map component_map;struct cxl_device_reg_map device_map; +struct cxl_cpmu_reg_map cpmu_map; }; };
@@ -219,6 +228,10 @@ enum cxl_regloc_type;int cxl_count_regblock (struct pci_dev *pdev,enum cxl_regloc_type type);int cxl_find_regblock (struct pci_dev *pdev,enum cxl_regloc_type type,struct cxl_register_map *map,int index); +int cxl_map_cpmu_regs (struct pci_dev *pdev, +struct cxl_cpmu_regs *regs, +struct cxl_register_map *map); +int cxl_cpmu_get_irq (struct cxl_cpmu_regs *regs);void __iomem *devm_cxl_iomap_block (struct device *dev,resource_size_t addr,resource_size_t length);
@@ -626,6 +639,7 @@ void cxl_driver_unregister(struct cxl_driver *cxl_drv);#define CXL_DEVICE_MEMORY_EXPANDER 5#define CXL_DEVICE_REGION 6#define CXL_DEVICE_PMEM_REGION 7 +#define CXL_DEVICE_CPMU 8#define MODULE_ALIAS_CXL (type) MODULE_ALIAS("cxl:t" __stringify(type) "*")#define CXL_MODALIAS_FMT "cxl:t%d"
@@ -653,6 +667,7 @@ static inline struct cxl_pmem_region *to_cxl_pmem_region(struct device *dev) }#endif +int devm_cxl_cpmu_add (struct device *parent,struct cxl_cpmu_regs *regs,int idx);/* * Unit test builds overrides this to __weak, find the 'strong' version * of these symbols in tools/testing/cxl/.
drivers/cxl/cxlpci.h +1 -0
@@ -59,6 +59,7 @@ enum cxl_regloc_type {CXL_REGLOC_RBI_COMPONENT ,CXL_REGLOC_RBI_VIRT ,CXL_REGLOC_RBI_MEMDEV , +CXL_REGLOC_RBI_CPMU , CXL_REGLOC_RBI_TYPES };
drivers/cxl/pci.c +75 -1
93 lines not on this page · raw message
Signature · 1 line
2.32.0
kernel test robot
build botRe: [RFC PATCH 2/4] cxl/pci: Find and register CXL PMU devices
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in…
Hi Jonathan,
[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on linus/master]
[also build test WARNING on next-20220812]
[cannot apply to arm-perf/for-next/perf v5.19]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Jonathan-Cameron/CXL-3-0-Performance-Monitoring-Unit-support/20220812-231616 base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 7ebfc85e2cd7b08f518b526173e9a33b56b3913b config: i386-randconfig-a004 (https://download.01.org/0day-ci/archive/20220813/[email protected]/config) compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 5f1c7e2cc5a3c07cbc2412e851a7283c1841f520)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/7cf02b82d964e4cb9937ee6ce8b4d36e24807544
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Jonathan-Cameron/CXL-3-0-Performance-Monitoring-Unit-support/20220812-231616 git checkout 7cf02b82d964e4cb9937ee6ce8b4d36e24807544
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/cxl/
If you fix the issue, kindly add following tag where applicable
All warnings (new ones prefixed by >>):
>> drivers/cxl/core/regs.c:357:16: warning: shift count >= width of type [-Wshift-count-overflow]
if (FIELD_GET(CPMU_CAP_INT, val))
~~~~~~~~~~^~~~~~~~~~~~~~~~~~
drivers/cxl/cpmu.h:17:27: note: expanded from macro 'CPMU_CAP_INT'
#define CPMU_CAP_INT BIT(50)
^
include/vdso/bits.h:7:26: note: expanded from macro 'BIT'
#define BIT(nr) (UL(1) << (nr))
^
include/linux/bitfield.h:128:20: note: expanded from macro 'FIELD_GET'
__BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \
~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/compiler_types.h:354:22: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:342:23: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:334:9: note: expanded from macro '__compiletime_assert'
if (!(condition)) \
^~~~~~~~~
>> drivers/cxl/core/regs.c:357:16: warning: shift count >= width of type [-Wshift-count-overflow]
if (FIELD_GET(CPMU_CAP_INT, val))
~~~~~~~~~~^~~~~~~~~~~~~~~~~~
drivers/cxl/cpmu.h:17:27: note: expanded from macro 'CPMU_CAP_INT'
#define CPMU_CAP_INT BIT(50)
^
include/vdso/bits.h:7:26: note: expanded from macro 'BIT'
#define BIT(nr) (UL(1) << (nr))
^
include/linux/bitfield.h:128:20: note: expanded from macro 'FIELD_GET'
__BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \
~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/compiler_types.h:354:22: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:342:23: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:334:9: note: expanded from macro '__compiletime_assert'
if (!(condition)) \
^~~~~~~~~
>> drivers/cxl/core/regs.c:357:16: warning: shift count >= width of type [-Wshift-count-overflow]
if (FIELD_GET(CPMU_CAP_INT, val))
~~~~~~~~~~^~~~~~~~~~~~~~~~~~
drivers/cxl/cpmu.h:17:27: note: expanded from macro 'CPMU_CAP_INT'
#define CPMU_CAP_INT BIT(50)
^
include/vdso/bits.h:7:26: note: expanded from macro 'BIT'
#define BIT(nr) (UL(1) << (nr))
^
include/linux/bitfield.h:128:20: note: expanded from macro 'FIELD_GET'
__BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \
~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/compiler_types.h:354:22: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:342:23: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:334:9: note: expanded from macro '__compiletime_assert'
if (!(condition)) \
^~~~~~~~~
>> drivers/cxl/core/regs.c:357:16: warning: shift count >= width of type [-Wshift-count-overflow]
if (FIELD_GET(CPMU_CAP_INT, val))
~~~~~~~~~~^~~~~~~~~~~~~~~~~~
drivers/cxl/cpmu.h:17:27: note: expanded from macro 'CPMU_CAP_INT'
#define CPMU_CAP_INT BIT(50)
^
include/vdso/bits.h:7:26: note: expanded from macro 'BIT'
#define BIT(nr) (UL(1) << (nr))
^
include/linux/bitfield.h:128:20: note: expanded from macro 'FIELD_GET'
__BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \
~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: (skipping 3 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/compiler_types.h:354:22: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:342:23: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:334:9: note: expanded from macro '__compiletime_assert'
if (!(condition)) \
^~~~~~~~~
>> drivers/cxl/core/regs.c:357:16: warning: shift count >= width of type [-Wshift-count-overflow]
if (FIELD_GET(CPMU_CAP_INT, val))
~~~~~~~~~~^~~~~~~~~~~~~~~~~~
drivers/cxl/cpmu.h:17:27: note: expanded from macro 'CPMU_CAP_INT'
#define CPMU_CAP_INT BIT(50)
^
include/vdso/bits.h:7:26: note: expanded from macro 'BIT'
#define BIT(nr) (UL(1) << (nr))
^
include/linux/bitfield.h:128:20: note: expanded from macro 'FIELD_GET'
__BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \
~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: (skipping 3 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/compiler_types.h:354:22: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:342:23: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:334:9: note: expanded from macro '__compiletime_assert'
if (!(condition)) \
^~~~~~~~~
>> drivers/cxl/core/regs.c:357:16: warning: shift count >= width of type [-Wshift-count-overflow]
if (FIELD_GET(CPMU_CAP_INT, val))
~~~~~~~~~~^~~~~~~~~~~~~~~~~~
drivers/cxl/cpmu.h:17:27: note: expanded from macro 'CPMU_CAP_INT'
#define CPMU_CAP_INT BIT(50)
^
include/vdso/bits.h:7:26: note: expanded from macro 'BIT'
#define BIT(nr) (UL(1) << (nr))
^
include/linux/bitfield.h:128:20: note: expanded from macro 'FIELD_GET'
__BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \
~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: (skipping 4 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/compiler_types.h:354:22: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:342:23: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:334:9: note: expanded from macro '__compiletime_assert'
if (!(condition)) \
^~~~~~~~~
>> drivers/cxl/core/regs.c:357:16: warning: shift count >= width of type [-Wshift-count-overflow]
if (FIELD_GET(CPMU_CAP_INT, val))
~~~~~~~~~~^~~~~~~~~~~~~~~~~~
drivers/cxl/cpmu.h:17:27: note: expanded from macro 'CPMU_CAP_INT'
#define CPMU_CAP_INT BIT(50)
^
include/vdso/bits.h:7:26: note: expanded from macro 'BIT'
#define BIT(nr) (UL(1) << (nr))
^
include/linux/bitfield.h:128:20: note: expanded from macro 'FIELD_GET'
__BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \
~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: (skipping 5 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/compiler_types.h:354:22: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:342:23: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:334:9: note: expanded from macro '__compiletime_assert'
if (!(condition)) \
^~~~~~~~~
>> drivers/cxl/core/regs.c:357:16: warning: shift count >= width of type [-Wshift-count-overflow]
if (FIELD_GET(CPMU_CAP_INT, val))
~~~~~~~~~~^~~~~~~~~~~~~~~~~~
drivers/cxl/cpmu.h:17:27: note: expanded from macro 'CPMU_CAP_INT'
#define CPMU_CAP_INT BIT(50)
^
include/vdso/bits.h:7:26: note: expanded from macro 'BIT'
#define BIT(nr) (UL(1) << (nr))
^
include/linux/bitfield.h:128:20: note: expanded from macro 'FIELD_GET'
__BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \
~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: (skipping 4 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/compiler_types.h:354:22: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:342:23: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:334:9: note: expanded from macro '__compiletime_assert'
if (!(condition)) \
^~~~~~~~~
>> drivers/cxl/core/regs.c:357:16: warning: shift count >= width of type [-Wshift-count-overflow]
if (FIELD_GET(CPMU_CAP_INT, val))
~~~~~~~~~~^~~~~~~~~~~~~~~~~~
drivers/cxl/cpmu.h:17:27: note: expanded from macro 'CPMU_CAP_INT'
#define CPMU_CAP_INT BIT(50)
^
include/vdso/bits.h:7:26: note: expanded from macro 'BIT'
#define BIT(nr) (UL(1) << (nr))
^
include/linux/bitfield.h:128:20: note: expanded from macro 'FIELD_GET'
__BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \
~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: (skipping 5 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/compiler_types.h:354:22: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:342:23: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:334:9: note: expanded from macro '__compiletime_assert'
if (!(condition)) \
^~~~~~~~~
>> drivers/cxl/core/regs.c:357:16: warning: shift count >= width of type [-Wshift-count-overflow]
if (FIELD_GET(CPMU_CAP_INT, val))
~~~~~~~~~~^~~~~~~~~~~~~~~~~~
drivers/cxl/cpmu.h:17:27: note: expanded from macro 'CPMU_CAP_INT'
#define CPMU_CAP_INT BIT(50)
^
include/vdso/bits.h:7:26: note: expanded from macro 'BIT'
#define BIT(nr) (UL(1) << (nr))
^
include/linux/bitfield.h:129:30: note: expanded from macro 'FIELD_GET'
(typeof(_mask))(((_reg) & (_mask)) >> __bf_shf(_mask)); \
^~~~~
>> drivers/cxl/core/regs.c:357:16: warning: shift count >= width of type [-Wshift-count-overflow]
if (FIELD_GET(CPMU_CAP_INT, val))
~~~~~~~~~~^~~~~~~~~~~~~~~~~~
drivers/cxl/cpmu.h:17:27: note: expanded from macro 'CPMU_CAP_INT'
#define CPMU_CAP_INT BIT(50)
^
include/vdso/bits.h:7:26: note: expanded from macro 'BIT'
#define BIT(nr) (UL(1) << (nr))
^
include/linux/bitfield.h:129:50: note: expanded from macro 'FIELD_GET'
(typeof(_mask))(((_reg) & (_mask)) >> __bf_shf(_mask)); \
~~~~~~~~~^~~~~~
include/linux/bitfield.h:45:38: note: expanded from macro '__bf_shf'
#define __bf_shf(x) (__builtin_ffsll(x) - 1)
^11 warnings generated.
vim +357 drivers/cxl/core/regs.c
350
351 int cxl_cpmu_get_irq(struct cxl_cpmu_regs *regs)
352 {
353 int irq = -1;
354 u64 val;
355
356 val = readq(regs->cpmu + CPMU_CAP_REG);
> 357 if (FIELD_GET(CPMU_CAP_INT, val))
Signature · 2 lines
0-DAY CI Kernel Test Service https://01.org/lkp
kernel test robot
build botRe: [RFC PATCH 2/4] cxl/pci: Find and register CXL PMU devices
In reply to Jonathan Cameron[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in…
Hi Jonathan,
[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on linus/master]
[also build test WARNING on next-20220812]
[cannot apply to arm-perf/for-next/perf v5.19]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Jonathan-Cameron/CXL-3-0-Performance-Monitoring-Unit-support/20220812-231616 base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 7ebfc85e2cd7b08f518b526173e9a33b56b3913b config: i386-randconfig-a013 (https://download.01.org/0day-ci/archive/20220813/[email protected]/config) compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 5f1c7e2cc5a3c07cbc2412e851a7283c1841f520)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/7cf02b82d964e4cb9937ee6ce8b4d36e24807544
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Jonathan-Cameron/CXL-3-0-Performance-Monitoring-Unit-support/20220812-231616 git checkout 7cf02b82d964e4cb9937ee6ce8b4d36e24807544
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/cxl/
If you fix the issue, kindly add following tag where applicable
All warnings (new ones prefixed by >>):
>> drivers/cxl/core/regs.c:357:16: warning: shift count >= width of type [-Wshift-count-overflow]
if (FIELD_GET(CPMU_CAP_INT, val))
~~~~~~~~~~^~~~~~~~~~~~~~~~~~
drivers/cxl/cpmu.h:17:27: note: expanded from macro 'CPMU_CAP_INT'
#define CPMU_CAP_INT BIT(50)
^
include/vdso/bits.h:7:26: note: expanded from macro 'BIT'
#define BIT(nr) (UL(1) << (nr))
^
include/linux/bitfield.h:128:20: note: expanded from macro 'FIELD_GET'
__BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \
~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/compiler_types.h:354:22: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:342:23: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:334:9: note: expanded from macro '__compiletime_assert'
if (!(condition)) \
^~~~~~~~~
>> drivers/cxl/core/regs.c:357:16: warning: shift count >= width of type [-Wshift-count-overflow]
if (FIELD_GET(CPMU_CAP_INT, val))
~~~~~~~~~~^~~~~~~~~~~~~~~~~~
drivers/cxl/cpmu.h:17:27: note: expanded from macro 'CPMU_CAP_INT'
#define CPMU_CAP_INT BIT(50)
^
include/vdso/bits.h:7:26: note: expanded from macro 'BIT'
#define BIT(nr) (UL(1) << (nr))
^
include/linux/bitfield.h:128:20: note: expanded from macro 'FIELD_GET'
__BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \
~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/compiler_types.h:354:22: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:342:23: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:334:9: note: expanded from macro '__compiletime_assert'
if (!(condition)) \
^~~~~~~~~
>> drivers/cxl/core/regs.c:357:16: warning: shift count >= width of type [-Wshift-count-overflow]
if (FIELD_GET(CPMU_CAP_INT, val))
~~~~~~~~~~^~~~~~~~~~~~~~~~~~
drivers/cxl/cpmu.h:17:27: note: expanded from macro 'CPMU_CAP_INT'
#define CPMU_CAP_INT BIT(50)
^
include/vdso/bits.h:7:26: note: expanded from macro 'BIT'
#define BIT(nr) (UL(1) << (nr))
^
include/linux/bitfield.h:128:20: note: expanded from macro 'FIELD_GET'
__BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \
~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: (skipping 2 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/compiler_types.h:354:22: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:342:23: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:334:9: note: expanded from macro '__compiletime_assert'
if (!(condition)) \
^~~~~~~~~
>> drivers/cxl/core/regs.c:357:16: warning: shift count >= width of type [-Wshift-count-overflow]
if (FIELD_GET(CPMU_CAP_INT, val))
~~~~~~~~~~^~~~~~~~~~~~~~~~~~
drivers/cxl/cpmu.h:17:27: note: expanded from macro 'CPMU_CAP_INT'
#define CPMU_CAP_INT BIT(50)
^
include/vdso/bits.h:7:26: note: expanded from macro 'BIT'
#define BIT(nr) (UL(1) << (nr))
^
include/linux/bitfield.h:128:20: note: expanded from macro 'FIELD_GET'
__BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \
~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: (skipping 3 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/compiler_types.h:354:22: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:342:23: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:334:9: note: expanded from macro '__compiletime_assert'
if (!(condition)) \
^~~~~~~~~
>> drivers/cxl/core/regs.c:357:16: warning: shift count >= width of type [-Wshift-count-overflow]
if (FIELD_GET(CPMU_CAP_INT, val))
~~~~~~~~~~^~~~~~~~~~~~~~~~~~
drivers/cxl/cpmu.h:17:27: note: expanded from macro 'CPMU_CAP_INT'
#define CPMU_CAP_INT BIT(50)
^
include/vdso/bits.h:7:26: note: expanded from macro 'BIT'
#define BIT(nr) (UL(1) << (nr))
^
include/linux/bitfield.h:128:20: note: expanded from macro 'FIELD_GET'
__BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \
~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: (skipping 3 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/compiler_types.h:354:22: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:342:23: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:334:9: note: expanded from macro '__compiletime_assert'
if (!(condition)) \
^~~~~~~~~
>> drivers/cxl/core/regs.c:357:16: warning: shift count >= width of type [-Wshift-count-overflow]
if (FIELD_GET(CPMU_CAP_INT, val))
~~~~~~~~~~^~~~~~~~~~~~~~~~~~
drivers/cxl/cpmu.h:17:27: note: expanded from macro 'CPMU_CAP_INT'
#define CPMU_CAP_INT BIT(50)
^
include/vdso/bits.h:7:26: note: expanded from macro 'BIT'
#define BIT(nr) (UL(1) << (nr))
^
include/linux/bitfield.h:128:20: note: expanded from macro 'FIELD_GET'
__BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \
~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: (skipping 4 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/compiler_types.h:354:22: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:342:23: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:334:9: note: expanded from macro '__compiletime_assert'
if (!(condition)) \
^~~~~~~~~
>> drivers/cxl/core/regs.c:357:16: warning: shift count >= width of type [-Wshift-count-overflow]
if (FIELD_GET(CPMU_CAP_INT, val))
~~~~~~~~~~^~~~~~~~~~~~~~~~~~
drivers/cxl/cpmu.h:17:27: note: expanded from macro 'CPMU_CAP_INT'
#define CPMU_CAP_INT BIT(50)
^
include/vdso/bits.h:7:26: note: expanded from macro 'BIT'
#define BIT(nr) (UL(1) << (nr))
^
include/linux/bitfield.h:128:20: note: expanded from macro 'FIELD_GET'
__BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \
~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: (skipping 5 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/compiler_types.h:354:22: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:342:23: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:334:9: note: expanded from macro '__compiletime_assert'
if (!(condition)) \
^~~~~~~~~
>> drivers/cxl/core/regs.c:357:16: warning: shift count >= width of type [-Wshift-count-overflow]
if (FIELD_GET(CPMU_CAP_INT, val))
~~~~~~~~~~^~~~~~~~~~~~~~~~~~
drivers/cxl/cpmu.h:17:27: note: expanded from macro 'CPMU_CAP_INT'
#define CPMU_CAP_INT BIT(50)
^
include/vdso/bits.h:7:26: note: expanded from macro 'BIT'
#define BIT(nr) (UL(1) << (nr))
^
include/linux/bitfield.h:128:20: note: expanded from macro 'FIELD_GET'
__BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \
~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: (skipping 4 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/compiler_types.h:354:22: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:342:23: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:334:9: note: expanded from macro '__compiletime_assert'
if (!(condition)) \
^~~~~~~~~
>> drivers/cxl/core/regs.c:357:16: warning: shift count >= width of type [-Wshift-count-overflow]
if (FIELD_GET(CPMU_CAP_INT, val))
~~~~~~~~~~^~~~~~~~~~~~~~~~~~
drivers/cxl/cpmu.h:17:27: note: expanded from macro 'CPMU_CAP_INT'
#define CPMU_CAP_INT BIT(50)
^
include/vdso/bits.h:7:26: note: expanded from macro 'BIT'
#define BIT(nr) (UL(1) << (nr))
^
include/linux/bitfield.h:128:20: note: expanded from macro 'FIELD_GET'
__BF_FIELD_CHECK(_mask, _reg, 0U, "FIELD_GET: "); \
~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
note: (skipping 5 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
include/linux/compiler_types.h:354:22: note: expanded from macro 'compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:342:23: note: expanded from macro '_compiletime_assert'
__compiletime_assert(condition, msg, prefix, suffix)
~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/compiler_types.h:334:9: note: expanded from macro '__compiletime_assert'
if (!(condition)) \
^~~~~~~~~
>> drivers/cxl/core/regs.c:357:16: warning: shift count >= width of type [-Wshift-count-overflow]
if (FIELD_GET(CPMU_CAP_INT, val))
~~~~~~~~~~^~~~~~~~~~~~~~~~~~
drivers/cxl/cpmu.h:17:27: note: expanded from macro 'CPMU_CAP_INT'
#define CPMU_CAP_INT BIT(50)
^
include/vdso/bits.h:7:26: note: expanded from macro 'BIT'
#define BIT(nr) (UL(1) << (nr))
^
include/linux/bitfield.h:129:30: note: expanded from macro 'FIELD_GET'
(typeof(_mask))(((_reg) & (_mask)) >> __bf_shf(_mask)); \
^~~~~
>> drivers/cxl/core/regs.c:357:16: warning: shift count >= width of type [-Wshift-count-overflow]
if (FIELD_GET(CPMU_CAP_INT, val))
~~~~~~~~~~^~~~~~~~~~~~~~~~~~
drivers/cxl/cpmu.h:17:27: note: expanded from macro 'CPMU_CAP_INT'
#define CPMU_CAP_INT BIT(50)
^
include/vdso/bits.h:7:26: note: expanded from macro 'BIT'
#define BIT(nr) (UL(1) << (nr))
^
include/linux/bitfield.h:129:50: note: expanded from macro 'FIELD_GET'
(typeof(_mask))(((_reg) & (_mask)) >> __bf_shf(_mask)); \
~~~~~~~~~^~~~~~
include/linux/bitfield.h:45:38: note: expanded from macro '__bf_shf'
#define __bf_shf(x) (__builtin_ffsll(x) - 1)
^11 warnings generated.
vim +357 drivers/cxl/core/regs.c
350
351 int cxl_cpmu_get_irq(struct cxl_cpmu_regs *regs)
352 {
353 int irq = -1;
354 u64 val;
355
356 val = readq(regs->cpmu + CPMU_CAP_REG);
> 357 if (FIELD_GET(CPMU_CAP_INT, val))
Signature · 2 lines
0-DAY CI Kernel Test Service https://01.org/lkp
Re: [RFC PATCH 2/4] cxl/pci: Find and register CXL PMU devices
In reply to Jonathan CameronQuoted 9 lines · On Fri, 12 Aug 2022 16:12:12 +0100 Jonathan Cameron…
CXL PMU devices can be found from entries in the Register Locator DVSEC.
In order to register the minimum number of IRQ vectors necessary to support all CPMUs found, separate the registration into two steps. First find the devices, and query the IRQs used and then register the devices. Between these two steps, request the IRQ vectors necessary and enable bus master support.
Quoted 5 lines
Future IRQ users for CXL type 3 devices (e.g. DOEs) will need to follow a similar pattern the number of vectors necessary is known before any parts of the driver stack rely on their availability.
Signed-off-by Jonathan Cameron <[email protected]>
A few bugs in here that the kernel test robot found.
I'll send a v2 shortly with those tidied up.
One observation is that cxl/core/core.h dereferences
a struct cxl_memdev element which means we have a header ordering dependency between that and cxl/cxlmem.h which we should find a clean way to fix.
Quoted 54 lines
---
Open questions
1) Is this IRQ vector 'count' / request then use approach flexible enough for other interrupt users on these devices.
2) Does hanging the CPMU off the PCI device make sense. These can occur in Switch upstream ports as well.
3) Naming. It would be nice if the device naming indicated which EP these were associated with, but that wouldn't be inline with the rest of the CXL bus device naming. What is best option here?--- drivers/cxl/core/Makefile | 1 + drivers/cxl/core/core.h | 3 ++ drivers/cxl/core/cpmu.c | 67 ++++++++++++++++++++++++++++++++++ drivers/cxl/core/port.c | 2 ++ drivers/cxl/core/regs.c | 29 +++++++++++++++ drivers/cxl/cpmu.h | 54 ++++++++++++++++++++++++++++ drivers/cxl/cxl.h | 15 ++++++++ drivers/cxl/cxlpci.h | 1 + drivers/cxl/pci.c | 76 ++++++++++++++++++++++++++++++++++++++- 9 files changed, 247 insertions(+), 1 deletion(-)drivers/cxl/core/Makefile +1
-0@@ -10,4 +10,5 @@ cxl_core-y += memdev.o cxl_core-y += mbox.o cxl_core-y += pci.o cxl_core-y += hdm.o +cxl_core-y += cpmu.o cxl_core-$(CONFIG_CXL_REGION) += region.odrivers/cxl/core/core.h +2
-0@@ -14,12 +14,14 @@ extern struct device_attribute dev_attr_create_pmem_region;extern struct device_attribute dev_attr_delete_region;extern struct device_attribute dev_attr_region;extern const struct device_type cxl_pmem_region_type; +extern const struct device_type cxl_cpmu_type;extern const struct device_type cxl_region_type;void cxl_decoder_kill_region (struct cxl_endpoint_decoder *cxled);#define CXL_REGION_ATTR (x) (&dev_attr_##x.attr)#define CXL_REGION_TYPE (x) (&cxl_region_type)#define SET_CXL_REGION_ATTR (x) (&dev_attr_##x.attr),#define CXL_PMEM_REGION_TYPE (x) (&cxl_pmem_region_type) +#define CXL_CPMU_TYPE (x) (&cxl_cpmu_region_type)int cxl_region_init (void );void cxl_region_exit (void );#else
drivers/cxl/core/core.h static inline void cxl_region_exit(void) · line 44
Quoted 6 lines
drivers/cxl/core/core.h +1
-0@@ -37,6 +39,7 @@ static inline void cxl_region_exit(void)#define CXL_REGION_TYPE (x) NULL#define SET_CXL_REGION_ATTR (x)#define CXL_PMEM_REGION_TYPE (x) NULL +#define CXL_CPMU_TYPE (x) NULL#endif
Side note, the presence ofcxl_ep_load() in here means anything including this header needs to include cxlmem.h which seems a bit of a violation of layering between the core headers and more driver specific ones.
Quoted 17 lines
drivers/cxl/core/core.h +0
-0struct cxl_send_command ;drivers/cxl/core/cpmu.c new file +10
-0@@ -0,0 +1,67 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* Copyright(c) 2022 Huawei. All rights reserved. */ + +#include <linux/device.h> +#include <linux/slab.h> +#include <linux/idr.h> +#include <cpmu.h> +#include <cxl.h> + +static DEFINE_IDA (cpmu_ida);
drivers/cxl/core/cpmu.c line 20
Quoted 10 lines
drivers/cxl/core/cpmu.c new file +10
-0+ +static void cxl_cpmu_release (struct device *dev) +{ + struct cxl_cpmu *cpmu = container_of(dev, struct cxl_cpmu, dev); + +ida_free (&cpmu_ida, cpmu->id); +kfree (cpmu); +} + +const struct device_type cxl_cpmu_type = {
Should include core/core.h to avoid a should this be static warning.
Quoted 24 lines
drivers/cxl/core/cpmu.c new file +9
-0+ .name = "cxl_cpmu", + .release = cxl_cpmu_release, +}; + +static void remove_dev (void *dev) +{ +device_del (dev); +} +drivers/cxl/cpmu.h new file +7
-0@@ -0,0 +1,54 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* Copyright(c) 2022 Huawei +* CXL Specification rev 3.0 Setion 8.2.7 (CPMU Register Interface) +*/ +#ifndef CXL_CPMU_H +#define CXL_CPMU_H
drivers/cxl/cpmu.h line 17
Quoted 10 lines
drivers/cxl/cpmu.h new file +10
-0+ +#define CPMU_CAP_REG 0x0 +#define CPMU_CAP_NUM_COUNTERS_MSK GENMASK_ULL(4, 0) +#define CPMU_CAP_COUNTER_WIDTH_MSK GENMASK_ULL(15, 8) +#define CPMU_CAP_NUM_EVN_CAP_REG_SUP_MSK GENMASK_ULL(24, 20) +#define CPMU_CAP_FILTERS_SUP_MSK GENMASK_ULL(39, 32) +#define CPMU_CAP_MSI_N_MSK GENMASK_ULL(47, 44) +#define CPMU_CAP_WRITEABLE_WHEN_FROZEN BIT(48) +#define CPMU_CAP_FREEZE BIT(49) +#define CPMU_CAP_INT BIT(50)
BIT_ULL() needed for these.
Quoted 37 lines
drivers/cxl/cpmu.h new file +37
-0+#define CPMU_CAP_VERSION_MSK GENMASK_ULL(63, 60) + +#define CPMU_OVERFLOW_REG 0x10 +#define CPMU_FREEZE_REG 0x18 +#define CPMU_EVENT_CAP_REG (n) (0x100 + 8 * (n)) +#define CPMU_EVENT_CAP_SUPPORTED_EVENTS_MSK GENMASK_ULL(31, 0) +#define CPMU_EVENT_CAP_GROUP_ID_MSK GENMASK_ULL(47, 32) +#define CPMU_EVENT_CAP_VENDOR_ID_MSK GENMASK_ULL(63, 48) + +#define CPMU_COUNTER_CFG_REG (n) (0x200 + 8 * (n)) +#define CPMU_COUNTER_CFG_TYPE_MSK GENMASK_ULL(1, 0) +#define CPMU_COUNTER_CFG_TYPE_FREE_RUN 0 +#define CPMU_COUNTER_CFG_TYPE_FIXED_FUN 1 +#define CPMU_COUNTER_CFG_TYPE_CONFIGURABLE 2 +#define CPMU_COUNTER_CFG_ENABLE BIT(8) +#define CPMU_COUNTER_CFG_INT_ON_OVRFLW BIT(9) +#define CPMU_COUNTER_CFG_FREEZE_ON_OVRFLW BIT(10) +#define CPMU_COUNTER_CFG_EDGE BIT(11) +#define CPMU_COUNTER_CFG_INVERT BIT(12) +#define CPMU_COUNTER_CFG_THRESHOLD_MSK GENMASK_ULL(23, 16) +#define CPMU_COUNTER_CFG_EVENTS_MSK GENMASK_ULL(55, 24) +#define CPMU_COUNTER_CFG_EVENT_GRP_ID_IDX_MSK GENMASK_ULL(63, 59) + +#define CPMU_FILTER_CFG_REG (n, f) (0x400 + 4 * ((f) + (n) * 8)) +#define CPMU_FILTER_CFG_VALUE_MSK GENMASK(15, 0) + +#define CPMU_COUNTER_REG (n) (0xc00 + 8 * (n)) + +#define CPMU_REGMAP_SIZE 0xe00/* Table 8-32 CXL 3.0 specification */ +struct cxl_cpmu { +struct device dev; +void __iomem *base; +int id; +}; + +#define to_cxl_cpmu (dev) container_of(dev, struct cxl_cpmu, dev) +#endif
RFC PATCH 3/4 cxl: CXL Performance Monitoring Unit driver
In reply to Jonathan CameronCXL 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 only a subset of types of counter. It support 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.
--
RFC questions:
- Creation of the devices. Currently hung off the cxl_pci driver. May want to rethink to avoid needing to replicate registration code for other CXL components.
- Needs more testing, but wanted to share early in case major refactoring needed.
- Where to put the driver. Previous discussions on similar drivers led to them being under drivers/perf (hisi_pcie_pmu)
- Whether to prefer the use of freeze for global counter enable or rely on the always supported per counter registers (one register write per counter) with reduced cross counter synchronization. Freeze is a multipurpose feature:
- Hardware support stopping all counters on one counter overflowing so you can do fixed period counting across all counters. (we may want to enable this at some stage)
- Freeze is also usable as a global enable as you can freeze all counters then enable them 'frozen', followed by unfreezing to start them counting.
Either way, the optional nature of "writeable when frozen" means we will need to support the slow method too at some point as someone won't implement freeze on their device.
--- drivers/cxl/Kconfig | 12 + drivers/cxl/Makefile | 1 + drivers/cxl/cpmu.c | 942 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 955 insertions(+)
drivers/cxl/Kconfig +12 -0
@@ -111,4 +111,16 @@ config CXL_REGION select MEMREGION select GET_FREE_REGION +config CXL_CPMU + tristate "CXL Performance Monitoring Unit" + default CXL_BUS + help + Support performance monitoring as defined in CXL rev 3.0 + section 13.2: Performance Monitoring. CXL components may have + one or more CXL Performance Monitoring Units (CPMUs). + + Say 'y/m' to enable a driver that will attach to performance + monitoring units and provide standard perf based interfaces. + + If unsure say 'm'. endif
drivers/cxl/Makefile +1 -0
@@ -5,6 +5,7 @@ obj-$(CONFIG_CXL_MEM) += cxl_mem.o obj-$(CONFIG_CXL_ACPI) += cxl_acpi.o obj-$(CONFIG_CXL_PMEM) += cxl_pmem.o obj-$(CONFIG_CXL_PORT) += cxl_port.o +obj-$(CONFIG_CXL_CPMU) += cpmu.o cxl_mem-y := mem.o cxl_pci-y := pci.o
drivers/cxl/cpmu.c new file +942 -0
942 lines not on this page · raw message
Signature · 1 line
2.32.0
kernel test robot
build botRe: [RFC PATCH 3/4] cxl: CXL Performance Monitoring Unit driver
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in…
Hi Jonathan,
[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on linus/master]
[also build test WARNING on next-20220812]
[cannot apply to arm-perf/for-next/perf v5.19]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Jonathan-Cameron/CXL-3-0-Performance-Monitoring-Unit-support/20220812-231616 base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 7ebfc85e2cd7b08f518b526173e9a33b56b3913b config: x86_64-randconfig-a014 (https://download.01.org/0day-ci/archive/20220813/[email protected]/config) compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 5f1c7e2cc5a3c07cbc2412e851a7283c1841f520)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/4776483ba3a4979cc318906623d23fc1e02148a7
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Jonathan-Cameron/CXL-3-0-Performance-Monitoring-Unit-support/20220812-231616 git checkout 4776483ba3a4979cc318906623d23fc1e02148a7
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/cxl/
If you fix the issue, kindly add following tag where applicable
All warnings (new ones prefixed by >>):
>> drivers/cxl/cpmu.c:168:12: warning: address of array 'info->conf_counter_bm' will always evaluate to 'true' [-Wpointer-bool-conversion]
if (info->conf_counter_bm) {
~~ ~~~~~~^~~~~~~~~~~~~~~1 warning generated.
vim +168 drivers/cxl/cpmu.c
91
92 /*
93 * All CPMU counters are discoverable via the Event Capabilities Registers.
94 * Each Event Capability register contains a a VID / GroupID.
95 * A counter may then count any combination (by summing) of events in
96 * that group which are in the Supported Events Bitmask.
97 * However, there are some complexities to the scheme.
98 * - Fixed function counters refer to an Event Capabilities register.
99 * That event capability register is not then used for Configurable
100 * counters.
101 * TODO: Support summed events.
102 */
103 static int cpmu_parse_caps(struct device *dev, struct cpmu_info *info)
104 {
105 DECLARE_BITMAP(fixed_counter_event_cap_bm, 32) = {0};
106 void __iomem *base = info->base;
107 u64 val, eval;
108 int i;
109
110 val = readq(base + CPMU_CAP_REG);
111 info->freeze_for_enable = FIELD_GET(CPMU_CAP_WRITEABLE_WHEN_FROZEN, val) &
112 FIELD_GET(CPMU_CAP_FREEZE, val);
113 if (!info->freeze_for_enable) {
114 dev_err(dev, "Driver does not support CPMUs that do not support freeze for enable\n");
115 return -ENODEV;
116 }
117
118 info->num_counters = FIELD_GET(CPMU_CAP_NUM_COUNTERS_MSK, val) + 1;
119 info->counter_width = FIELD_GET(CPMU_CAP_COUNTER_WIDTH_MSK, val);
120 info->num_event_capabilities = FIELD_GET(CPMU_CAP_NUM_EVN_CAP_REG_SUP_MSK, val) + 1;
121
122 info->filter_hdm = FIELD_GET(CPMU_CAP_FILTERS_SUP_MSK, val);
123 if (FIELD_GET(CPMU_CAP_INT, val))
124 info->irq = FIELD_GET(CPMU_CAP_MSI_N_MSK, val);
125 else
126 info->irq = -1;
127
128 /* First handle fixed function counters; note if configurable counters found */
129 for (i = 0; i < info->num_counters; i++) {
130 struct cpmu_event *cpmu_ev;
131 u32 events_msk;
132 u8 group_idx;
133
134 val = readq(base + CPMU_COUNTER_CFG_REG(i));
135
136 if (FIELD_GET(CPMU_COUNTER_CFG_TYPE_MSK, val) ==
137 CPMU_COUNTER_CFG_TYPE_CONFIGURABLE) {
138 set_bit(i, info->conf_counter_bm);
139 }
140
141 if (FIELD_GET(CPMU_COUNTER_CFG_TYPE_MSK, val) !=
142 CPMU_COUNTER_CFG_TYPE_FIXED_FUN)
143 continue;
144
145 /* In this case we know which fields are const */
146 group_idx = FIELD_GET(CPMU_COUNTER_CFG_EVENT_GRP_ID_IDX_MSK, val);
147 events_msk = FIELD_GET(CPMU_COUNTER_CFG_EVENTS_MSK, val);
148 eval = readq(base + CPMU_EVENT_CAP_REG(group_idx));
149 cpmu_ev = devm_kzalloc(dev, sizeof(*cpmu_ev), GFP_KERNEL);
150 if (!cpmu_ev)
151 return -ENOMEM;
152
153 cpmu_ev->vid = FIELD_GET(CPMU_EVENT_CAP_VENDOR_ID_MSK, eval);
154 cpmu_ev->gid = FIELD_GET(CPMU_EVENT_CAP_GROUP_ID_MSK, eval);
155 /* For a fixed purpose counter use the events mask from the counter CFG */
156 cpmu_ev->msk = events_msk;
157 cpmu_ev->configurable = false;
158 cpmu_ev->counter_idx = i;
159 /* This list add is never unwound as all entries deleted on remove */
160 list_add(&cpmu_ev->node, &info->cpmu_events);
161 /*
162 * Configurable counters must not use an Event Capability registers that
163 * is in use for a Fixed counter
164 */
165 set_bit(group_idx, fixed_counter_event_cap_bm);
166 }
167
> 168 if (info->conf_counter_bm) { 169 struct cpmu_event *cpmu_ev;
170 int j;
171 /* Walk event capabilities unused by fixed counters */
172 for_each_clear_bit(j, fixed_counter_event_cap_bm,
173 info->num_event_capabilities) {
174 cpmu_ev = devm_kzalloc(dev, sizeof(*cpmu_ev), GFP_KERNEL);
175 if (!cpmu_ev)
176 return -ENOMEM;
177
178 eval = readq(base + CPMU_EVENT_CAP_REG(j));
179 cpmu_ev->vid = FIELD_GET(CPMU_EVENT_CAP_VENDOR_ID_MSK, eval);
180 cpmu_ev->gid = FIELD_GET(CPMU_EVENT_CAP_GROUP_ID_MSK, eval);
181 cpmu_ev->msk = FIELD_GET(CPMU_EVENT_CAP_SUPPORTED_EVENTS_MSK, eval);
182 cpmu_ev->event_idx = j;
183 cpmu_ev->configurable = true;
184 list_add(&cpmu_ev->node, &info->cpmu_events);
185 }
186 }
187
188 return 0;
189 }
190
Signature · 2 lines
0-DAY CI Kernel Test Service https://01.org/lkp
RFC PATCH 4/4 docs: perf: Minimal introduction the the CXL PMU device and driver.
In reply to Jonathan CameronVery basic introduction to the device and the current driver support provided. I expect to expand on this in future versions of this patch set.
--
RFC:
- I'll post separately about this shortly, but it seems very odd to me that there is no way to assign a parent to an event_sources device. As a result we get the messy approach of playing match the name to figure out what the CPMU instance is connected to.
--- Documentation/admin-guide/perf/cxl.rst | 60 ++++++++++++++++++++++++ Documentation/admin-guide/perf/index.rst | 1 + 2 files changed, 61 insertions(+)
Documentation/admin-guide/perf/cxl.rst new file +60 -0
@@ -0,0 +1,60 @@ +====================================== +CXL Performance Monitoring Unit (CPMU) +====================================== + +The CXL rev 3.0 specification provides a definition of CXL Performance +Monitoring Unit in section 13.2: Performance Monitoring. + +CXL components (e.g. Root Port, Switch Upstream Port, End Point) may have +any number of CPMU instances. CPMU capabilities are fully discoverable from +the devices. The specification provides event definitions for all CXL protocol +message types and a set of additional events for things commonly counted on +CXL devices (e.g. DRAM events). + +CPMU driver +=========== + +The CPMU driver register a perf PMU with the name cpmu<id> on the CXL bus. + + /sys/bus/cxl/device/cpmu<id> + +The associated PMU is registered as + + /sys/bus/event_sources/devices/cpmu<id> + +In common with other CXL bus devices, the id has no specific meaning and the +relationship to specific CXL device should be established via the device parent +of the device on the CXL bus. + +PMU driver provides description of available events and filter options in sysfs. + +The "format" directory describes all formats of the config (event vendor id, +group id and mask) config1 (threshold, filter enables) and config2 (filter +parameters) fields of the perf_event_attr structure. The "events" directory +describes all documented events show in perf list. + +The events shown in perf list are the most fine grained events with a single +bit of the event mask set. More general events may be enable by setting +multiple mask bits in config. For example, all Device to Host Read Requests +may be captured on a single counter by setting the bits for all of + +* d2h_req_rdcurr +* d2h_req_rdown +* d2h_req_rdshared +* d2h_req_rdany +* d2h_req_rdownnodata + +Example of usage:: + + $#perf list + cpmu0/clock_ticks/ [Kernel PMU event] + cpmu0/d2h_req_itomwr/ [Kernel PMU event] + cpmu0/d2h_req_rdany/ [Kernel PMU event] + cpmu0/d2h_req_rdcurr/ [Kernel PMU event] + ----------------------------------------------------------- + + $# perf stat -e cpmu0/clock_ticks/ -e cpmu0/d2h_req_itowrm/ + +The driver does not support sampling. So "perf record" and attaching to +a task are unsupported. +
Documentation/admin-guide/perf/index.rst +1 -0
@@ -17,3 +17,4 @@ Performance monitor support xgene-pmu arm_dsu_pmu thunderx2-pmu + cxl
Signature · 1 line
2.32.0