[PATCH v4 0/3] pull region-specific logic into new files

Gregory Price posted 3 patches 1 week, 5 days ago
There is a newer version of this series
drivers/cxl/core/Makefile      |   2 +
drivers/cxl/core/core.h        |   2 +
drivers/cxl/core/region.c      | 283 ---------------------------------
drivers/cxl/core/region_dax.c  | 106 ++++++++++++
drivers/cxl/core/region_pmem.c | 189 ++++++++++++++++++++++
drivers/cxl/cxl.h              |   1 +
6 files changed, 300 insertions(+), 283 deletions(-)
create mode 100644 drivers/cxl/core/region_dax.c
create mode 100644 drivers/cxl/core/region_pmem.c
[PATCH v4 0/3] pull region-specific logic into new files
Posted by Gregory Price 1 week, 5 days ago
cxl/core/region.c presently contains logic to handle cxl_region,
cxl_pmem_region, and cxl_dax_region.  The cxl_pmem_region and
cxl_dax_region management code deserves new files to make it clear
that this logic applies to a specific types of regions.

This also breaks up development space so fewer conflicts can occur, and
it becomes clear where changes are actually happening.

I snuck in a cleanup.h fixup for devm_cxl_add_dax_region to tidy up some
of the existing functions.

v3 -> v4:  address DJ's feedback on cleanup.h patch:
           move __free() declaration to assignment point
           restore local dev variable

v2 -> v3:  renamed from x_region to region_x because it's prettier
           added cleanup.h
           small nits asked for by Jonathan (commas)

Gregory Price (3):
  cxl/core/region: move pmem region driver logic into region_pmem.c
  cxl/core/region: move dax region device logic into region_dax.c
  cxl/core: use cleanup.h for devm_cxl_add_dax_region

 drivers/cxl/core/Makefile      |   2 +
 drivers/cxl/core/core.h        |   2 +
 drivers/cxl/core/region.c      | 283 ---------------------------------
 drivers/cxl/core/region_dax.c  | 106 ++++++++++++
 drivers/cxl/core/region_pmem.c | 189 ++++++++++++++++++++++
 drivers/cxl/cxl.h              |   1 +
 6 files changed, 300 insertions(+), 283 deletions(-)
 create mode 100644 drivers/cxl/core/region_dax.c
 create mode 100644 drivers/cxl/core/region_pmem.c

-- 
2.53.0
Re: [PATCH v4 0/3] pull region-specific logic into new files
Posted by Ira Weiny 1 week, 1 day ago
Gregory Price wrote:
> cxl/core/region.c presently contains logic to handle cxl_region,
> cxl_pmem_region, and cxl_dax_region.  The cxl_pmem_region and
> cxl_dax_region management code deserves new files to make it clear
> that this logic applies to a specific types of regions.
> 
> This also breaks up development space so fewer conflicts can occur, and
> it becomes clear where changes are actually happening.
> 
> I snuck in a cleanup.h fixup for devm_cxl_add_dax_region to tidy up some
> of the existing functions.
> 
> v3 -> v4:  address DJ's feedback on cleanup.h patch:
>            move __free() declaration to assignment point
>            restore local dev variable
> 
> v2 -> v3:  renamed from x_region to region_x because it's prettier
>            added cleanup.h
>            small nits asked for by Jonathan (commas)
> 
> Gregory Price (3):
>   cxl/core/region: move pmem region driver logic into region_pmem.c
>   cxl/core/region: move dax region device logic into region_dax.c

Through some other testing I found these moves to cause failures in the
test code builds due to the new files.

The 2 patches below fix it.

Ira

commit 0248a89b7c798cbd32cf3e9eeb97a3fafb5ac15e
Author: Ira Weiny <ira.weiny@intel.com>
Date:   Mon Mar 23 15:48:52 2026 -0500

    cxl/testing: Fix testing build; include region_dax.o
    
    The cxl core testing module must have the same code as the cxl core.  To
    do this it uses the same source files in drivers/cxl/core.  Adding a new
    file there must be included in the test code.
    
    Include region_dax.o in test file.
    
    Signed-off-by: Ira Weiny <ira.weiny@intel.com>

diff --git a/tools/testing/cxl/Kbuild b/tools/testing/cxl/Kbuild
index da6ef2c1fe0b..a6f18e93cf0d 100644
--- a/tools/testing/cxl/Kbuild
+++ b/tools/testing/cxl/Kbuild
@@ -61,6 +61,7 @@ cxl_core-y += $(CXL_CORE_SRC)/cdat.o
 cxl_core-$(CONFIG_TRACING) += $(CXL_CORE_SRC)/trace.o
 cxl_core-$(CONFIG_CXL_REGION) += $(CXL_CORE_SRC)/region.o
 cxl_core-$(CONFIG_CXL_REGION) += $(CXL_CORE_SRC)/region_pmem.o
+cxl_core-$(CONFIG_CXL_REGION) += $(CXL_CORE_SRC)/region_dax.o
 cxl_core-$(CONFIG_CXL_MCE) += $(CXL_CORE_SRC)/mce.o
 cxl_core-$(CONFIG_CXL_FEATURES) += $(CXL_CORE_SRC)/features.o
 cxl_core-$(CONFIG_CXL_EDAC_MEM_FEATURES) += $(CXL_CORE_SRC)/edac.o

commit a0dc872ac560b65f27eb41c003a02f67e3dc52e4
Author: Ira Weiny <ira.weiny@intel.com>
Date:   Mon Mar 23 15:45:42 2026 -0500

    cxl/testing: Fix testing build; include region_pmem.o
    
    The cxl core testing module must have the same code as the cxl core.  To
    do this it uses the same source files in drivers/cxl/core.  Adding a new
    file there must be included in the test code.
    
    Include region_pmem.o in test file.
    
    Signed-off-by: Ira Weiny <ira.weiny@intel.com>

diff --git a/tools/testing/cxl/Kbuild b/tools/testing/cxl/Kbuild
index 53d84a6874b7..da6ef2c1fe0b 100644
--- a/tools/testing/cxl/Kbuild
+++ b/tools/testing/cxl/Kbuild
@@ -60,6 +60,7 @@ cxl_core-y += $(CXL_CORE_SRC)/pmu.o
 cxl_core-y += $(CXL_CORE_SRC)/cdat.o
 cxl_core-$(CONFIG_TRACING) += $(CXL_CORE_SRC)/trace.o
 cxl_core-$(CONFIG_CXL_REGION) += $(CXL_CORE_SRC)/region.o
+cxl_core-$(CONFIG_CXL_REGION) += $(CXL_CORE_SRC)/region_pmem.o
 cxl_core-$(CONFIG_CXL_MCE) += $(CXL_CORE_SRC)/mce.o
 cxl_core-$(CONFIG_CXL_FEATURES) += $(CXL_CORE_SRC)/features.o
 cxl_core-$(CONFIG_CXL_EDAC_MEM_FEATURES) += $(CXL_CORE_SRC)/edac.o
Re: [PATCH v4 0/3] pull region-specific logic into new files
Posted by Gregory Price 1 week, 1 day ago
On Thu, Mar 26, 2026 at 11:28:11AM -0500, Ira Weiny wrote:
> The 2 patches below fix it.
> 
> Ira
> 

Probably i should just fold these in and add a Co-dev here.  I'll spin a
v5

~Gregory