Skip to contentSkip to conversation

cxl: Adjust extended linear cache failure emission in cxl_acpi

PATCH Applied Dave Jiang 3 participants 4 messages Oct 3, 2025 – Nov 3, 2025 CXL

lore
Share & tools
lore

Dave Jiang

author maintainer
#0 lore raw

PATCH v2 1/1 cxl: Adjust extended linear cache failure emission in cxl_acpi

The cxl_acpi module spams "Extended linear cache calculation failed" when the hmat memory target is not found for a node. This is normal when the memory target does not contain extended linear cache attributes. Adjust cxl_acpi_set_cache_size() to just return 0 if error is returned from hmat_get_extended_linear_cache_size(). That is the only error returned from hmat_get_extended_linear_cache_size() as -ENOENT.

Also remove the check for -EOPNOTSUPP in cxl_setup_extended_linear_cache() since that errno is never returned by cxl_acpi_set_cache_size().

---
v2:
- Rename subject line to reflect new changes.
- Further analysis of the code and determined this is the correct change.

---
 drivers/cxl/acpi.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)
drivers/cxl/acpi.c +8 -10
index d7a5539d07d4..cc4d7bf381d3 100644
@@ -353,7 +353,7 @@ static int cxl_acpi_set_cache_size(struct cxl_root_decoder *cxlrd)
 
 	rc = hmat_get_extended_linear_cache_size(&res, nid, &cache_size);
 	if (rc)
-		return rc;
+		return 0;
 
 	/*
 	 * The cache range is expected to be within the CFMWS.
@@ -381,15 +381,13 @@ static void cxl_setup_extended_linear_cache(struct cxl_root_decoder *cxlrd)
 	if (!rc)
 		return;
 
-	if (rc != -EOPNOTSUPP) {
-		/*
-		 * Failing to support extended linear cache region resize does not
-		 * prevent the region from functioning. Only causes cxl list showing
-		 * incorrect region size.
-		 */
-		dev_warn(cxlrd->cxlsd.cxld.dev.parent,
-			 "Extended linear cache calculation failed rc:%d\n", rc);
-	}
+	/*
+	 * Failing to retrieve extended linear cache region resize does not
+	 * prevent the region from functioning. Only causes cxl list showing
+	 * incorrect region size.
+	 */
+	dev_warn(cxlrd->cxlsd.cxld.dev.parent,
+		 "Extended linear cache retrieval failed rc:%d\n", rc);
 
 	/* Ignoring return code */
 	cxlrd->cache_size = 0;

base-commit: 46037455cbb748c5e85071c95f2244e81986eb58

Signature · 1 line
2.51.0
Reviewed-by on v2 1/1
#1 lore raw
Quoted 8 lines · On Fri, 3 Oct 2025 11:55:09 -0700 Dave Jiang <[email protected]> wrote:

The cxl_acpi module spams "Extended linear cache calculation failed" when the hmat memory target is not found for a node. This is normal when the memory target does not contain extended linear cache attributes. Adjust cxl_acpi_set_cache_size() to just return 0 if error is returned from hmat_get_extended_linear_cache_size(). That is the only error returned from hmat_get_extended_linear_cache_size() as -ENOENT.

Quoted 5 lines

Also remove the check for -EOPNOTSUPP in cxl_setup_extended_linear_cache() since that errno is never returned by cxl_acpi_set_cache_size().

Minor thing below. Either way

Quoted 24 lines

---
v2:
- Rename subject line to reflect new changes.
- Further analysis of the code and determined this is the correct change.

---
 drivers/cxl/acpi.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)
drivers/cxl/acpi.c +1 -1
index d7a5539d07d4..cc4d7bf381d3 100644
@@ -353,7 +353,7 @@ static int cxl_acpi_set_cache_size(struct cxl_root_decoder *cxlrd)
 
 	rc = hmat_get_extended_linear_cache_size(&res, nid, &cache_size);
 	if (rc)
-		return rc;
+		return 0;
 
 	/*
 	 * The cache range is expected to be within the CFMWS.

drivers/cxl/acpi.c static void cxl_setup_extended_linear_cache(struct cxl_root_decoder *cxlrd) · line 382

Quoted 2 lines
drivers/cxl/acpi.c +0 -0
@@ -381,15 +381,13 @@ static void cxl_setup_extended_linear_cache(struct cxl_root_decoder *cxlrd)
 	if (!rc)
 		return;

I'd prefer a logic flip so the error is out of line.

	if (rc) {
		/*
		 * Failing to support extended linear cache region resize does not
		 * prevent the region from functioning. Only causes cxl list showing
		 * incorrect region size.
		 */
		dev_warn(cxlrd->cxlsd.cxld.dev.parent,
			 "Extended linear cache calculation failed rc:%d\n", rc);
 		cxlrd->cache_size = 0;
	}
}
Quoted 22 lines
drivers/cxl/acpi.c +7 -9
-	if (rc != -EOPNOTSUPP) {
-		/*
-		 * Failing to support extended linear cache region resize does not
-		 * prevent the region from functioning. Only causes cxl list showing
-		 * incorrect region size.
-		 */
-		dev_warn(cxlrd->cxlsd.cxld.dev.parent,
-			 "Extended linear cache calculation failed rc:%d\n", rc);
-	}
+	/*
+	 * Failing to retrieve extended linear cache region resize does not
+	 * prevent the region from functioning. Only causes cxl list showing
+	 * incorrect region size.
+	 */
+	dev_warn(cxlrd->cxlsd.cxld.dev.parent,
+		 "Extended linear cache retrieval failed rc:%d\n", rc);
 
 	/* Ignoring return code */
 	cxlrd->cache_size = 0;
 

base-commit: 46037455cbb748c5e85071c95f2244e81986eb58

maintainer Reviewed-by on v2 1/1
#2 lore raw
In reply to Dave Jiang
Quoted 10 lines · Dave Jiang

The cxl_acpi module spams "Extended linear cache calculation failed" when the hmat memory target is not found for a node. This is normal when the memory target does not contain extended linear cache attributes. Adjust cxl_acpi_set_cache_size() to just return 0 if error is returned from hmat_get_extended_linear_cache_size(). That is the only error returned from hmat_get_extended_linear_cache_size() as -ENOENT.

Also remove the check for -EOPNOTSUPP in cxl_setup_extended_linear_cache() since that errno is never returned by cxl_acpi_set_cache_size().

WFM in cxl-test module. Messages like these are gone:
cxl root0: Extended linear cache calculation failed rc:-2

I'll second Jonathan's logic flip suggestion, and with that,

Quoted 4 lines
author maintainer Applied
#3 lore raw
In reply to Dave Jiang
Quoted 8 lines · Dave Jiang

The cxl_acpi module spams "Extended linear cache calculation failed" when the hmat memory target is not found for a node. This is normal when the memory target does not contain extended linear cache attributes. Adjust cxl_acpi_set_cache_size() to just return 0 if error is returned from hmat_get_extended_linear_cache_size(). That is the only error returned from hmat_get_extended_linear_cache_size() as -ENOENT.

Quoted 5 lines

Also remove the check for -EOPNOTSUPP in cxl_setup_extended_linear_cache() since that errno is never returned by cxl_acpi_set_cache_size().

Applied to cxl/next
f0c5d3bc2830f04a72087f45d15807943eabfa10

Quoted 48 lines

---
v2:
- Rename subject line to reflect new changes.
- Further analysis of the code and determined this is the correct change.

---
 drivers/cxl/acpi.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)
drivers/cxl/acpi.c +8 -10
index d7a5539d07d4..cc4d7bf381d3 100644
@@ -353,7 +353,7 @@ static int cxl_acpi_set_cache_size(struct cxl_root_decoder *cxlrd)
 
 	rc = hmat_get_extended_linear_cache_size(&res, nid, &cache_size);
 	if (rc)
-		return rc;
+		return 0;
 
 	/*
 	 * The cache range is expected to be within the CFMWS.
@@ -381,15 +381,13 @@ static void cxl_setup_extended_linear_cache(struct cxl_root_decoder *cxlrd)
 	if (!rc)
 		return;
 
-	if (rc != -EOPNOTSUPP) {
-		/*
-		 * Failing to support extended linear cache region resize does not
-		 * prevent the region from functioning. Only causes cxl list showing
-		 * incorrect region size.
-		 */
-		dev_warn(cxlrd->cxlsd.cxld.dev.parent,
-			 "Extended linear cache calculation failed rc:%d\n", rc);
-	}
+	/*
+	 * Failing to retrieve extended linear cache region resize does not
+	 * prevent the region from functioning. Only causes cxl list showing
+	 * incorrect region size.
+	 */
+	dev_warn(cxlrd->cxlsd.cxld.dev.parent,
+		 "Extended linear cache retrieval failed rc:%d\n", rc);
 
 	/* Ignoring return code */
 	cxlrd->cache_size = 0;

base-commit: 46037455cbb748c5e85071c95f2244e81986eb58