drm/amdkfd: only fence and flush the devices whose queues got suspended
Subsystems (3)
PATCH v2 1/1 drm/amdkfd: only fence and flush the devices whose queues got suspended
suspend_queues() uses total_suspended to decide whether to issue the debug memory fence and TLB flush. Once a queue has been suspended, later devices can therefore be flushed even when none of their queues were selected.
Use per_device_suspended for both MES and HWS, and only fence and flush a MES device when its count is nonzero.
v2: count in per_device_suspended for MES and HWS (Felix)
Suggested-by Felix Kuehling <[email protected]>
Fixes ff114e705d6a ("drm/amdkfd: Add TLB flush after MES queue eviction/suspension")
Signed-off-by Jesse Zhang <[email protected]>
--- .../gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +5 -7
@@ -3952,6 +3952,7 @@ int suspend_queues(struct kfd_process *p,struct device *dev = dqm->dev->adev->dev;struct qcm_process_device *qpd = &pdd->qpd;struct queue *q; +bool is_mes = dqm->dev->kfd->shared_resources.enable_mes;int r, per_device_suspended =0 ;mutex_lock (&p->event_mutex);
@@ -3965,7 +3966,6 @@ int suspend_queues(struct kfd_process *p,if (q_idx !=QUEUE_NOT_FOUND ) {int err =suspend_single_queue (dqm, pdd, q); -bool is_mes = dqm->dev->kfd->shared_resources.enable_mes;if (!err) { queue_ids[q_idx] &= ~KFD_DBG_QUEUE_INVALID_MASK ;
@@ -3973,10 +3973,7 @@ int suspend_queues(struct kfd_process *p, q->properties.exception_status &= ~exception_clear_mask; -if (is_mes) - total_suspended++; -else - per_device_suspended++; + per_device_suspended++; }else if (err != -EBUSY ) { queue_ids[q_idx] |=KFD_DBG_QUEUE_ERROR_MASK ;break ;
@@ -3984,10 +3981,11 @@ int suspend_queues(struct kfd_process *p, } } -if (!per_device_suspended) { +if (!per_device_suspended || is_mes) {dqm_unlock (dqm);mutex_unlock (&p->event_mutex); -if (total_suspended) { +if (per_device_suspended) { + total_suspended += per_device_suspended;amdgpu_amdkfd_debug_mem_fence (dqm->dev->adev);/* Heavy-weight TLB flush after MES suspends queues */ kfd_flush_tlb (pdd);
Signature · 1 line
2.50.1