[PATCH 1/3] plugin/amdgpu: Add plugin to inventory even if there are no vmas

David Francis <[email protected]> Fri, 10 Apr 2026 10:45:07 -0400
Newsgroups dev.linux.lists.criu
Message-ID <[email protected]>
The amdgpu plugin is added to the plugin inventory as the first
vma map is dumped. But it's completely possible for a process to
have driver files open but no vma maps. In this case, we still
will need the plugin on restore.

Add the plugin to the inventory whenever a device file is dumped.

Signed-off-by: David Francis <[email protected]>
---
 plugins/amdgpu/amdgpu_plugin.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/plugins/amdgpu/amdgpu_plugin.c b/plugins/amdgpu/amdgpu_plugin.c
index e3ba0de64..89ab10dac 100644
--- a/plugins/amdgpu/amdgpu_plugin.c
+++ b/plugins/amdgpu/amdgpu_plugin.c
@@ -1439,6 +1439,15 @@ int amdgpu_plugin_dump_file(int fd, int id)
 		if (ret)
 			return ret;
 
+		if (!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");
+				return ret;
+			}
+			plugin_added_to_inventory = true;
+		}
+
 		ret = record_dumped_fd(fd, true);
 		if (ret)
 			return ret;
@@ -1543,6 +1552,15 @@ int amdgpu_plugin_dump_file(int fd, int id)
 	if (ret)
 		goto exit;
 
+	if (!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");
+			goto exit;
+		}
+		plugin_added_to_inventory = true;
+	}
+
 exit:
 	xfree((void *)args.devices);
 	xfree((void *)args.bos);
-- 
2.34.1