Skip to contentSkip to conversation

drm/amdkfd: Check for pdd drm file first in CRIU restore path

PATCH In review David Francis 2 participants 2 messages May 14 – May 15

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdkfd: Check for pdd drm file first in CRIU restore path

CRIU restore ioctls are meant to be called by CRIU with no existing drm file. There's an error path
for if the drm fiel unexpectedly exists. It was positioned so it was missing a fput(drm_file).

Do that check earlier, as soon as we have the pdd.

---
 drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +5 -5
index 84b9bde7f371..db9223e00fd8 100644
@@ -2377,6 +2377,11 @@ static int criu_restore_devices(struct kfd_process *p,
 			ret = -EINVAL;
 			goto exit;
 		}
+
+		if (pdd->drm_file) {
+			ret = -EINVAL;
+			goto exit;
+		}
 		pdd->user_gpu_id = device_buckets[i].user_gpu_id;
 
 		drm_file = fget(device_buckets[i].drm_fd);
@@ -2387,11 +2392,6 @@ static int criu_restore_devices(struct kfd_process *p,
 			goto exit;
 		}
 
-		if (pdd->drm_file) {
-			ret = -EINVAL;
-			goto exit;
-		}
-
 		/* create the vm using render nodes for kfd pdd */
 		if (kfd_process_device_init_vm(pdd, drm_file)) {
 			pr_err("could not init vm for given pdd\n");
Signature · 1 line
2.34.1
maintainer Reviewed-by on v1 1/1
#1 lore raw

Public

Quoted 9 lines

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of David Francis
Sent: Thursday, May 14, 2026 10:37 AM
To: [email protected]
Cc: Francis, David <[email protected]>
Subject: [PATCH] drm/amdkfd: Check for pdd drm file first in CRIU restore path

Quoted 7 lines

CRIU restore ioctls are meant to be called by CRIU with no existing drm file. There's an error path for if the drm fiel unexpectedly exists. It was positioned so it was missing a fput(drm_file).

Do that check earlier, as soon as we have the pdd.

Quoted 36 lines
---
 drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +5 -0
index 84b9bde7f371..db9223e00fd8 100644
@@ -2377,6 +2377,11 @@ static int criu_restore_devices(struct kfd_process
 *p,
                      ret = -EINVAL;
                      goto exit;
              }
+
+             if (pdd->drm_file) {
+                     ret = -EINVAL;
+                     goto exit;
+             }
              pdd->user_gpu_id = device_buckets[i].user_gpu_id;
 
              drm_file = fget(device_buckets[i].drm_fd); @@ -2387,11
+2392,6 @@ static int criu_restore_devices(struct kfd_process *p,
                      goto exit;
              }
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +0 -6
-             if (pdd->drm_file) {
-                     ret = -EINVAL;
-                     goto exit;
-             }
-
              /* create the vm using render nodes for kfd pdd */
              if (kfd_process_device_init_vm(pdd, drm_file)) {
                      pr_err("could not init vm for given pdd\n");
--

2.34.1