Skip to content

Commit 7e38ccb

Browse files
fxkamdalexdeucher
authored andcommitted
drm/amdkfd: Fix eviction fence handling
Handle case that dma_fence_get_rcu_safe returns NULL. If restore work is already scheduled, only update its timer. The same work item cannot be queued twice, so undo the extra queue eviction. Fixes: 9a1c133 ("drm/amdkfd: Run restore_workers on freezable WQs") Signed-off-by: Felix Kuehling <[email protected]> Reviewed-by: Philip Yang <[email protected]> Tested-by: Gang BA <[email protected]> Reviewed-by: Gang BA <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 6a009ca commit 7e38ccb

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

drivers/gpu/drm/amd/amdkfd/kfd_process.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1922,6 +1922,8 @@ static int signal_eviction_fence(struct kfd_process *p)
19221922
rcu_read_lock();
19231923
ef = dma_fence_get_rcu_safe(&p->ef);
19241924
rcu_read_unlock();
1925+
if (!ef)
1926+
return -EINVAL;
19251927

19261928
ret = dma_fence_signal(ef);
19271929
dma_fence_put(ef);
@@ -1949,10 +1951,9 @@ static void evict_process_worker(struct work_struct *work)
19491951
* they are responsible stopping the queues and scheduling
19501952
* the restore work.
19511953
*/
1952-
if (!signal_eviction_fence(p))
1953-
queue_delayed_work(kfd_restore_wq, &p->restore_work,
1954-
msecs_to_jiffies(PROCESS_RESTORE_TIME_MS));
1955-
else
1954+
if (signal_eviction_fence(p) ||
1955+
mod_delayed_work(kfd_restore_wq, &p->restore_work,
1956+
msecs_to_jiffies(PROCESS_RESTORE_TIME_MS)))
19561957
kfd_process_restore_queues(p);
19571958

19581959
pr_debug("Finished evicting pasid 0x%x\n", p->pasid);

0 commit comments

Comments
 (0)