From f265103145feb0c08db012f31051ce29faf56ab3 Mon Sep 17 00:00:00 2001 From: Yong Zhao Date: Thu, 24 Aug 2017 16:36:04 -0400 Subject: [PATCH 1775/4131] drm/amdkfd: Finetune the queue reset scenario In case of cswr disabled, when the process terminates or vm fault happens for pre gfx9 chips, we choose to reset queues on the device anyway, given by-pasid reset does not work well. Change-Id: I8249f59f13a7778018d678aa3277a1f46bb79581 Signed-off-by: Yong Zhao --- drivers/gpu/drm/amd/amdkfd/cik_event_interrupt.c | 10 +++++++++- drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 9 ++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdkfd/cik_event_interrupt.c b/drivers/gpu/drm/amd/amdkfd/cik_event_interrupt.c index 2b93c32..5f122a1 100644 --- a/drivers/gpu/drm/amd/amdkfd/cik_event_interrupt.c +++ b/drivers/gpu/drm/amd/amdkfd/cik_event_interrupt.c @@ -97,7 +97,15 @@ static void cik_event_interrupt_wq(struct kfd_dev *dev, memset(&info, 0, sizeof(info)); dev->kfd2kgd->get_vm_fault_info(dev->kgd, &info); - kfd_process_vm_fault(dev->dqm, ihre->pasid, false); + /* When CWSR is disabled, we choose to reset the device, which + * will reset the queues from other processes on this device. + * This is a bug that we accept given by-pasid reset does not + * work well. + */ + if (dev->cwsr_enabled) + kfd_process_vm_fault(dev->dqm, ihre->pasid, false); + else + kfd_process_vm_fault(dev->dqm, ihre->pasid, true); if (!info.page_addr && !info.status) return; 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 461abb8..2796d9d 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c @@ -1546,7 +1546,14 @@ static int process_termination_cpsch(struct device_queue_manager *dqm, } } - retval = execute_queues_cpsch(dqm, true, false); + /* When CWSR is disabled, we choose to reset the device, which will + * reset the queues from other processes on this device. This is + * a bug that we accept given by-pasid reset does not work well. + */ + if (dqm->dev->cwsr_enabled) + retval = execute_queues_cpsch(dqm, true, false); + else + retval = execute_queues_cpsch(dqm, true, true); if (retval || qpd->reset_wavefronts) { pr_warn("Resetting wave fronts (cpsch) on dev %p\n", dqm->dev); -- 2.7.4