From 884112efaea7ac06302fe149a17daae8d3a637d5 Mon Sep 17 00:00:00 2001 From: Philip Yang Date: Fri, 24 Nov 2017 15:03:35 -0500 Subject: [PATCH 2870/4131] drm/amdkfd: no process eviction is scheduled after process destroy Firstly ensure eviction schedule will not find process through mm again by removing process from hash list. Then wait for eviction and restore work finish, and destroy process Change-Id: I7de877573b987be39f6cd561d2954e728b1ef452 Signed-off-by: Philip Yang --- drivers/gpu/drm/amd/amdkfd/kfd_process.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c b/drivers/gpu/drm/amd/amdkfd/kfd_process.c index 50ff3ef..2e16ee4 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c @@ -464,14 +464,14 @@ static void kfd_process_notifier_release(struct mmu_notifier *mn, if (WARN_ON(p->mm != mm)) return; - cancel_delayed_work_sync(&p->eviction_work.dwork); - cancel_delayed_work_sync(&p->restore_work); - mutex_lock(&kfd_processes_mutex); hash_del_rcu(&p->kfd_processes); mutex_unlock(&kfd_processes_mutex); synchronize_srcu(&kfd_processes_srcu); + cancel_delayed_work_sync(&p->eviction_work.dwork); + cancel_delayed_work_sync(&p->restore_work); + mutex_lock(&p->mutex); /* Iterate over all process device data structures and if the -- 2.7.4