Skip to contentSkip to conversation

drm/amdkfd: queue kfd interrupt work to different CPU

PATCH In review Philip Yang 2 participants 2 messages Dec 12, 2019

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

PATCH 1/1 drm/amdkfd: queue kfd interrupt work to different CPU

Because queue_work schedule the work on the same CPU the interrupt handler is running, if there are many interrupts pending, it takes longer time for work queue to start, or even worse system will hang.

---
 drivers/gpu/drm/amd/amdkfd/kfd_device.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_device.c +2 -1
index 209bfc849352..ee2a9bb1cb07 100644
@@ -844,7 +844,8 @@ void kgd2kfd_interrupt(struct kfd_dev *kfd, const void *ih_ring_entry)
 				   patched_ihre, &is_patched)
 	    && enqueue_ih_ring_entry(kfd,
 				     is_patched ? patched_ihre : ih_ring_entry))
-		queue_work(kfd->ih_wq, &kfd->interrupt_work);
+		queue_work_on((smp_processor_id() + 1) % num_online_cpus(),
+			       kfd->ih_wq, &kfd->interrupt_work);
 
 	spin_unlock_irqrestore(&kfd->interrupt_lock, flags);
 }
Signature · 6 lines
2.17.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Reviewed-by on v1 1/1
#1 lore raw

It fixes cpu stuck issue in some extreme test cases.

Quoted 14 lines · Philip Yang

Because queue_work schedule the work on the same CPU the interrupt handler is running, if there are many interrupts pending, it takes longer time for work queue to start, or even worse system will hang.

---
  drivers/gpu/drm/amd/amdkfd/kfd_device.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_device.c +0 -0
index 209bfc849352..ee2a9bb1cb07 100644

drivers/gpu/drm/amd/amdkfd/kfd_device.c void kgd2kfd_interrupt(struct kfd_dev *kfd, const void *ih_ring_entry) · line 851

Quoted 9 lines
drivers/gpu/drm/amd/amdkfd/kfd_device.c +2 -1
@@ -844,7 +844,8 @@ void kgd2kfd_interrupt(struct kfd_dev *kfd, const void *ih_ring_entry)
  				   patched_ihre, &is_patched)
  	    && enqueue_ih_ring_entry(kfd,
  				     is_patched ? patched_ihre : ih_ring_entry))
-		queue_work(kfd->ih_wq, &kfd->interrupt_work);
+		queue_work_on((smp_processor_id() + 1) % num_online_cpus(),
+			       kfd->ih_wq, &kfd->interrupt_work);
 
  	spin_unlock_irqrestore(&kfd->interrupt_lock, flags);
  }

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx