From a4b63c5f5346a759b209b4030caeff0b24192de2 Mon Sep 17 00:00:00 2001 From: Yong Zhao Date: Thu, 9 Nov 2017 16:18:04 -0500 Subject: [PATCH 2191/4131] drm/amdkfd: Fix a bug causing CP hang at process exit When HWS is used, flushing tlb at process exit is not needed. Change-Id: I7b0d51d585bbf75734af94de4cbebb279cc408fe Signed-off-by: Yong Zhao --- drivers/gpu/drm/amd/amdkfd/kfd_process.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c b/drivers/gpu/drm/amd/amdkfd/kfd_process.c index 9ccd65c..f737e17 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c @@ -40,6 +40,7 @@ struct mm_struct; #include "kfd_priv.h" +#include "kfd_device_queue_manager.h" #include "kfd_dbgmgr.h" /* @@ -358,7 +359,15 @@ static void kfd_process_destroy_pdds(struct kfd_process *p) list_for_each_entry_safe(pdd, temp, &p->per_device_data, per_device_list) { - kfd_flush_tlb(pdd->dev, p->pasid); + /* In case of HWS, by now pasid:vmid mapping has been invalid, + * so flushing tlb using PACKET3_INVALID_TLBS packet will cause + * CP hang. Moreover, flushing tlb is not needed here as it has + * been done by HWS when pasid:vmid is dissociated. + * In summary, flushing tlb is only needed for non-HWS case. + */ + if (pdd->dev->dqm->sched_policy == KFD_SCHED_POLICY_NO_HWS) + kfd_flush_tlb(pdd->dev, p->pasid); + /* Destroy the GPUVM VM context */ if (pdd->vm) pdd->dev->kfd2kgd->destroy_process_vm( -- 2.7.4