[PATCH] amd/kfd: cancle work iterms at ih_wq in kfd_interrupt_exit

Xiaogang.Chen xiaogang.chen at amd.com
Thu Apr 11 02:18:22 UTC 2024


From: Xiaogang Chen <xiaogang.chen at amd.com>

When kfd/amdgpu driver is tearing down cannot handle callback from
ih_wq. If there is still work items left cancle them instead of flush
that would wait until they got served.

Signed-off-by: Xiaogang Chen<Xiaogang.Chen at amd.com>
---
 drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c b/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c
index 9b6b6e882593..1847b9290a84 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c
@@ -98,11 +98,12 @@ void kfd_interrupt_exit(struct kfd_node *node)
 	spin_unlock_irqrestore(&node->interrupt_lock, flags);
 
 	/*
-	 * flush_work ensures that there are no outstanding
-	 * work-queue items that will access interrupt_ring. New work items
+	 * cancel work items still at ih_wq ensures that there are no outstanding
+	 * work-queue items that will access interrupt_ring. At this stage kfd/amd
+	 * driver is tearing down, cannot handle call back from wq. New work itemst
 	 * can't be created because we stopped interrupt handling above.
 	 */
-	flush_workqueue(node->ih_wq);
+	cancel_work(&node->interrupt_work);
 
 	destroy_workqueue(node->ih_wq);
 
-- 
2.25.1



More information about the amd-gfx mailing list