Skip to contentSkip to conversation

drm/amdkfd: Cleanup workqueue during module unload

PATCH In review Mukul Joshi 3 participants 3 messages Mar 20, 2024 – Mar 26, 2024

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

PATCH 1/1 drm/amdkfd: Cleanup workqueue during module unload

Destroy the high priority workqueue that handles interrupts during KFD node cleanup.

---
 drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c +2 -0
index dd3c43c1ad70..9b6b6e882593 100644
@@ -104,6 +104,8 @@ void kfd_interrupt_exit(struct kfd_node *node)
 	 */
 	flush_workqueue(node->ih_wq);
 
+	destroy_workqueue(node->ih_wq);
+
 	kfifo_free(&node->ih_fifo);
 }
 
Signature · 1 line
2.35.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Mukul Joshi

Destroy the high priority workqueue that handles interrupts during KFD node cleanup.

Quoted 17 lines
---
  drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c +2 -0
index dd3c43c1ad70..9b6b6e882593 100644
@@ -104,6 +104,8 @@ void kfd_interrupt_exit(struct kfd_node *node)
  	 */
  	flush_workqueue(node->ih_wq);
 
+	destroy_workqueue(node->ih_wq);
+
  	kfifo_free(&node->ih_fifo);
  }
 
#2 lore raw
In reply to Mukul Joshi
Quoted 16 lines · Mukul Joshi

Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.

Destroy the high priority workqueue that handles interrupts during KFD node cleanup.

---
  drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c +0 -0
index dd3c43c1ad70..9b6b6e882593 100644

drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c void kfd_interrupt_exit(struct kfd_node *node) · line 108

Quoted 5 lines
drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c +2 -0
@@ -104,6 +104,8 @@ void kfd_interrupt_exit(struct kfd_node *node)
          */
         flush_workqueue(node->ih_wq);
 
+       destroy_workqueue(node->ih_wq);
+

Here I think we should cancel work items that are still in the work queue, not flush workqueue node->ih_wq. In this case the kfd functions have been terminated, there is no way to handle the left work items. That would make work queue flush never finish. I think it is the reason there are orphan kernel tasks.

After cancel left work items we can call destroy_workqueue.

Regards

Xiaogang

Quoted 6 lines
drivers/gpu/drm/amd/amdkfd/kfd_interrupt.c +0 -1
         kfifo_free(&node->ih_fifo);
  }
 
--

2.35.1