Skip to content

Commit 3caffb4

Browse files
committed
linux/dax: cleanups and comments in annotate_dax_parent()
Signed-off-by: Brice Goglin <[email protected]>
1 parent 32117b9 commit 3caffb4

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

hwloc/topology-linux.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3719,7 +3719,11 @@ annotate_dax_parent(hwloc_obj_t obj, const char *name, int fsroot_fd)
37193719
* ../../../devices/LNXSYSTM:00/LNXSYBUS:00/ACPI0012:00/ndbus0/region2/dax2.0/dax2.0/ for NVDIMMs
37203720
* ../../../devices/platform/e820_pmem/ndbus0/region0/dax0.0/dax0.0/ for fake NVM (memmap=size!start kernel parameter)
37213721
* ../../../devices/platform/hmem.0/dax0.0/ for "soft-reserved" specific-purpose memory
3722+
* ../../../devices/platform/ACPI0017:00/root0/decoder0.0/region0/dax_region0/dax0.0/ for CXL RAM
3723+
* ../../../devices/platform/ACPI0017:00/root0/nvdimm-bridge0/ndbus0/region0/dax0.0/dax0.0/ for CXL PMEM
37223724
*/
3725+
3726+
/* remove beginning and end of link to populate DAXParent */
37233727
begin = link;
37243728
/* remove the starting ".." (likely multiple) */
37253729
while (!strncmp(begin, "../", 3))
@@ -3729,9 +3733,9 @@ annotate_dax_parent(hwloc_obj_t obj, const char *name, int fsroot_fd)
37293733
begin += 8;
37303734
if (!strncmp(begin, "platform/", 9))
37313735
begin += 9;
3732-
/* remove the ending "daxX.Y" (either one or two) */
3736+
/* stop at the ending "/daxX.Y" */
37333737
end = strstr(begin, name);
3734-
if (end) {
3738+
if (end && end != begin && end[-1] == '/') {
37353739
*end = '\0';
37363740
if (end != begin && end[-1] == '/')
37373741
end[-1] = '\0';
@@ -3741,6 +3745,7 @@ annotate_dax_parent(hwloc_obj_t obj, const char *name, int fsroot_fd)
37413745
type = strstr(begin, "ndbus") ? "NVM" : "SPM";
37423746
hwloc_obj_add_info(obj, "DAXType", type);
37433747

3748+
/* insert DAXParent last because it's likely less useful than others */
37443749
hwloc_obj_add_info(obj, "DAXParent", begin);
37453750

37463751
/*

0 commit comments

Comments
 (0)