Skip to content

Commit debdce2

Browse files
davejiangdjbw
authored andcommitted
cxl/region: Deal with numa nodes not enumerated by SRAT
For the numa nodes that are not created by SRAT, no memory_target is allocated and is not managed by the HMAT_REPORTING code. Therefore hmat_callback() memory hotplug notifier will exit early on those NUMA nodes. The CXL memory hotplug notifier will need to call node_set_perf_attrs() directly in order to setup the access sysfs attributes. In acpi_numa_init(), the last proximity domain (pxm) id created by SRAT is stored. Add a helper function acpi_node_backed_by_real_pxm() in order to check if a NUMA node id is defined by SRAT or created by CFMWS. node_set_perf_attrs() symbol is exported to allow update of perf attribs for a node. The sysfs path of /sys/devices/system/node/nodeX/access0/initiators/* is created by node_set_perf_attrs() for the various attributes where nodeX is matched to the NUMA node of the CXL region. Cc: Rafael J. Wysocki <rafael@kernel.org> Reviewed-by: Alison Schofield <alison.schofield@intel.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Tested-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Dave Jiang <dave.jiang@intel.com> Link: https://lore.kernel.org/r/20240308220055.2172956-13-dave.jiang@intel.com Signed-off-by: Dan Williams <dan.j.williams@intel.com>
1 parent 067353a commit debdce2

File tree

6 files changed

+33
-1
lines changed

6 files changed

+33
-1
lines changed

drivers/acpi/numa/srat.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ static int node_to_pxm_map[MAX_NUMNODES]
2929
unsigned char acpi_srat_revision __initdata;
3030
static int acpi_numa __initdata;
3131

32+
static int last_real_pxm;
33+
3234
void __init disable_srat(void)
3335
{
3436
acpi_numa = -1;
@@ -536,6 +538,7 @@ int __init acpi_numa_init(void)
536538
if (node_to_pxm_map[i] > fake_pxm)
537539
fake_pxm = node_to_pxm_map[i];
538540
}
541+
last_real_pxm = fake_pxm;
539542
fake_pxm++;
540543
acpi_table_parse_cedt(ACPI_CEDT_TYPE_CFMWS, acpi_parse_cfmws,
541544
&fake_pxm);
@@ -547,6 +550,14 @@ int __init acpi_numa_init(void)
547550
return 0;
548551
}
549552

553+
bool acpi_node_backed_by_real_pxm(int nid)
554+
{
555+
int pxm = node_to_pxm(nid);
556+
557+
return pxm <= last_real_pxm;
558+
}
559+
EXPORT_SYMBOL_GPL(acpi_node_backed_by_real_pxm);
560+
550561
static int acpi_get_pxm(acpi_handle h)
551562
{
552563
unsigned long long pxm;

drivers/base/node.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ void node_set_perf_attrs(unsigned int nid, struct access_coordinate *coord,
215215
}
216216
}
217217
}
218+
EXPORT_SYMBOL_GPL(node_set_perf_attrs);
218219

219220
/**
220221
* struct node_cache_info - Internal tracking for memory node caches

drivers/cxl/core/cdat.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,3 +586,8 @@ int cxl_update_hmat_access_coordinates(int nid, struct cxl_region *cxlr,
586586
{
587587
return hmat_update_target_coordinates(nid, &cxlr->coord[access], access);
588588
}
589+
590+
bool cxl_need_node_perf_attrs_update(int nid)
591+
{
592+
return !acpi_node_backed_by_real_pxm(nid);
593+
}

drivers/cxl/core/core.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,5 +92,6 @@ long cxl_pci_get_latency(struct pci_dev *pdev);
9292

9393
int cxl_update_hmat_access_coordinates(int nid, struct cxl_region *cxlr,
9494
enum access_coordinate_class access);
95+
bool cxl_need_node_perf_attrs_update(int nid);
9596

9697
#endif /* __CXL_CORE_H__ */

drivers/cxl/core/region.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2279,7 +2279,12 @@ static bool cxl_region_update_coordinates(struct cxl_region *cxlr, int nid)
22792279

22802280
for (int i = 0; i < ACCESS_COORDINATE_MAX; i++) {
22812281
if (cxlr->coord[i].read_bandwidth) {
2282-
rc = cxl_update_hmat_access_coordinates(nid, cxlr, i);
2282+
rc = 0;
2283+
if (cxl_need_node_perf_attrs_update(nid))
2284+
node_set_perf_attrs(nid, &cxlr->coord[i], i);
2285+
else
2286+
rc = cxl_update_hmat_access_coordinates(nid, cxlr, i);
2287+
22832288
if (rc == 0)
22842289
cset++;
22852290
}

include/linux/acpi.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1559,4 +1559,13 @@ static inline int hmat_update_target_coordinates(int nid,
15591559
}
15601560
#endif
15611561

1562+
#ifdef CONFIG_ACPI_NUMA
1563+
bool acpi_node_backed_by_real_pxm(int nid);
1564+
#else
1565+
static inline bool acpi_node_backed_by_real_pxm(int nid)
1566+
{
1567+
return false;
1568+
}
1569+
#endif
1570+
15621571
#endif /*_LINUX_ACPI_H*/

0 commit comments

Comments
 (0)