[PATCH] drm/amdkfd: skip unbound processes during reset notification

Xiang Liu <[email protected]> Fri, 31 Jul 2026 13:41:49 +0800
Newsgroups org.freedesktop.lists.amd-gfx
Message-ID <[email protected]>
A whole-GPU reset can cover every device in an XGMI hive, while a KFD
process may be bound to only one of those devices. The reset notifier
currently looks up a user GPU ID for every process on every reset node.
For an unrelated node the lookup returns -EINVAL and triggers a false
WARN_ONCE().

Look up the process device data first and skip processes that are not
bound to the reset node. Keep the warning for a missing user GPU ID when
a process device mapping does exist, since that remains an inconsistent
state.

Signed-off-by: Xiang Liu <[email protected]>
---
 drivers/gpu/drm/amd/amdkfd/kfd_events.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_events.c b/drivers/gpu/drm/amd/amdkfd/kfd_events.c
index eb6fa4af295c..05ce2fbfa4f4 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_events.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_events.c
@@ -1162,17 +1162,18 @@ void kfd_signal_reset_event(struct kfd_node *dev)
 
 	idx = srcu_read_lock(&kfd_processes_srcu);
 	hash_for_each_rcu(kfd_processes_table, temp, p, kfd_processes) {
-		int user_gpu_id = kfd_process_get_user_gpu_id(p, dev->id);
-		struct kfd_process_device *pdd = kfd_get_process_device_data(dev, p);
+		struct kfd_process_device *pdd;
+		int user_gpu_id;
 
-		if (unlikely(user_gpu_id == -EINVAL)) {
-			WARN_ONCE(1, "Could not get user_gpu_id from dev->id:%x\n", dev->id);
+		pdd = kfd_get_process_device_data(dev, p);
+		/* A hive reset can include nodes this process never opened. */
+		if (!pdd)
 			continue;
-		}
 
-		if (unlikely(!pdd)) {
-			WARN_ONCE(1, "Could not get device data from process pid:%d\n",
-				  p->lead_thread->pid);
+		user_gpu_id = kfd_process_get_user_gpu_id(p, dev->id);
+
+		if (unlikely(user_gpu_id == -EINVAL)) {
+			WARN_ONCE(1, "Could not get user_gpu_id from dev->id:%x\n", dev->id);
 			continue;
 		}
 
-- 
2.34.1