CRIU (Checkpoint/Restore in Userspace) mailing list
 help / color / mirror / Atom feed
From: David Francis <David.Francis@amd.com>
To: <criu@lists.linux.dev>
Cc: <tvrtko.ursulin@igalia.com>, David Francis <David.Francis@amd.com>
Subject: [PATCH 3/3] plugins/amdgpu: Make next_fd without kfd
Date: Fri, 10 Apr 2026 10:45:09 -0400	[thread overview]
Message-ID: <20260410144509.738903-4-David.Francis@amd.com> (raw)
In-Reply-To: <20260410144509.738903-1-David.Francis@amd.com>

The amdgpu plugin needs to know what high fds are safe to use
to store drm fds during the restore process. This is kept in
next_fd, which is set as part of kfd restore.

If there's no kfd restore, set next_fd anyways. Use the
current pid as the pid to check; by this point in the restore
the pid has been changed to the correct value.

Signed-off-by: David Francis <David.Francis@amd.com>
---
 plugins/amdgpu/amdgpu_plugin.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/plugins/amdgpu/amdgpu_plugin.c b/plugins/amdgpu/amdgpu_plugin.c
index 1e9785440..5dcf80363 100644
--- a/plugins/amdgpu/amdgpu_plugin.c
+++ b/plugins/amdgpu/amdgpu_plugin.c
@@ -1926,6 +1926,17 @@ int amdgpu_plugin_restore_file(int id, bool *retry_needed)
 
 		pr_info("render node gpu_id = 0x%04x\n", rd->gpu_id);
 
+		if (fd_next == -1) {
+			current_pid = getpid();
+			fd_next = find_unused_fd_pid(getpid());
+			if (fd_next <= 0) {
+				pr_err("Failed to find unused fd (fd:%d)\n", fd_next);
+				ret = -EINVAL;
+				goto exit;
+			}
+			pr_info("High fd for pid %d set to %d\n", current_pid, fd_next);
+		}
+
 		if (list_empty(&restore_maps.cpu_maps) && list_empty(&restore_maps.gpu_maps)) {
 			AmdgpuDevinfo *ad;
 
-- 
2.34.1


  parent reply	other threads:[~2026-04-10 14:45 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-10 14:45 [PATCH 0/3] Patches to allow amdgpu restore without kfd file David Francis
2026-04-10 14:45 ` [PATCH 1/3] plugin/amdgpu: Add plugin to inventory even if there are no vmas David Francis
2026-04-10 15:46   ` Tvrtko Ursulin
2026-04-10 16:15     ` Francis, David
2026-04-10 14:45 ` [PATCH 2/3] plugin/amdgpu: Add topology dump file David Francis
2026-04-16 14:54   ` Tvrtko Ursulin
2026-04-16 18:26     ` Francis, David
2026-04-17  9:07       ` Tvrtko Ursulin
2026-04-17 13:21         ` Francis, David
2026-04-22 13:58           ` Tvrtko Ursulin
2026-04-10 14:45 ` David Francis [this message]
2026-04-10 15:42 ` [PATCH 0/3] Patches to allow amdgpu restore without kfd file Tvrtko Ursulin
2026-04-10 15:46   ` Francis, David
2026-04-10 16:04     ` Tvrtko Ursulin
2026-04-10 16:12       ` Francis, David

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260410144509.738903-4-David.Francis@amd.com \
    --to=david.francis@amd.com \
    --cc=criu@lists.linux.dev \
    --cc=tvrtko.ursulin@igalia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox