amdgpu_gfx_reset_mes_compute combines two features into one: 1) hung queue/pipe reset - suspend all/queue reset/resume all 2) bad queue removal - suspend_all/remove_queue/resume_all GPU recovery aims on 1)resetting hung queues/pipes. When gpu_recovery is disabled, we need to keep 2) going. Therefore move the gpu_recovery check from KFD's reset_queues_mes into amdgpu_gfx_reset_mes_compute where queue reset is done.
Signed-off-by: Amber Lin <[email protected]> --- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 10 +++++++--- drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 9 +++------ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c index c5a2dcff5058..c30fecc653b4 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c @@ -2594,14 +2594,17 @@ int amdgpu_gfx_reset_mes_compute(struct amdgpu_device *adev, * reset detect will return the array of bad queue doorbells */ r = amdgpu_mes_suspend(adev, xcc_id); + dev_dbg(adev->dev, "Suspend all returns %d. xcc_id %d\n", r, xcc_id); + + if (!amdgpu_gpu_recovery) + goto after_reset; + /* if suspend all success, it should no hang queue */ - if (!r) { - dev_dbg(adev->dev, "Suspend all succeeds. xcc_id %d\n", xcc_id); + if (!r) /* always reset the KCQ/userq since we need to signal the fence * and we could be stuck in a loop which is preemptable. */ goto fence_reset; - } r = amdgpu_mes_detect_and_reset_hung_queues(adev, AMDGPU_RING_TYPE_COMPUTE, true, &num_hung, adev->gfx.mec.mes_hung_db_array, xcc_id); if (r) { @@ -2662,6 +2665,7 @@ int amdgpu_gfx_reset_mes_compute(struct amdgpu_device *adev, goto out; } +after_reset: /* MES doesn't detect any hung queue but we have a known bad queue * and it is not KCQ */ diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c index 86b70748617b..b77cfd8ba907 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c @@ -471,11 +471,6 @@ static int reset_queues_mes(struct device_queue_manager *dqm, struct queue *q) if (WARN_ON(dqm->detect_hang_count > 0)) return 0; - if (!amdgpu_gpu_recovery) { - r = -ENOTRECOVERABLE; - goto fail; - } - memset(&queue_input, 0x0, sizeof(struct mes_remove_queue_input)); queue_input.doorbell_offset = q->properties.doorbell_off; queue_input.gang_context_addr = q->gang_ctx_gpu_addr; @@ -3609,7 +3604,9 @@ int kfd_dqm_suspend_bad_queue_mes(struct kfd_node *knode, u32 pasid, u32 doorbel list_for_each_entry(q, &qpd->queues_list, list) { if (q->doorbell_id == doorbell_id && q->properties.is_active) { - reset_queues_mes(dqm, q); + if (reset_queues_mes(dqm, q)) + dev_dbg(knode->adev->dev, + "Fail to remove bad queue. doorbell_id 0x%x\n", q->doorbell_id); q->properties.is_evicted = true; q->properties.is_active = false; decrement_queue_count(dqm, qpd, q); -- 2.43.0
