From 8c1206e68d31f92968b72ff36bdfb6f1322326bf Mon Sep 17 00:00:00 2001 From: jsg Date: Mon, 9 Sep 2024 09:49:12 +0000 Subject: [PATCH] drm/amdgpu: add lock in kfd_process_dequeue_from_device From Yunxiang Li 381113ef01e28282f5f5a3267584b075427529f0 in linux-6.6.y/6.6.50 d225960c2330e102370815367b877baaf8bb8b5d in mainline linux --- sys/dev/pci/drm/amd/amdkfd/kfd_process_queue_manager.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sys/dev/pci/drm/amd/amdkfd/kfd_process_queue_manager.c b/sys/dev/pci/drm/amd/amdkfd/kfd_process_queue_manager.c index 43eff221eae..8aca92624a7 100644 --- a/sys/dev/pci/drm/amd/amdkfd/kfd_process_queue_manager.c +++ b/sys/dev/pci/drm/amd/amdkfd/kfd_process_queue_manager.c @@ -28,6 +28,7 @@ #include "kfd_priv.h" #include "kfd_kernel_queue.h" #include "amdgpu_amdkfd.h" +#include "amdgpu_reset.h" static inline struct process_queue_node *get_queue_by_qid( struct process_queue_manager *pqm, unsigned int qid) @@ -87,8 +88,12 @@ void kfd_process_dequeue_from_device(struct kfd_process_device *pdd) return; dev->dqm->ops.process_termination(dev->dqm, &pdd->qpd); - if (dev->kfd->shared_resources.enable_mes) - amdgpu_mes_flush_shader_debugger(dev->adev, pdd->proc_ctx_gpu_addr); + if (dev->kfd->shared_resources.enable_mes && + down_read_trylock(&dev->adev->reset_domain->sem)) { + amdgpu_mes_flush_shader_debugger(dev->adev, + pdd->proc_ctx_gpu_addr); + up_read(&dev->adev->reset_domain->sem); + } pdd->already_dequeued = true; } -- 2.20.1