Skip to contentSkip to conversation

drm/amd/amdkfd: Evict all queues even HWS remove queue failed

PATCH Superseded Yifan Zha 2 participants 3 messages Mar 5, 2025 – Mar 7, 2025

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Yifan Zha

author
#0 lore raw

PATCH 1/1 drm/amd/amdkfd: Evict all queues even HWS remove queue failed

[Why]
If reset is detected and kfd need to evict working queues, HWS moving queue will be failed. Then remaining queues are not evicted and in active state.

After reset done, kfd uses HWS to termination remaining activated queues but HWS is resetted. So remove queue will be failed again.

[How]
Keep removing all queues even if HWS returns failed. It will not affect cpsch as it checks reset_domain->sem.

---
 drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 1 -
 1 file changed, 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +0 -1
index f3f2fd6ee65c..b213a845bd5b 100644
@@ -1223,7 +1223,6 @@ static int evict_process_queues_cpsch(struct device_queue_manager *dqm,
 			if (retval) {
 				dev_err(dev, "Failed to evict queue %d\n",
 					q->properties.queue_id);
-				goto out;
 			}
 		}
 	}
Signature · 1 line
2.25.1
maintainer
#1 lore raw
Quoted 21 lines · Yifan Zha

[Why]
If reset is detected and kfd need to evict working queues, HWS moving queue will be failed. Then remaining queues are not evicted and in active state.

After reset done, kfd uses HWS to termination remaining activated queues but HWS is resetted. So remove queue will be failed again.

[How]
Keep removing all queues even if HWS returns failed. It will not affect cpsch as it checks reset_domain->sem.

---
  drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 1 -
  1 file changed, 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +0 -0
index f3f2fd6ee65c..b213a845bd5b 100644

drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c static int evict_process_queues_cpsch(struct device_queue_manager *dqm, · line 1226

Quoted 4 lines
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +0 -1
@@ -1223,7 +1223,6 @@ static int evict_process_queues_cpsch(struct device_queue_manager *dqm,
  			if (retval) {
  				dev_err(dev, "Failed to evict queue %d\n",
  					q->properties.queue_id);
-				goto out;

Is every subsequent call to remove_queue_mes guaranteed to also return an error? If not, you need a way to make sure an error is returned if any queue failed to be removed even if the last queue succeeded.

Regards,
  Felix

Quoted 3 lines
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +0 -0
  			}
  		}
  	}
#2 lore raw

[AMD Official Use Only - AMD Internal Distribution Only]

Hi Felix,

Thanks. Patch v2 is submitted. It should make sure error returned even if remove_queue_mes is success.

Could you pleas help to review it again?

Thanks.

Best regard,

Yifan Zha

________________________________
From: Kuehling, Felix <[email protected]>
Sent: Thursday, March 6, 2025 8:23 AM
To: Zha, YiFan(Even) <[email protected]>; [email protected] <[email protected]>; Deucher, Alexander <[email protected]>; Zhang, Hawking <[email protected]>
Cc: Chang, HaiJun <[email protected]>; Chen, Horace <[email protected]>; Yin, ZhenGuo (Chris) <[email protected]>
Subject: Re: [PATCH] drm/amd/amdkfd: Evict all queues even HWS remove queue failed

Quoted 21 lines · Yifan Zha

[Why]
If reset is detected and kfd need to evict working queues, HWS moving queue will be failed. Then remaining queues are not evicted and in active state.

After reset done, kfd uses HWS to termination remaining activated queues but HWS is resetted. So remove queue will be failed again.

[How]
Keep removing all queues even if HWS returns failed. It will not affect cpsch as it checks reset_domain->sem.

---
  drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 1 -
  1 file changed, 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +0 -0
index f3f2fd6ee65c..b213a845bd5b 100644

drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c static int evict_process_queues_cpsch(struct device_queue_manager *dqm, · line 1226

Quoted 4 lines
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +0 -1
@@ -1223,7 +1223,6 @@ static int evict_process_queues_cpsch(struct device_queue_manager *dqm,
                       if (retval) {
                               dev_err(dev, "Failed to evict queue %d\n",
                                       q->properties.queue_id);
-                             goto out;

Is every subsequent call to remove_queue_mes guaranteed to also return an error? If not, you need a way to make sure an error is returned if any queue failed to be removed even if the last queue succeeded.

Regards,
Felix

Quoted 3 lines
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +0 -0
                       }
               }
       }