Skip to content

Commit 2fd24d2

Browse files
yunxialigregkh
authored andcommitted
drm/amdgpu: add lock in kfd_process_dequeue_from_device
[ Upstream commit d225960 ] We need to take the reset domain lock before talking to MES. While in this case we can take the lock inside the mes helper. We can't do so for most other mes helpers since they are used during reset. So for consistency sake we add the lock here. Signed-off-by: Yunxiang Li <Yunxiang.Li@amd.com> Reviewed-by: Felix Kuehling <felix.kuehling@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent ba1123e commit 2fd24d2

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "kfd_priv.h"
2929
#include "kfd_kernel_queue.h"
3030
#include "amdgpu_amdkfd.h"
31+
#include "amdgpu_reset.h"
3132

3233
static inline struct process_queue_node *get_queue_by_qid(
3334
struct process_queue_manager *pqm, unsigned int qid)
@@ -87,8 +88,12 @@ void kfd_process_dequeue_from_device(struct kfd_process_device *pdd)
8788
return;
8889

8990
dev->dqm->ops.process_termination(dev->dqm, &pdd->qpd);
90-
if (dev->kfd->shared_resources.enable_mes)
91-
amdgpu_mes_flush_shader_debugger(dev->adev, pdd->proc_ctx_gpu_addr);
91+
if (dev->kfd->shared_resources.enable_mes &&
92+
down_read_trylock(&dev->adev->reset_domain->sem)) {
93+
amdgpu_mes_flush_shader_debugger(dev->adev,
94+
pdd->proc_ctx_gpu_addr);
95+
up_read(&dev->adev->reset_domain->sem);
96+
}
9297
pdd->already_dequeued = true;
9398
}
9499

0 commit comments

Comments
 (0)