Skip to content

Commit 67a36d6

Browse files
committed
xml/export/v2: export topo info attrs as root info in v2
Signed-off-by: Brice Goglin <[email protected]>
1 parent 1c288c9 commit 67a36d6

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

hwloc/topology-xml.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2222,6 +2222,9 @@ hwloc__xml_export_object_contents (hwloc__xml_export_state_t state, hwloc_topolo
22222222

22232223
for(i=0; i<obj->infos.count; i++)
22242224
hwloc__xml_export_info_attr(state, obj->infos.array[i].name, obj->infos.array[i].value);
2225+
if (v2export && !obj->parent)
2226+
for(i=0; i<topology->infos.count; i++)
2227+
hwloc__xml_export_info_attr(state, topology->infos.array[i].name, topology->infos.array[i].value);
22252228

22262229
if (v2export && obj->type == HWLOC_OBJ_OS_DEVICE && obj->subtype && !hwloc_obj_get_info_by_name(obj, "Backend")) {
22272230
/* v2 gpus had Backend inside the object itself */
@@ -2559,7 +2562,8 @@ hwloc__xml_export_topology(hwloc__xml_export_state_t state, hwloc_topology_t top
25592562
hwloc__xml_v2export_support(state, topology);
25602563
hwloc__xml_export_memattrs(state, topology);
25612564
hwloc__xml_export_cpukinds(state, topology);
2562-
hwloc__xml_export_infos(state, topology);
2565+
if (!(flags & HWLOC_TOPOLOGY_EXPORT_XML_FLAG_V2))
2566+
hwloc__xml_export_infos(state, topology);
25632567
}
25642568

25652569
void

tests/hwloc/xml/cxlmem+dax.v2.xml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@
1414
<info name="DMIBIOSVersion" value="0.0.0"/>
1515
<info name="DMIBIOSDate" value="02/06/2015"/>
1616
<info name="DMISysVendor" value="QEMU"/>
17+
<info name="Backend" value="Linux"/>
18+
<info name="LinuxCgroup" value="/"/>
19+
<info name="OSName" value="Linux"/>
20+
<info name="OSRelease" value="6.1.0-rc4+"/>
21+
<info name="OSVersion" value="#1 SMP PREEMPT_DYNAMIC Thu Dec 1 15:21:30 CET 2022"/>
22+
<info name="HostName" value="efi"/>
23+
<info name="Architecture" value="x86_64"/>
1724
<object type="Package" os_index="0" cpuset="0x0000000f" complete_cpuset="0x0000000f" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="3">
1825
<info name="CPUVendor" value="GenuineIntel"/>
1926
<info name="CPUFamilyNumber" value="15"/>
@@ -170,11 +177,4 @@
170177
<support name="discovery.disallowed_pu"/>
171178
<support name="discovery.disallowed_numa"/>
172179
<support name="custom.exported_support"/>
173-
<info name="Backend" value="Linux"/>
174-
<info name="LinuxCgroup" value="/"/>
175-
<info name="OSName" value="Linux"/>
176-
<info name="OSRelease" value="6.1.0-rc4+"/>
177-
<info name="OSVersion" value="#1 SMP PREEMPT_DYNAMIC Thu Dec 1 15:21:30 CET 2022"/>
178-
<info name="HostName" value="efi"/>
179-
<info name="Architecture" value="x86_64"/>
180180
</topology>

utils/lstopo/test-lstopo.output

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,8 @@ Group:4 NUMANode:1 PU:4
157157
<!DOCTYPE topology SYSTEM "hwloc2.dtd">
158158
<topology version="2.0">
159159
<object type="Machine" os_index="0" cpuset="0x0000ffff" complete_cpuset="0x0000ffff" allowed_cpuset="0x0000ffff" nodeset="0x0000000f" complete_nodeset="0x0000000f" allowed_nodeset="0x0000000f" gp_index="1">
160+
<info name="Backend" value="Synthetic"/>
161+
<info name="SyntheticDescription" value="node:4 pu:4"/>
160162
<object type="Group" cpuset="0x0000000f" complete_cpuset="0x0000000f" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="7" kind="1001" subkind="0">
161163
<object type="NUMANode" os_index="0" cpuset="0x0000000f" complete_cpuset="0x0000000f" nodeset="0x00000001" complete_nodeset="0x00000001" gp_index="6" local_memory="1073741824">
162164
<page_type size="4096" count="262144"/>
@@ -198,8 +200,6 @@ Group:4 NUMANode:1 PU:4
198200
<support name="discovery.numa"/>
199201
<support name="discovery.numa_memory"/>
200202
<support name="custom.exported_support"/>
201-
<info name="Backend" value="Synthetic"/>
202-
<info name="SyntheticDescription" value="node:4 pu:4"/>
203203
</topology>
204204
** Topology flag disallowed...
205205
assuming `node:4 pu:4' is a synthetic topology description

0 commit comments

Comments
 (0)