From fc2cddbdb97b621c055ee65b0c94e53e8b68a1e1 Mon Sep 17 00:00:00 2001 From: David Francis Date: Tue, 3 Feb 2026 14:22:52 -0500 Subject: [PATCH] plugin/amdgpu: Allow dump with victim unable to see all gpus In container setups, particularly k8s, cgroup may be used to restrict what GPUs a process has access to. CRIU may then be used to checkpoint that process while CRIU itself has full access to all GPUs. In this case, the kfd CRIU ioctl will return only a subset of the ioctls visible through sysfs. Don't write these devices or any links connected to them to the tology dump files. Signed-off-by: David Francis --- plugins/amdgpu/amdgpu_plugin.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/plugins/amdgpu/amdgpu_plugin.c b/plugins/amdgpu/amdgpu_plugin.c index ee55bde0a..ae57fb2f4 100644 --- a/plugins/amdgpu/amdgpu_plugin.c +++ b/plugins/amdgpu/amdgpu_plugin.c @@ -181,7 +181,7 @@ static int allocate_bo_entries(CriuKfd *e, int num_bos, struct kfd_criu_bo_bucke int topology_to_devinfo(struct tp_system *sys, struct device_maps *maps, KfdDeviceEntry **deviceEntries) { uint32_t devinfo_index = 0; - struct tp_node *node; + struct tp_node *node, *node2; list_for_each_entry(node, &sys->nodes, listm_system) { KfdDeviceEntry *devinfo = deviceEntries[devinfo_index++]; @@ -191,7 +191,7 @@ int topology_to_devinfo(struct tp_system *sys, struct device_maps *maps, KfdDevi if (NODE_IS_GPU(node)) { devinfo->gpu_id = maps_get_dest_gpu(maps, node->gpu_id); if (!devinfo->gpu_id) - return -EINVAL; + continue; devinfo->simd_count = node->simd_count; devinfo->mem_banks_count = node->mem_banks_count; @@ -233,9 +233,18 @@ int topology_to_devinfo(struct tp_system *sys, struct device_maps *maps, KfdDevi return -ENOMEM; list_for_each_entry(iolink, &node->iolinks, listm) { + bool link_to_present_node = false; + if (!iolink->valid) continue; + list_for_each_entry(node2, &sys->nodes, listm_system) + if (node2->id == iolink->node_to_id && maps_get_dest_gpu(maps, node2->gpu_id) != 0) + link_to_present_node = true; + + if (!link_to_present_node) + continue; + devinfo->iolinks[iolink_index] = xmalloc(sizeof(DevIolink)); if (!devinfo->iolinks[iolink_index]) return -ENOMEM;