Skip to contentSkip to conversation

drm/amdkfd: skip unbound processes during reset notification

PATCH New Xiang Liu 1 participant 1 message Jul 31

Subsystems (3)
lore
Share & tools
lore

Xiang Liu

author
#0 lore raw

PATCH 1/1 drm/amdkfd: skip unbound processes during reset notification

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.

---
 drivers/gpu/drm/amd/amdkfd/kfd_events.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_events.c +9 -8
index eb6fa4af295c..05ce2fbfa4f4 100644
@@ -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;
 		}
 
Signature · 1 line
2.34.1