All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 00/28] CXL PMEM Region Provisioning
@ 2022-07-15  0:00 Dan Williams
  2022-07-15  0:00 ` [PATCH v2 01/28] Documentation/cxl: Use a double line break between entries Dan Williams
                   ` (29 more replies)
  0 siblings, 30 replies; 68+ messages in thread
From: Dan Williams @ 2022-07-15  0:00 UTC (permalink / raw)
  To: linux-cxl
  Cc: David Hildenbrand, Tony Luck, Jason Gunthorpe, Ben Widawsky,
	Jonathan Cameron, Christoph Hellwig, Greg Kroah-Hartman,
	Matthew Wilcox, Andrew Morton, nvdimm, linux-pci

Changes since v1 [1]:
- Move 19 patches that have received a Reviewed-by to the 'pending'
  branch in cxl.git (Thanks Alison, Adam, and Jonathan!)
- Improve the changelog and add more Cc's to "cxl/acpi: Track CXL
  resources in iomem_resource" and highlight the new export of
  insert_resource_expand_to_fit()
- Switch all occurrences of the pattern "rc = -ECODE; if (condition)
  goto err;" to "if (condition) { rc = -ECODE; goto err; }" (Jonathan)
- Re-organize all the cxl_{root,switch,endpoint}_decoder() patches to
  move the decoder-type-specific setup into the decoder-type-specific
  allocation routines (Jonathan)
- Add kdoc to clarify the behavior of add_cxl_resources() (Jonathan)
- Add IORES_DESC_CXL for kernel components like EDAC to determine when
  they might be dealing with a CXL address range (Tony)
- Drop usage of dev_set_drvdata() for passing @cxl_res (Jonathan)
- Drop @remove_action argument to __cxl_dpa_release(), make it behave
  like any other devm_<free> helper (Jonathan)
- Clarify 'skip' vs 'skipped' in DPA handling helpers (Jonathan)
- Clarify why port teardown no proceeds under the lock with the
  conversion from list to xarray (Jonathan)
- Revert rename of cxl_find_dport_by_dev() (Jonathan)
- Fold down_read() / up_write() mismatch fix to the patch that
  introduced the problem (Jonathan)
- Fix description of interleave_ways and interleave_granularity in the
  sysfs ABI document
- Clarify tangential cleanups in "resource: Introduce
  alloc_free_mem_region()" (Jonathan)
- Clarify rationale for the region creation / naming ABI (Jonathan)
- Add SET_CXL_REGION_ATTR() to supplement CXL_REGION_ATTR() the former
  is used to optionally added region attributes to an attribute list
  (position independent) and the latter is used to retrieve a pointer to
  the attribute in code.  (Jonathan)
- For writes to region attributes allow the same value to be written
  multiple times without error (Jonathan)
- Clarify the actions performed by cxl_port_attach_region() (Jonathan)
- Commit message spelling fixes (Alison and Jonathan)
- Rename cxl_dpa_resource() => cxl_dpa_resource_start() (Jonathan)
- Reword error message in cxl_parse_cfmws() (Adam)
- Keep @expected_len signed in cxl_acpi_cfmws_verify() (Jonathan)
- Miscellaneous formatting and doc fixes (Jonathan)
- Rename port->dpa_end port->hdm_end (Jonathan)
- Rename unregister_region() => unregister_nvdimm_region() (Jonathan)

[1]: https://lore.kernel.org/linux-cxl/165603869943.551046.3498980330327696732.stgit@dwillia2-xfh

---

Until the CXL 2.0 definition arrived there was little reason for OS
drivers to care about CXL memory expanders. Similar to DDR they just
implemented a physical address range that was described to the OS by
platform firmware (EFI Memory Map + ACPI SRAT/SLIT/HMAT etc). The CXL
2.0 definition adds support for PMEM, hotplug, switch topologies, and
device-interleaving which exceeds the limits of what can be reasonably
abstracted by EFI + ACPI mechanisms. As a result, Linux needs a native
capability to provision new CXL regions.

The term "region" is the same term that originated in the LIBNVDIMM
implementation to describe a host physical / system physical address
range. For PMEM a region is a persistent memory range that can be
further sub-divided into namespaces. For CXL there are three
classifications of regions:
- PMEM: set up by CXL native tooling and persisted in CXL region labels

- RAM: set up dynamically by CXL native tooling after hotplug events, or
  leftover capacity not mapped by platform firmware. Any persistent
  configuration would come from set up scripts / configuration files in
  userspace.

- System RAM: set up by platform firmware and described by EFI + ACPI
  metadata, these regions are static.

For now, these patches implement just PMEM regions without region label
support. Note though that the infrastructure routines like
cxl_region_attach() and cxl_region_setup_targets() are building blocks
for region-label support, provisioning RAM regions, and enumerating
System RAM regions.

The general flow for provisioning a CXL region is to:
- Find a device or set of devices with available device-physical-address
  (DPA) capacity

- Find a platform CXL window that has free capacity to map a new region
  and that is able to target the devices in the previous step.

- Allocate DPA according to the CXL specification rules of sequential
  enabling of decoders by id and when a device hosts multiple decoders
  make sure that lower-id decoders map lower HPA and higher-id decoders
  map higher HPA.

- Assign endpoint decoders to a region and validate that the switching
  topology supports the requested configuration. Recall that
  interleaving is governed by modulo or xormap math that constrains which
  device can support which positions in a given region interleave.

- Program all the decoders an all endpoints and participating switches
  to bring the new address range online.

Once the range is online then existing drivers like LIBNVDIMM or
device-dax can manage the memory range as if the ACPI BIOS had conveyed
its parameters at boot.

This patch kit is the result of significant amounts of path finding work
[2] and long discussions with Ben. Thank you Ben for all that work!
Where the patches in this kit go in a different design direction than
the RFC, the authorship is changed and a Co-developed-by is added mainly
so I get blamed for the bad decisions and not Ben. The major updates
from that last posting are:

- all CXL resources are reflected in full in iomem_resource

- host-physical-address (HPA) range allocation moves to a
  devm_request_free_mem_region() derivative

- locking moves to two global rwsems, one for DPA / endpoint decoders
  and one for HPA / regions.

- the existing port scanning path is augmented to cache more topology
  information rather than recreate it at region creation time

[2]: https://lore.kernel.org/r/20220413183720.2444089-1-ben.widawsky@intel.com

---

Ben Widawsky (4):
      cxl/hdm: Add sysfs attributes for interleave ways + granularity
      cxl/region: Add region creation support
      cxl/region: Add a 'uuid' attribute
      cxl/region: Add interleave geometry attributes

Dan Williams (24):
      Documentation/cxl: Use a double line break between entries
      cxl/core: Define a 'struct cxl_switch_decoder'
      cxl/acpi: Track CXL resources in iomem_resource
      cxl/core: Define a 'struct cxl_root_decoder'
      cxl/core: Define a 'struct cxl_endpoint_decoder'
      cxl/hdm: Enumerate allocated DPA
      cxl/hdm: Add 'mode' attribute to decoder objects
      cxl/hdm: Track next decoder to allocate
      cxl/hdm: Add support for allocating DPA to an endpoint decoder
      cxl/port: Record dport in endpoint references
      cxl/port: Record parent dport when adding ports
      cxl/port: Move 'cxl_ep' references to an xarray per port
      cxl/port: Move dport tracking to an xarray
      cxl/mem: Enumerate port targets before adding endpoints
      resource: Introduce alloc_free_mem_region()
      cxl/region: Allocate HPA capacity to regions
      cxl/region: Enable the assignment of endpoint decoders to regions
      cxl/acpi: Add a host-bridge index lookup mechanism
      cxl/region: Attach endpoint decoders
      cxl/region: Program target lists
      cxl/hdm: Commit decoder state to hardware
      cxl/region: Add region driver boiler plate
      cxl/pmem: Fix offline_nvdimm_bus() to offline by bridge
      cxl/region: Introduce cxl_pmem_region objects


 Documentation/ABI/testing/sysfs-bus-cxl         |  213 +++
 Documentation/driver-api/cxl/memory-devices.rst |   11 
 drivers/cxl/Kconfig                             |    8 
 drivers/cxl/acpi.c                              |  185 ++
 drivers/cxl/core/Makefile                       |    1 
 drivers/cxl/core/core.h                         |   49 +
 drivers/cxl/core/hdm.c                          |  623 +++++++-
 drivers/cxl/core/pmem.c                         |    4 
 drivers/cxl/core/port.c                         |  669 ++++++--
 drivers/cxl/core/region.c                       | 1830 +++++++++++++++++++++++
 drivers/cxl/cxl.h                               |  263 +++
 drivers/cxl/cxlmem.h                            |   18 
 drivers/cxl/mem.c                               |   32 
 drivers/cxl/pmem.c                              |  259 +++
 drivers/nvdimm/region_devs.c                    |   28 
 include/linux/ioport.h                          |    3 
 include/linux/libnvdimm.h                       |    5 
 kernel/resource.c                               |  185 ++
 mm/Kconfig                                      |    5 
 tools/testing/cxl/Kbuild                        |    1 
 tools/testing/cxl/test/cxl.c                    |   75 +
 21 files changed, 4156 insertions(+), 311 deletions(-)
 create mode 100644 drivers/cxl/core/region.c

base-commit: b060edfd8cdd52bc8648392500bf152a8dd6d4c5

^ permalink raw reply	[flat|nested] 68+ messages in thread
* Re: [PATCH v2 21/28] cxl/region: Enable the assignment of endpoint decoders to regions
  2022-07-15  0:02 ` [PATCH v2 21/28] cxl/region: Enable the assignment of endpoint decoders " Dan Williams
@ 2022-07-18 11:32 ` Dan Carpenter
  2022-07-20 17:26   ` Jonathan Cameron
  1 sibling, 0 replies; 68+ messages in thread
From: kernel test robot @ 2022-07-16 19:55 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 11860 bytes --]

CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
In-Reply-To: <165784336184.1758207.16403282029203949622.stgit@dwillia2-xfh.jf.intel.com>
References: <165784336184.1758207.16403282029203949622.stgit@dwillia2-xfh.jf.intel.com>
TO: Dan Williams <dan.j.williams@intel.com>

Hi Dan,

I love your patch! Perhaps something to improve:

[auto build test WARNING on b060edfd8cdd52bc8648392500bf152a8dd6d4c5]

url:    https://github.com/intel-lab-lkp/linux/commits/Dan-Williams/CXL-PMEM-Region-Provisioning/20220715-080748
base:   b060edfd8cdd52bc8648392500bf152a8dd6d4c5
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
config: i386-randconfig-m021 (https://download.01.org/0day-ci/archive/20220717/202207170330.t0wEfL2u-lkp(a)intel.com/config)
compiler: gcc-11 (Debian 11.3.0-3) 11.3.0

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
drivers/cxl/core/hdm.c:342 cxl_dpa_free() error: uninitialized symbol 'rc'.
drivers/cxl/core/hdm.c:459 cxl_dpa_alloc() error: uninitialized symbol 'rc'.

vim +/rc +342 drivers/cxl/core/hdm.c

5ccc075e8e0da0 Dan Williams 2022-07-14  310  
5ccc075e8e0da0 Dan Williams 2022-07-14  311  int cxl_dpa_free(struct cxl_endpoint_decoder *cxled)
5ccc075e8e0da0 Dan Williams 2022-07-14  312  {
5ccc075e8e0da0 Dan Williams 2022-07-14  313  	struct cxl_port *port = cxled_to_port(cxled);
5ccc075e8e0da0 Dan Williams 2022-07-14  314  	struct device *dev = &cxled->cxld.dev;
5ccc075e8e0da0 Dan Williams 2022-07-14  315  	int rc;
5ccc075e8e0da0 Dan Williams 2022-07-14  316  
5ccc075e8e0da0 Dan Williams 2022-07-14  317  	down_write(&cxl_dpa_rwsem);
5ccc075e8e0da0 Dan Williams 2022-07-14  318  	if (!cxled->dpa_res) {
5ccc075e8e0da0 Dan Williams 2022-07-14  319  		rc = 0;
5ccc075e8e0da0 Dan Williams 2022-07-14  320  		goto out;
5ccc075e8e0da0 Dan Williams 2022-07-14  321  	}
e8f8f1fa762fad Dan Williams 2022-07-14  322  	if (cxled->cxld.region) {
e8f8f1fa762fad Dan Williams 2022-07-14  323  		dev_dbg(dev, "decoder assigned to: %s\n",
e8f8f1fa762fad Dan Williams 2022-07-14  324  			dev_name(&cxled->cxld.region->dev));
e8f8f1fa762fad Dan Williams 2022-07-14  325  		goto out;
e8f8f1fa762fad Dan Williams 2022-07-14  326  	}
5ccc075e8e0da0 Dan Williams 2022-07-14  327  	if (cxled->cxld.flags & CXL_DECODER_F_ENABLE) {
5ccc075e8e0da0 Dan Williams 2022-07-14  328  		dev_dbg(dev, "decoder enabled\n");
5ccc075e8e0da0 Dan Williams 2022-07-14  329  		rc = -EBUSY;
5ccc075e8e0da0 Dan Williams 2022-07-14  330  		goto out;
5ccc075e8e0da0 Dan Williams 2022-07-14  331  	}
5ccc075e8e0da0 Dan Williams 2022-07-14  332  	if (cxled->cxld.id != port->hdm_end) {
5ccc075e8e0da0 Dan Williams 2022-07-14  333  		dev_dbg(dev, "expected decoder%d.%d\n", port->id,
5ccc075e8e0da0 Dan Williams 2022-07-14  334  			port->hdm_end);
5ccc075e8e0da0 Dan Williams 2022-07-14  335  		rc = -EBUSY;
5ccc075e8e0da0 Dan Williams 2022-07-14  336  		goto out;
5ccc075e8e0da0 Dan Williams 2022-07-14  337  	}
5ccc075e8e0da0 Dan Williams 2022-07-14  338  	devm_cxl_dpa_release(cxled);
5ccc075e8e0da0 Dan Williams 2022-07-14  339  	rc = 0;
5ccc075e8e0da0 Dan Williams 2022-07-14  340  out:
5ccc075e8e0da0 Dan Williams 2022-07-14  341  	up_write(&cxl_dpa_rwsem);
5ccc075e8e0da0 Dan Williams 2022-07-14 @342  	return rc;
5ccc075e8e0da0 Dan Williams 2022-07-14  343  }
5ccc075e8e0da0 Dan Williams 2022-07-14  344  
5ccc075e8e0da0 Dan Williams 2022-07-14  345  int cxl_dpa_set_mode(struct cxl_endpoint_decoder *cxled,
5ccc075e8e0da0 Dan Williams 2022-07-14  346  		     enum cxl_decoder_mode mode)
5ccc075e8e0da0 Dan Williams 2022-07-14  347  {
5ccc075e8e0da0 Dan Williams 2022-07-14  348  	struct cxl_memdev *cxlmd = cxled_to_memdev(cxled);
5ccc075e8e0da0 Dan Williams 2022-07-14  349  	struct cxl_dev_state *cxlds = cxlmd->cxlds;
5ccc075e8e0da0 Dan Williams 2022-07-14  350  	struct device *dev = &cxled->cxld.dev;
5ccc075e8e0da0 Dan Williams 2022-07-14  351  	int rc;
5ccc075e8e0da0 Dan Williams 2022-07-14  352  
5ccc075e8e0da0 Dan Williams 2022-07-14  353  	switch (mode) {
5ccc075e8e0da0 Dan Williams 2022-07-14  354  	case CXL_DECODER_RAM:
5ccc075e8e0da0 Dan Williams 2022-07-14  355  	case CXL_DECODER_PMEM:
5ccc075e8e0da0 Dan Williams 2022-07-14  356  		break;
5ccc075e8e0da0 Dan Williams 2022-07-14  357  	default:
5ccc075e8e0da0 Dan Williams 2022-07-14  358  		dev_dbg(dev, "unsupported mode: %d\n", mode);
5ccc075e8e0da0 Dan Williams 2022-07-14  359  		return -EINVAL;
5ccc075e8e0da0 Dan Williams 2022-07-14  360  	}
5ccc075e8e0da0 Dan Williams 2022-07-14  361  
5ccc075e8e0da0 Dan Williams 2022-07-14  362  	down_write(&cxl_dpa_rwsem);
5ccc075e8e0da0 Dan Williams 2022-07-14  363  	if (cxled->cxld.flags & CXL_DECODER_F_ENABLE) {
5ccc075e8e0da0 Dan Williams 2022-07-14  364  		rc = -EBUSY;
5ccc075e8e0da0 Dan Williams 2022-07-14  365  		goto out;
5ccc075e8e0da0 Dan Williams 2022-07-14  366  	}
5ccc075e8e0da0 Dan Williams 2022-07-14  367  
5ccc075e8e0da0 Dan Williams 2022-07-14  368  	/*
5ccc075e8e0da0 Dan Williams 2022-07-14  369  	 * Only allow modes that are supported by the current partition
5ccc075e8e0da0 Dan Williams 2022-07-14  370  	 * configuration
5ccc075e8e0da0 Dan Williams 2022-07-14  371  	 */
5ccc075e8e0da0 Dan Williams 2022-07-14  372  	if (mode == CXL_DECODER_PMEM && !resource_size(&cxlds->pmem_res)) {
5ccc075e8e0da0 Dan Williams 2022-07-14  373  		dev_dbg(dev, "no available pmem capacity\n");
5ccc075e8e0da0 Dan Williams 2022-07-14  374  		rc = -ENXIO;
5ccc075e8e0da0 Dan Williams 2022-07-14  375  		goto out;
5ccc075e8e0da0 Dan Williams 2022-07-14  376  	}
5ccc075e8e0da0 Dan Williams 2022-07-14  377  	if (mode == CXL_DECODER_RAM && !resource_size(&cxlds->ram_res)) {
5ccc075e8e0da0 Dan Williams 2022-07-14  378  		dev_dbg(dev, "no available ram capacity\n");
5ccc075e8e0da0 Dan Williams 2022-07-14  379  		rc = -ENXIO;
5ccc075e8e0da0 Dan Williams 2022-07-14  380  		goto out;
5ccc075e8e0da0 Dan Williams 2022-07-14  381  	}
5ccc075e8e0da0 Dan Williams 2022-07-14  382  
5ccc075e8e0da0 Dan Williams 2022-07-14  383  	cxled->mode = mode;
5ccc075e8e0da0 Dan Williams 2022-07-14  384  	rc = 0;
5ccc075e8e0da0 Dan Williams 2022-07-14  385  out:
5ccc075e8e0da0 Dan Williams 2022-07-14  386  	up_write(&cxl_dpa_rwsem);
5ccc075e8e0da0 Dan Williams 2022-07-14  387  
5ccc075e8e0da0 Dan Williams 2022-07-14  388  	return rc;
5ccc075e8e0da0 Dan Williams 2022-07-14  389  }
5ccc075e8e0da0 Dan Williams 2022-07-14  390  
5ccc075e8e0da0 Dan Williams 2022-07-14  391  int cxl_dpa_alloc(struct cxl_endpoint_decoder *cxled, unsigned long long size)
5ccc075e8e0da0 Dan Williams 2022-07-14  392  {
5ccc075e8e0da0 Dan Williams 2022-07-14  393  	struct cxl_memdev *cxlmd = cxled_to_memdev(cxled);
5ccc075e8e0da0 Dan Williams 2022-07-14  394  	resource_size_t free_ram_start, free_pmem_start;
5ccc075e8e0da0 Dan Williams 2022-07-14  395  	struct cxl_port *port = cxled_to_port(cxled);
5ccc075e8e0da0 Dan Williams 2022-07-14  396  	struct cxl_dev_state *cxlds = cxlmd->cxlds;
5ccc075e8e0da0 Dan Williams 2022-07-14  397  	struct device *dev = &cxled->cxld.dev;
5ccc075e8e0da0 Dan Williams 2022-07-14  398  	resource_size_t start, avail, skip;
5ccc075e8e0da0 Dan Williams 2022-07-14  399  	struct resource *p, *last;
5ccc075e8e0da0 Dan Williams 2022-07-14  400  	int rc;
5ccc075e8e0da0 Dan Williams 2022-07-14  401  
5ccc075e8e0da0 Dan Williams 2022-07-14  402  	down_write(&cxl_dpa_rwsem);
e8f8f1fa762fad Dan Williams 2022-07-14  403  	if (cxled->cxld.region) {
e8f8f1fa762fad Dan Williams 2022-07-14  404  		dev_dbg(dev, "decoder attached to %s\n",
e8f8f1fa762fad Dan Williams 2022-07-14  405  			dev_name(&cxled->cxld.region->dev));
e8f8f1fa762fad Dan Williams 2022-07-14  406  		goto out;
e8f8f1fa762fad Dan Williams 2022-07-14  407  	}
e8f8f1fa762fad Dan Williams 2022-07-14  408  
5ccc075e8e0da0 Dan Williams 2022-07-14  409  	if (cxled->cxld.flags & CXL_DECODER_F_ENABLE) {
5ccc075e8e0da0 Dan Williams 2022-07-14  410  		dev_dbg(dev, "decoder enabled\n");
5ccc075e8e0da0 Dan Williams 2022-07-14  411  		rc = -EBUSY;
5ccc075e8e0da0 Dan Williams 2022-07-14  412  		goto out;
5ccc075e8e0da0 Dan Williams 2022-07-14  413  	}
5ccc075e8e0da0 Dan Williams 2022-07-14  414  
5ccc075e8e0da0 Dan Williams 2022-07-14  415  	for (p = cxlds->ram_res.child, last = NULL; p; p = p->sibling)
5ccc075e8e0da0 Dan Williams 2022-07-14  416  		last = p;
5ccc075e8e0da0 Dan Williams 2022-07-14  417  	if (last)
5ccc075e8e0da0 Dan Williams 2022-07-14  418  		free_ram_start = last->end + 1;
5ccc075e8e0da0 Dan Williams 2022-07-14  419  	else
5ccc075e8e0da0 Dan Williams 2022-07-14  420  		free_ram_start = cxlds->ram_res.start;
5ccc075e8e0da0 Dan Williams 2022-07-14  421  
5ccc075e8e0da0 Dan Williams 2022-07-14  422  	for (p = cxlds->pmem_res.child, last = NULL; p; p = p->sibling)
5ccc075e8e0da0 Dan Williams 2022-07-14  423  		last = p;
5ccc075e8e0da0 Dan Williams 2022-07-14  424  	if (last)
5ccc075e8e0da0 Dan Williams 2022-07-14  425  		free_pmem_start = last->end + 1;
5ccc075e8e0da0 Dan Williams 2022-07-14  426  	else
5ccc075e8e0da0 Dan Williams 2022-07-14  427  		free_pmem_start = cxlds->pmem_res.start;
5ccc075e8e0da0 Dan Williams 2022-07-14  428  
5ccc075e8e0da0 Dan Williams 2022-07-14  429  	if (cxled->mode == CXL_DECODER_RAM) {
5ccc075e8e0da0 Dan Williams 2022-07-14  430  		start = free_ram_start;
5ccc075e8e0da0 Dan Williams 2022-07-14  431  		avail = cxlds->ram_res.end - start + 1;
5ccc075e8e0da0 Dan Williams 2022-07-14  432  		skip = 0;
5ccc075e8e0da0 Dan Williams 2022-07-14  433  	} else if (cxled->mode == CXL_DECODER_PMEM) {
5ccc075e8e0da0 Dan Williams 2022-07-14  434  		resource_size_t skip_start, skip_end;
5ccc075e8e0da0 Dan Williams 2022-07-14  435  
5ccc075e8e0da0 Dan Williams 2022-07-14  436  		start = free_pmem_start;
5ccc075e8e0da0 Dan Williams 2022-07-14  437  		avail = cxlds->pmem_res.end - start + 1;
5ccc075e8e0da0 Dan Williams 2022-07-14  438  		skip_start = free_ram_start;
5ccc075e8e0da0 Dan Williams 2022-07-14  439  		skip_end = start - 1;
5ccc075e8e0da0 Dan Williams 2022-07-14  440  		skip = skip_end - skip_start + 1;
5ccc075e8e0da0 Dan Williams 2022-07-14  441  	} else {
5ccc075e8e0da0 Dan Williams 2022-07-14  442  		dev_dbg(dev, "mode not set\n");
5ccc075e8e0da0 Dan Williams 2022-07-14  443  		rc = -EINVAL;
5ccc075e8e0da0 Dan Williams 2022-07-14  444  		goto out;
5ccc075e8e0da0 Dan Williams 2022-07-14  445  	}
5ccc075e8e0da0 Dan Williams 2022-07-14  446  
5ccc075e8e0da0 Dan Williams 2022-07-14  447  	if (size > avail) {
5ccc075e8e0da0 Dan Williams 2022-07-14  448  		dev_dbg(dev, "%pa exceeds available %s capacity: %pa\n", &size,
5ccc075e8e0da0 Dan Williams 2022-07-14  449  			cxled->mode == CXL_DECODER_RAM ? "ram" : "pmem",
5ccc075e8e0da0 Dan Williams 2022-07-14  450  			&avail);
5ccc075e8e0da0 Dan Williams 2022-07-14  451  		rc = -ENOSPC;
5ccc075e8e0da0 Dan Williams 2022-07-14  452  		goto out;
5ccc075e8e0da0 Dan Williams 2022-07-14  453  	}
5ccc075e8e0da0 Dan Williams 2022-07-14  454  
5ccc075e8e0da0 Dan Williams 2022-07-14  455  	rc = __cxl_dpa_reserve(cxled, start, size, skip);
5ccc075e8e0da0 Dan Williams 2022-07-14  456  out:
5ccc075e8e0da0 Dan Williams 2022-07-14  457  	up_write(&cxl_dpa_rwsem);
5ccc075e8e0da0 Dan Williams 2022-07-14  458  
5ccc075e8e0da0 Dan Williams 2022-07-14 @459  	if (rc)
5ccc075e8e0da0 Dan Williams 2022-07-14  460  		return rc;
5ccc075e8e0da0 Dan Williams 2022-07-14  461  
5ccc075e8e0da0 Dan Williams 2022-07-14  462  	return devm_add_action_or_reset(&port->dev, cxl_dpa_release, cxled);
5ccc075e8e0da0 Dan Williams 2022-07-14  463  }
5ccc075e8e0da0 Dan Williams 2022-07-14  464  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] 68+ messages in thread
* Re: [PATCH v2 25/28] cxl/hdm: Commit decoder state to hardware
@ 2022-07-16 21:58 kernel test robot
  0 siblings, 0 replies; 68+ messages in thread
From: kernel test robot @ 2022-07-16 21:58 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 2457 bytes --]

CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
In-Reply-To: <165784338418.1758207.14659830845389904356.stgit@dwillia2-xfh.jf.intel.com>
References: <165784338418.1758207.14659830845389904356.stgit@dwillia2-xfh.jf.intel.com>
TO: Dan Williams <dan.j.williams@intel.com>

Hi Dan,

I love your patch! Perhaps something to improve:

[auto build test WARNING on b060edfd8cdd52bc8648392500bf152a8dd6d4c5]

url:    https://github.com/intel-lab-lkp/linux/commits/Dan-Williams/CXL-PMEM-Region-Provisioning/20220715-080748
base:   b060edfd8cdd52bc8648392500bf152a8dd6d4c5
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
config: i386-randconfig-m021 (https://download.01.org/0day-ci/archive/20220717/202207170530.EyDKrQwG-lkp(a)intel.com/config)
compiler: gcc-11 (Debian 11.3.0-3) 11.3.0

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

New smatch warnings:
drivers/cxl/core/hdm.c:475 cxld_set_interleave() error: uninitialized symbol 'eig'.
drivers/cxl/core/hdm.c:476 cxld_set_interleave() error: uninitialized symbol 'eiw'.

Old smatch warnings:
drivers/cxl/core/hdm.c:344 cxl_dpa_free() error: uninitialized symbol 'rc'.
drivers/cxl/core/hdm.c:461 cxl_dpa_alloc() error: uninitialized symbol 'rc'.

vim +/eig +475 drivers/cxl/core/hdm.c

5ccc075e8e0da0 Dan Williams 2022-07-14  466  
4eeba6d677001b Dan Williams 2022-07-14  467  static void cxld_set_interleave(struct cxl_decoder *cxld, u32 *ctrl)
4eeba6d677001b Dan Williams 2022-07-14  468  {
4eeba6d677001b Dan Williams 2022-07-14  469  	u16 eig;
4eeba6d677001b Dan Williams 2022-07-14  470  	u8 eiw;
4eeba6d677001b Dan Williams 2022-07-14  471  
4eeba6d677001b Dan Williams 2022-07-14  472  	ways_to_cxl(cxld->interleave_ways, &eiw);
4eeba6d677001b Dan Williams 2022-07-14  473  	granularity_to_cxl(cxld->interleave_granularity, &eig);
4eeba6d677001b Dan Williams 2022-07-14  474  
4eeba6d677001b Dan Williams 2022-07-14 @475  	u32p_replace_bits(ctrl, eig, CXL_HDM_DECODER0_CTRL_IG_MASK);
4eeba6d677001b Dan Williams 2022-07-14 @476  	u32p_replace_bits(ctrl, eiw, CXL_HDM_DECODER0_CTRL_IW_MASK);
4eeba6d677001b Dan Williams 2022-07-14  477  	*ctrl |= CXL_HDM_DECODER0_CTRL_COMMIT;
4eeba6d677001b Dan Williams 2022-07-14  478  }
4eeba6d677001b Dan Williams 2022-07-14  479  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] 68+ messages in thread

end of thread, other threads:[~2022-09-06 13:25 UTC | newest]

Thread overview: 68+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-15  0:00 [PATCH v2 00/28] CXL PMEM Region Provisioning Dan Williams
2022-07-15  0:00 ` [PATCH v2 01/28] Documentation/cxl: Use a double line break between entries Dan Williams
2022-07-20 13:26   ` Jonathan Cameron
2022-07-15  0:00 ` [PATCH v2 02/28] cxl/core: Define a 'struct cxl_switch_decoder' Dan Williams
2022-07-15  2:57   ` kernel test robot
2022-07-20 15:39   ` Jonathan Cameron
2022-07-15  0:00 ` [PATCH v2 03/28] cxl/acpi: Track CXL resources in iomem_resource Dan Williams
2022-07-15  5:23   ` Greg Kroah-Hartman
2022-07-20 16:03   ` Jonathan Cameron
2022-07-15  0:01 ` [PATCH v2 04/28] cxl/core: Define a 'struct cxl_root_decoder' Dan Williams
2022-07-20 16:07   ` Jonathan Cameron
2022-07-15  0:01 ` [PATCH v2 05/28] cxl/core: Define a 'struct cxl_endpoint_decoder' Dan Williams
2022-07-20 16:11   ` Jonathan Cameron
2022-07-15  0:01 ` [PATCH v2 06/28] cxl/hdm: Enumerate allocated DPA Dan Williams
2022-07-20 16:40   ` Jonathan Cameron
2022-07-21 15:29     ` Dan Williams
2022-07-15  0:01 ` [PATCH v2 07/28] cxl/hdm: Add 'mode' attribute to decoder objects Dan Williams
2022-07-15  0:01 ` [PATCH v2 08/28] cxl/hdm: Track next decoder to allocate Dan Williams
2022-07-20 16:45   ` Jonathan Cameron
2022-07-15  0:01 ` [PATCH v2 09/28] cxl/hdm: Add support for allocating DPA to an endpoint decoder Dan Williams
2022-07-20 16:51   ` Jonathan Cameron
2022-07-15  0:01 ` [PATCH v2 10/28] cxl/port: Record dport in endpoint references Dan Williams
2022-07-20 16:53   ` Jonathan Cameron
2022-07-15  0:01 ` [PATCH v2 11/28] cxl/port: Record parent dport when adding ports Dan Williams
2022-07-15  0:01 ` [PATCH v2 12/28] cxl/port: Move 'cxl_ep' references to an xarray per port Dan Williams
2022-07-15  0:01 ` [PATCH v2 13/28] cxl/port: Move dport tracking to an xarray Dan Williams
2022-07-20 16:56   ` Jonathan Cameron
2022-07-15  0:02 ` [PATCH v2 14/28] cxl/hdm: Add sysfs attributes for interleave ways + granularity Dan Williams
2022-07-20 16:58   ` Jonathan Cameron
2022-07-15  0:02 ` [PATCH v2 15/28] cxl/mem: Enumerate port targets before adding endpoints Dan Williams
2022-07-15  0:02 ` [PATCH v2 16/28] resource: Introduce alloc_free_mem_region() Dan Williams
2022-07-20 17:00   ` Jonathan Cameron
2022-07-21 16:10   ` Dan Williams
2022-07-21 16:10     ` Dan Williams
2022-07-21 16:10     ` [Nouveau] " Dan Williams
2022-09-06 13:25   ` Rogerio Alves
2022-07-15  0:02 ` [PATCH v2 17/28] cxl/region: Add region creation support Dan Williams
2022-07-20 17:16   ` Jonathan Cameron
2022-07-15  0:02 ` [PATCH v2 18/28] cxl/region: Add a 'uuid' attribute Dan Williams
2022-07-20 17:18   ` Jonathan Cameron
2022-07-15  0:02 ` [PATCH v2 19/28] cxl/region: Add interleave geometry attributes Dan Williams
2022-07-15  0:02 ` [PATCH v2 20/28] cxl/region: Allocate HPA capacity to regions Dan Williams
2022-07-20 17:20   ` Jonathan Cameron
2022-07-15  0:02 ` [PATCH v2 21/28] cxl/region: Enable the assignment of endpoint decoders " Dan Williams
2022-07-15  3:28   ` kernel test robot
2022-07-20 17:26   ` Jonathan Cameron
2022-07-20 19:05     ` Dan Williams
2022-07-15  0:02 ` [PATCH v2 22/28] cxl/acpi: Add a host-bridge index lookup mechanism Dan Williams
2022-07-15  0:02 ` [PATCH v2 23/28] cxl/region: Attach endpoint decoders Dan Williams
2022-07-20 17:29   ` Jonathan Cameron
2022-07-15  0:02 ` [PATCH v2 24/28] cxl/region: Program target lists Dan Williams
2022-07-20 17:41   ` Jonathan Cameron
2022-07-21 16:56     ` Dan Williams
2022-07-15  0:03 ` [PATCH v2 25/28] cxl/hdm: Commit decoder state to hardware Dan Williams
2022-07-20 17:44   ` Jonathan Cameron
2022-07-15  0:03 ` [PATCH v2 26/28] cxl/region: Add region driver boiler plate Dan Williams
2022-07-15  0:03 ` [PATCH v2 27/28] cxl/pmem: Fix offline_nvdimm_bus() to offline by bridge Dan Williams
2022-07-20 17:46   ` Jonathan Cameron
2022-07-15  0:03 ` [PATCH v2 28/28] cxl/region: Introduce cxl_pmem_region objects Dan Williams
2022-07-20 18:05   ` Jonathan Cameron
2022-07-20 18:12 ` [PATCH v2 00/28] CXL PMEM Region Provisioning Jonathan Cameron
2022-07-21 18:34   ` Dan Williams
2022-07-21 14:59 ` Jonathan Cameron
2022-07-21 16:29   ` Dan Williams
2022-07-21 17:22     ` Jonathan Cameron
  -- strict thread matches above, loose matches on Subject: below --
2022-07-16 19:55 [PATCH v2 21/28] cxl/region: Enable the assignment of endpoint decoders to regions kernel test robot
2022-07-18 11:32 ` Dan Carpenter
2022-07-16 21:58 [PATCH v2 25/28] cxl/hdm: Commit decoder state to hardware kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.