From: Oded Gabbay Date: Thu, 26 May 2016 05:41:48 +0000 (+0300) Subject: drm/amdkfd: destroy dbgmgr in notifier release X-Git-Tag: firefly_0821_release~176^2~4^2~37^2~74 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=83a6e52a5129266b77cd82de6c151c14dfc95138;p=firefly-linux-kernel-4.4.55.git drm/amdkfd: destroy dbgmgr in notifier release commit bc4755a4bd1845ef6e88ac8c62f12e05bb530256 upstream. amdkfd need to destroy the debug manager in case amdkfd's notifier function is called before the unbind function, because in that case, the unbind function will exit without destroying debug manager. Signed-off-by: Oded Gabbay Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c b/drivers/gpu/drm/amd/amdkfd/kfd_process.c index 0663eeb16d5a..eb1da83c9902 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c @@ -242,13 +242,19 @@ static void kfd_process_notifier_release(struct mmu_notifier *mn, pqm_uninit(&p->pqm); /* Iterate over all process device data structure and check - * if we should reset all wavefronts */ - list_for_each_entry(pdd, &p->per_device_data, per_device_list) + * if we should delete debug managers and reset all wavefronts + */ + list_for_each_entry(pdd, &p->per_device_data, per_device_list) { + if ((pdd->dev->dbgmgr) && + (pdd->dev->dbgmgr->pasid == p->pasid)) + kfd_dbgmgr_destroy(pdd->dev->dbgmgr); + if (pdd->reset_wavefronts) { pr_warn("amdkfd: Resetting all wave fronts\n"); dbgdev_wave_reset_wavefronts(pdd->dev, p); pdd->reset_wavefronts = false; } + } mutex_unlock(&p->mutex);