[PATCH v2 17/23] plugins/amdgpu: Add plugin to inventory even if process has no vmas
Tvrtko Ursulin <[email protected]> Fri, 10 Apr 2026 19:55:08 +0100
| Newsgroups | dev.linux.lists.criu |
|---|---|
| Message-ID | <[email protected]> |
Currently the plugin is added to the inventory only if there were amdgpu mapped vmas in the target process. This makes restoring a simple process with only an open DRM fd and some buffer objects not work. Fix it by adding the plugin to the inventory when there were open DRM files as well. Signed-off-by: Tvrtko Ursulin <[email protected]> Reviewed-By: David Francis <[email protected]> --- plugins/amdgpu/amdgpu_plugin.c | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/plugins/amdgpu/amdgpu_plugin.c b/plugins/amdgpu/amdgpu_plugin.c index 9aa9b3fb514c..f00b60453c6c 100644 --- a/plugins/amdgpu/amdgpu_plugin.c +++ b/plugins/amdgpu/amdgpu_plugin.c @@ -443,6 +443,22 @@ struct thread_data { int id; /* File ID used by CRIU to identify KFD image for this process */ }; +static int amdgpu_add_to_inventory(void) +{ + int ret; + + if (plugin_added_to_inventory) + return 0; + + ret = add_inventory_plugin(CR_PLUGIN_DESC.name); + if (ret) + pr_err("Failed to add AMDGPU plugin to inventory image\n"); + else + plugin_added_to_inventory = true; + + return ret; +} + int amdgpu_plugin_handle_device_vma(int fd, const struct stat *st_buf) { struct stat st_kfd; @@ -465,13 +481,8 @@ int amdgpu_plugin_handle_device_vma(int fd, const struct stat *st_buf) if (ret) pr_perror("%s(), Can't handle VMAs of input device", __func__); - if (!ret && !plugin_added_to_inventory) { - ret = add_inventory_plugin(CR_PLUGIN_DESC.name); - if (ret) - pr_err("Failed to add AMDGPU plugin to inventory image\n"); - else - plugin_added_to_inventory = true; - } + if (!ret) + ret = amdgpu_add_to_inventory(); return ret; } @@ -1443,8 +1454,12 @@ int amdgpu_plugin_dump_file(int fd, int id) if (ret) return ret; - /* Need to return success here so that criu can call plugins for renderD nodes */ - return try_dump_dmabuf_list(); + ret = try_dump_dmabuf_list(); + + if (!ret) + ret = amdgpu_add_to_inventory(); + + return ret; } pr_info("%s() called for fd = %d\n", __func__, major(st.st_rdev)); -- 2.52.0