cxl/region: Create node access attributes for CFMWS-only NUMA nodes
PATCH v2 1/1 cxl/region: Create node access attributes for CFMWS-only NUMA nodes
A NUMA node that only backs a CXL fixed memory window and is not enumerated by SRAT has no memory_target in the HMAT code, so hmat_callback() exits early at find_mem_target() and never creates the node's accessN attributes:/sys/devices/system/node/nodeX/accessN/initiators/* stays missing.
Commit debdce20c4f2 ("cxl/region: Deal with numa nodes not enumerated by SRAT") had the CXL region notifier call node_set_perf_attrs() directly for such nodes, but commit 2e454fb8056d ("cxl, acpi/hmat:
Update CXL access coordinates directly instead of through HMAT") replaced it with node_update_perf_attrs(), which only updates attributes that already exist and thus does nothing for these nodes.
Create the attributes with node_set_perf_attrs() when the node is not backed by a real SRAT pxm.
Tested on a QEMU CXL topology with a CFMWS window not described by SRAT or HMAT: node1/access0/initiators/{read,write}_{bandwidth,latency} appear with the calculated coordinates once the region's first memory block comes online.
---
Changes since v1 (https://lore.kernel.org/r/[email protected]):
- Open code the one-use helper (Dave Jiang)
- Comment why creating the attributes here is safe: this path runs at most once per node (Jonathan Cameron)
- Lead with the user visible regression (Alison Schofield)
--- drivers/cxl/core/region.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
drivers/cxl/core/region.c +14 -1
@@ -1,5 +1,6 @@// SPDX-License-Identifier: GPL-2.0-only /* Copyright(c) 2022 Intel Corporation. All rights reserved. */ +#include <linux/acpi.h> #include <linux/memregion.h> #include <linux/genalloc.h> #include <linux/debugfs.h>
@@ -2630,7 +2631,19 @@ static bool cxl_region_update_coordinates(struct cxl_region *cxlr, int nid)for (int i =0 ; i <ACCESS_COORDINATE_MAX ; i++) {if (cxlr->coord[i].read_bandwidth) { -node_update_perf_attrs (nid, &cxlr->coord[i], i); +/* +* A CFMWS-only node (not backed by a real SRAT pxm) +* has no HMAT memory_target, so hmat_callback() +* never created the access attributes for it: +* create them here instead of only updating them. +* This is called at most once per node (see +* nodemask_region_seen), so the attributes are not +* created twice. +*/ +if (!acpi_node_backed_by_real_pxm (nid)) +node_set_perf_attrs (nid, &cxlr->coord[i], i); +else +node_update_perf_attrs (nid, &cxlr->coord[i], i); cset++; } }
Signature · 1 line
2.43.7
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] cxl/region: missing access attributes for SRAT nodes without HMAT --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] cxl/region: missing access attributes for SRAT nodes without HMAT --
commit 2503e3249f202233ccb3653d33cc651692452053
Author: Guixin Liu <[email protected]>
cxl/region: Create node access attributes for CFMWS-only NUMA nodes
A NUMA node that only backs a CXL fixed memory window and is not enumerated by SRAT has no memory_target in the HMAT code, so hmat_callback() exits early at find_mem_target() and never creates the node's accessN attributes. Create the attributes with node_set_perf_attrs() when the node is not backed by a real SRAT pxm.
Quoted 4 lines
drivers/cxl/core/region.c +0
-0
[ ... ]
Quoted 8 lines
drivers/cxl/core/region.c +3
-1@@ -2631,7 +2632,19 @@ static bool cxl_region_update_coordinates(struct cxl_region *cxlr, int nid)for (int i =0 ; i <ACCESS_COORDINATE_MAX ; i++) {if (cxlr->coord[i].read_bandwidth) { -node_update_perf_attrs (nid, &cxlr->coord[i], i); +/* +* A CFMWS-only node (not backed by a real SRAT pxm) +* has no HMAT memory_target, so hmat_callback()
drivers/cxl/core/region.c static bool cxl_region_update_coordinates(struct cxl_region *cxlr, int nid) · line 2647
Quoted 10 lines
drivers/cxl/core/region.c +10
-0+* never created the access attributes for it: +* create them here instead of only updating them. +* This is called at most once per node (see +* nodemask_region_seen), so the attributes are not +* created twice. +*/ +if (!acpi_node_backed_by_real_pxm (nid)) +node_set_perf_attrs (nid, &cxlr->coord[i], i); +else +node_update_perf_attrs (nid, &cxlr->coord[i], i);
[Severity: Medium]
Will this silently drop access attributes for SRAT nodes that lack HMAT entries?
If the system provides an ACPI SRAT table that enumerates a NUMA node, acpi_node_backed_by_real_pxm() will return true. However, if there is no corresponding HMAT table or entry, hmat_callback() exits early and never calls node_set_perf_attrs() to create the node's access attributes.
When CXL regions later come online, cxl_region_update_coordinates() checks acpi_node_backed_by_real_pxm(), which evaluates to true. It therefore calls node_update_perf_attrs() instead of node_set_perf_attrs().
Because the attributes were never created, node_update_perf_attrs() finds an empty node->access_list and silently returns, which drops CXL access coordinate sysfs attributes and NUMA mempolicy updates. Using an ACPI topology check to guess the initialization state of generic struct node sysfs attributes leaves the underlying bug unresolved for standard SRAT nodes lacking HMAT data.
Quoted 3 lines
drivers/cxl/core/region.c +0
-0cset++; } }
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Jonathan Cameron
maintainerQuoted 52 lines · On Thu, 17 Sep 2026 03:00:49 +0000 [email protected] wrote:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] cxl/region: missing access attributes for SRAT nodes without HMAT --commit
2503e3249f202233ccb3653d33cc651692452053
Author: Guixin Liu <[email protected]>cxl/region: Create node access attributes for CFMWS-only NUMA nodes
A NUMA node that only backs a CXL fixed memory window and is not enumerated by SRAT has no
memory_targetin the HMAT code, sohmat_callback()exits early atfind_mem_target()and never creates the node's accessN attributes. Create the attributes withnode_set_perf_attrs()when the node is not backed by a real SRAT pxm.Quoted 4 lines
drivers/cxl/core/region.c +0
-0[ ... ]
Quoted 8 lines
drivers/cxl/core/region.c +3
-1@@ -2631,7 +2632,19 @@ static bool cxl_region_update_coordinates(struct cxl_region *cxlr, int nid)for (int i =0 ; i <ACCESS_COORDINATE_MAX ; i++) {if (cxlr->coord[i].read_bandwidth) { -node_update_perf_attrs (nid, &cxlr->coord[i], i); +/* +* A CFMWS-only node (not backed by a real SRAT pxm) +* has no HMAT memory_target, so hmat_callback() drivers/cxl/core/region.c static bool cxl_region_update_coordinates(struct cxl_region *cxlr, int nid) · line 2647
Quoted 10 lines
drivers/cxl/core/region.c +10
-0+* never created the access attributes for it: +* create them here instead of only updating them. +* This is called at most once per node (see +* nodemask_region_seen), so the attributes are not +* created twice. +*/ +if (!acpi_node_backed_by_real_pxm (nid)) +node_set_perf_attrs (nid, &cxlr->coord[i], i); +else +node_update_perf_attrs (nid, &cxlr->coord[i], i);[Severity: Medium]
Will this silently drop access attributes for SRAT nodes that lack HMAT entries?If the system provides an ACPI SRAT table that enumerates a NUMA node,
acpi_node_backed_by_real_pxm()will return true. However, if there is no corresponding HMAT table or entry,hmat_callback()exits early and never callsnode_set_perf_attrs()to create the node's access attributes.When CXL regions later come online,
cxl_region_update_coordinates()checksacpi_node_backed_by_real_pxm(), which evaluates to true. It therefore callsnode_update_perf_attrs()instead ofnode_set_perf_attrs().
Quoted 7 lines
Because the attributes were never created,
node_update_perf_attrs()finds an emptynode->access_listand silently returns, which drops CXL access coordinate sysfs attributes and NUMA mempolicy updates. Using an ACPI topology check to guess the initialization state of generic struct node sysfs attributes leaves the underlying bug unresolved for standard SRAT nodes lacking HMAT data.
If there is no HMAT, there is no perf data to the generic ports and none of this can be created or updated anyway.
Jonathan
Quoted 4 lines
Quoted 3 lines
drivers/cxl/core/region.c +0
-0cset++; } }
Quoted 16 lines · Guixin Liu
A NUMA node that only backs a CXL fixed memory window and is not enumerated by SRAT has no
memory_targetin the HMAT code, sohmat_callback()exits early atfind_mem_target()and never creates the node's accessN attributes:/sys/devices/system/node/nodeX/accessN/initiators/*stays missing.Commit
debdce20c4f2("cxl/region: Deal with numa nodes not enumerated by SRAT") had the CXL region notifier callnode_set_perf_attrs()directly for such nodes, but commit2e454fb8056d("cxl, acpi/hmat:
Update CXL access coordinates directly instead of through HMAT") replaced it withnode_update_perf_attrs(), which only updates attributes that already exist and thus does nothing for these nodes.Create the attributes with
node_set_perf_attrs()when the node is not backed by a real SRAT pxm.
Quoted 8 lines
Tested on a QEMU CXL topology with a CFMWS window not described by SRAT or HMAT: node1/access0/initiators/{read,write}_{bandwidth,latency} appear with the calculated coordinates once the region's first memory block comes online.
Fixes 2e454fb8056d ("cxl, acpi/hmat: Update CXL access coordinates directly instead of through HMAT")Reviewed-by Jonathan Cameron <[email protected]>Signed-off-by Guixin Liu <[email protected]>
Quoted 13 lines · Guixin Liu
A NUMA node that only backs a CXL fixed memory window and is not enumerated by SRAT has no
memory_targetin the HMAT code, sohmat_callback()exits early atfind_mem_target()and never creates the node's accessN attributes:/sys/devices/system/node/nodeX/accessN/initiators/*stays missing.Commit
debdce20c4f2("cxl/region: Deal with numa nodes not enumerated by SRAT") had the CXL region notifier callnode_set_perf_attrs()directly for such nodes, but commit2e454fb8056d("cxl, acpi/hmat:
Update CXL access coordinates directly instead of through HMAT") replaced it withnode_update_perf_attrs(), which only updates attributes that already exist and thus does nothing for these nodes.
Quoted 7 lines
Create the attributes with
node_set_perf_attrs()when the node is not backed by a real SRAT pxm.Tested on a QEMU CXL topology with a CFMWS window not described by SRAT or HMAT: node1/access0/initiators/{read,write}_{bandwidth,latency} appear with the calculated coordinates once the region's first memory block comes online.
Quoted 16 lines · Guixin Liu
A NUMA node that only backs a CXL fixed memory window and is not enumerated by SRAT has no
memory_targetin the HMAT code, sohmat_callback()exits early atfind_mem_target()and never creates the node's accessN attributes:/sys/devices/system/node/nodeX/accessN/initiators/*stays missing.Commit
debdce20c4f2("cxl/region: Deal with numa nodes not enumerated by SRAT") had the CXL region notifier callnode_set_perf_attrs()directly for such nodes, but commit2e454fb8056d("cxl, acpi/hmat:
Update CXL access coordinates directly instead of through HMAT") replaced it withnode_update_perf_attrs(), which only updates attributes that already exist and thus does nothing for these nodes.Create the attributes with
node_set_perf_attrs()when the node is not backed by a real SRAT pxm.
Quoted 8 lines
Tested on a QEMU CXL topology with a CFMWS window not described by SRAT or HMAT: node1/access0/initiators/{read,write}_{bandwidth,latency} appear with the calculated coordinates once the region's first memory block comes online.
Fixes 2e454fb8056d ("cxl, acpi/hmat: Update CXL access coordinates directly instead of through HMAT")Reviewed-by Jonathan Cameron <[email protected]>Signed-off-by Guixin Liu <[email protected]>
Applied to cxl/next:ef71014055f7
Quoted 43 lines
---
Changes since v1 (https://lore.kernel.org/r/[email protected]):- Open code the one-use helper (Dave Jiang)
- Comment why creating the attributes here is safe: this path runs at most once per node (Jonathan Cameron)
- Lead with the user visible regression (Alison Schofield)--- drivers/cxl/core/region.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)drivers/cxl/core/region.c +14
-1@@ -1,5 +1,6 @@// SPDX-License-Identifier: GPL-2.0-only /* Copyright(c) 2022 Intel Corporation. All rights reserved. */ +#include <linux/acpi.h> #include <linux/memregion.h> #include <linux/genalloc.h> #include <linux/debugfs.h> @@ -2630,7 +2631,19 @@ static bool cxl_region_update_coordinates(struct cxl_region *cxlr, int nid)for (int i =0 ; i <ACCESS_COORDINATE_MAX ; i++) {if (cxlr->coord[i].read_bandwidth) { -node_update_perf_attrs (nid, &cxlr->coord[i], i); +/* +* A CFMWS-only node (not backed by a real SRAT pxm) +* has no HMAT memory_target, so hmat_callback() +* never created the access attributes for it: +* create them here instead of only updating them. +* This is called at most once per node (see +* nodemask_region_seen), so the attributes are not +* created twice. +*/ +if (!acpi_node_backed_by_real_pxm (nid)) +node_set_perf_attrs (nid, &cxlr->coord[i], i); +else +node_update_perf_attrs (nid, &cxlr->coord[i], i); cset++; } }